A cumulative scheduling constraint. StartTimes, Durations and Usages are collections (a la collection_to_list/2) of equal size N representing N tasks. Durations are non-negative, Usages and ResourceLimit are strictly positive. The declarative meaning is:
The N tasks, each starting at a certain start time, having a certain duration and consuming a certain (constant) amount of resource, then the sum of resource usage of all the tasks does not exceed ResourceLimit at any time.
A zero duration task both consume and release the resource it uses at the same time-point, so effectively it does not consume any resources at that time-point, but there must be sufficient resources available at that time-point to allow the task to be scheduled.
Note that the constraint is implemented by different Gecode propagators, depending on if Durations contains domain variables or not. If Durations does have domain variables, the Gecode propagator requires an extra End domain variable specifying the end time, and a constraint
End #= Start + Durationfor each task. These are posted as part of the constraint (the End variables are not accessible by the user).
Any input variables which are not already domain variables are turned into domain variables with default domain.
This constraint is also known as cumulative in the global constraint catalog, but in the catalog, tasks with zero duration have a different definition of overlap with other tasks. The constraint is implemented using Gecode's cumulative constraint (with extra constraints on task end-times if any task duration is a domain variable).
% success (peak consumption is 7) [eclipse 7]: cumulative([1,2,3,6,7], [3,9,10,6,2], [1,2,1,1,3], 8). % fail (peak consumption is 7) [eclipse 8]: cumulative([1,2,3,6,7], [3,9,10,6,2], [1,2,1,1,3], 6).