Originally posted by: Petr Vilím
Hello Cedric,
the trick is to use elementary stepAtFoo functions with variable height. For example:
cumulFunction loadStep = stepAtStart(someIntervalVar, 0, maxPalettes);
In a way the statement above creates a new decision variable with domain [0, maxPalettes]. Its value can be accessed using function heightAtStart. For example to force the step to be bigger than 3:
heightAtStart(someIntervalVar, loadStep) > 3;
Or to create another step with the same height:
cumulFunction unloadStep = stepAtEnd(otherIntervalVar, 0, maxPalettes);
heightAtStart(someIntervalVar, loadStep) == heightAtEnd(otherIntervalVar, unloadStep);
Finally, the main cumul function should be combined from individual steps. In our simple case:
loadStep - unloadStep <= truckCapacity;
I hope it helps, Petr
#ConstraintProgramming-General#DecisionOptimization