Variables

In CPO files, the variables are declared by the following statement:

Note that it is a special case of the statement identifier = expression;.

Variable types are:

intVar
Integer variable, by default with a value in range intmin..intmax. Possible values can be specified:
  • as a list: x = intVar(1, 3, 5);
  • as a range: y = intVar(3..7);
  • or as a combination of both: z = intVar(1, 3..7, 10);
For more information on the construction of integer variables see the function intVar.
intervalVar
Represents an interval of integers. Interval variables are used mostly for scheduling. In its most basic form, an interval variable can be seen as a pair of two integer variables start and end such that start ≤ end. However there is an important difference: the interval variable can be absent to represent the fact that the interval does not exist at all (which is different from a zero-length interval). Interval variables use a quite specific syntax, for more information see the function intervalVar.
sequenceVar
This type of variable represents a sequence (i.e. total ordering) of a set of interval variables. A sequence variable is used to express constraints on chronological order of intervals such as minimum delays, allowed/forbidden transitions and so on. For more information see the function sequenceVar.
stateFunction
This type of variable represents a state function. State functions are used mostly for scheduling. They represent the evolution of a state variable over time. A state variable is used to express constraints on the compatibility and synchronization of a set of intervals. For more information see the function stateFunction.