Optional interval is a great idea of optional interval/task that can be active or inactive based on boolean variable. I found it very useful in complex scheduling problems.
It was introduced in IBM Cp Optimizer more than ten years ago. Unfortunatelly except constraint solver (not developed anymore) and cp-sat solver in or-tools optional interval is not supported by any other solver.
Is there a reason why optional interval is not supported by other solvers (effort?) or exists alternative to optional intervals in other constraint solvers ?
Optional interval is defined by four variables: start, duration, end and active variable (boolean variable). In case active=true
, start + duration = end
should be satisfied and all constraints that work with the interval (like cumulative constraints) should respect it.
I use optional intervals primarily to express alternatives. In case I need to choose between two or more workers for an operation, the sum of active variables equal to one guarantees that only one worker is used. Without optional intervals, I need to choose a worker for an operation too early and all other alternatives are lost during search phase until backtrack.
Cumulative constraint to guarantee that a worker is not used more than once at same time doesn't work very well when assignments of a worker are unknown. Most time there's nothing to propagate since solver waits for mostly random assignments. My experience with a solver without optional intervals.