span

Creates a span constraint between interval variables.

Syntax


constraint span(intervalVar interval, intervalVarArray array)

Parameters

  • interval: spanning interval variable.
  • array: array of spanned interval variables.

Description

This function creates a span constraint between an interval variable interval and a set of interval variables in array. This constraint states that interval when it is present spans over all present intervals from the array. That is: interval starts together with the first present interval from array and ends together with the last one. Interval interval is absent if and only if all intervals in array are absent.

Example


act1 = intervalVar(size=3);
act2 = intervalVar(size=2);
act3 = intervalVar(size=7);
act4 = intervalVar(size=6);
spanning = intervalVar();
// Activities act1,...,act4 are executed in sequence on a machine capable of
// executing only one action at a time.
noOverlap([act1,act2,act3,act4]);
// Interval variable spanning represents the immobilization time of the machine
span(spanning, [act1,act2,act3,act4]);

Example

In the above example, the activities could be optional. In this case we would define an optional spanning interval variable. This spanning interval will be present if and only if the machine is used by at least one activity in the schedule.


act1 = intervalVar(optional, size=3);
act2 = intervalVar(optional, size=2);
act3 = intervalVar(optional, size=7);
act4 = intervalVar(optional, size=6);
spanning = intervalVar(optional);
machineUsed = presenceOf(spanning);
// Activities act1,...,act4 are executed in sequence on a machine capable of
// executing only one action at a time.
noOverlap([act1,act2,act3,act4]);
// Interval variable spanning represents the immobilization time of the machine
span(spanning, [act1,act2,act3,act4]);