startBeforeStart

Constrains the minimum delay between starts of two interval variables.

Syntax


constraint startBeforeStart(intervalVar predecessor, intervalVar successor, intExpr minDelay = 0)

Parameters

  • predecessor: interval variable which starts before.
  • successor: interval variable which starts after.
  • minDelay: the minimal delay between start of predecessor and start of successor. If not specified then zero is used.

Description

The function startBeforeStart constrains interval variables predecessor and successor in the following way. If both interval variables predecessor and successor are present then successor cannot start before startOf(predecessor)+minDelay. If predecessor or successor is absent then the constraint is automatically satisfied.

The default value for minDelay is zero. It is possible to specify even negative minDelay, in this case successor can actually start before the start of predecessor but still not sooner than startOf(predecessor)+minDelay.

Example

Tasks a, b, c form a FIFO (in this order). That is, task a starts first and also finishes first, task b starts and finishes second and finally task c starts and finishes the last.


a = intervalVar();
b = intervalVar();
c = intervalVar();
startBeforeStart(a, b);
startBeforeStart(b, c);
endBeforeEnd(a, b);
endBeforeEnd(b, c);

Notes

Interval variables can also be constrained in a similar way using the expression startOf:


startOf(predecessor, intmin) + minDelay <= startOf(successor, intmax);

CP Optimizer automatically converts the constraint above into startBeforeStart whenever possible. It is preferable to use startBeforeStart because it is clearer and requires less preprocessing.