first
Constrains an interval variable to be the first in a sequence.
Syntax
constraint first(sequenceVar seq, intervalVar interval)
Parameters
-
seq: sequence variable. -
interval: interval variable.
Description
This function returns a constraint that states that whenever interval variable interval is present,
it must be ordered first in the sequence variable seq.
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 c is present, it must be the first one in the sequence
first(seq, c);
Requirements
-
intervalshould be an interval variable of sequence variableseq.