startOfNext
Returns an integer expression that represents the start of the interval variable that is next.
Syntax
intExpr startOfNext(sequenceVar seq, intervalVar interval, int lastValue = 0, int absentValue = 0)
Parameters
-
seq: sequence variable. -
interval: interval variable. -
lastValue: value to return if interval variableintervalis the last one inseq. -
absentValue: value to return if interval variableintervalbecomes absent.
Description
This function returns an integer expression that represents the start of the interval variable
that is next to interval in sequence variable seq. When interval is present and is
the last interval of seq, it returns the constant integer value lastValue (zero by default).
When interval is absent, it returns the constant integer value absentValue (zero by default).
Example
a = intervalVar(size=5);
b = intervalVar(size=6);
c = intervalVar(optional, size=7);
// A sequence variable defined on {a, b, c}
seq = sequenceVar([a, b, c]);
// The interval variables of the sequence cannot overlap
noOverlap(seq);
// If interval variable a is not the last one, the start value of the interval next to a should be at least 10
startOfNext(seq, a, 10) >= 10;
// If interval variable c is present, it cannot be the last one (10 < 20) and the start value of the interval next
// to c should be greater than 20. Note that interval variable c can be absent (20 >= 20).
startOfNext(seq, c, 10, 20) >= 20;
Requirements
-
intervalshould be an interval variable of the sequence variableseq.