endBeforeEnd

Constrains the minimum delay between the ends of two interval variables.

Syntax


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

Parameters

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

Description

The function endBeforeEnd constrains interval variables predecessor and successor in the following way. If both interval variables predecessor and successor are present then successor cannot end before endOf(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 a negative minDelay; in this case successor can actually end before the end of predecessor but still not sooner than endOf(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 be also constrained in a similar way using the expression endOf:


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

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