prev (scheduling)
OPL function (scheduling) to sequence interval variables
Purpose
OPL function (scheduling) to sequence interval variables. For the function regarding element position in a set, see prev.
type |
---|
boolean |
Syntax
prev(p, a, b) Where: dvar interval a; dvar interval b; dvar sequence p;
Description
States that if intervals a and b are present, a appears just before b in sequence p; no other intervals can be ordered between a and b in sequence p. Compare prev with before, which allows other intervals to be ordered between the two.
Notes
Unless a
noOverlap
constraint is applied to the sequence variable, the order of intervals in a sequence does not necessarily correspond to the order of the intervals in time.The
prev
scheduling constraint cannot be used in a meta-constraint.
Example
A set of 2*n activities to be sequenced on a unary resource such that A[2*i-1] is constrained to be executed immediately prior to A[2*i].
dvar interval A[i in 1..2*n] size d[i]; dvar sequence p in A; subject to { noOverlap(p); forall (i in 1..n) prev(p, A[2*i-1], A[2*i]); };