startBeforeEnd

Constrains minimum delay between the start of one interval variable and end of another one.

Syntax


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

Parameters

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

Description

The function startBeforeEnd constrains interval variables predecessor and successor in the following way. If both interval variables predecessor and successor are present then successor cannot end 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 a negative minDelay; in this case successor can actually end before the start of predecessor but still not sooner than startOf(predecessor)+minDelay.

Example

Task x can start only during period y which is also unknown:


x = intervalVar(length=5);
y = intervalVar(length=30);
startBeforeEnd(x, y);
startBeforeStart(y, x);

Notes

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


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

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