Originally posted by: Petr Vilím
Hello Stan,
this kind of alternatives could be modeled using optional interval variables and constraint "alternative". In particular, suppose that task A consumes either 5 units of material 1 or 3 units of material 2. Then we need three interval variables:
-
Interval variable "A" for the task itself. Not optional (task must be performed).
-
Interval variable A1 for the case A is using material 1. This interval variable must be optional (in the end A could use material 2 instead).
-
Interval variable A2 for the case A is using material 2. Again, it must be optional.
Those three variables then can be linked using constraint alternative(A, [A1, A2]). This way exactly one of the options A1 and A2 will be present and A will be synchronized with the present option. Intervals A1 and A2 could be then constrained independently. For example A1 can modify cumul "material1" using stepAtStart(A1, 5) and A2 can modify cumul "material2" using stepAtStart(A2, 3). Of course A1 and A2 could also have different length, require different predecessors, different working hours (e.g. forbidExtent) and so on. But all constraints that are common for A1 and A2 should be posted directly on A (not twice on A1 and A2) otherwise there is a risk of loosing propagation power.
Petr
Petr
#ConstraintProgramming-General#DecisionOptimization