[ library(gfd) | Reference Manual | Alphabetic Index ]
# cumulative_optional(+StartTimes, +Durations, +Usages, +ResourceLimit, +Scheduled)

Single resource cumulative constraint on scheduling optional tasks.
*StartTimes*
- Collection of start times for tasks (integer variables or integers)
*Durations*
- Collection of duration for tasks (non-negative integer variables or integers)
*Usages*
- Collection of resource usages (positive integers)
*ResourceLimit*
- Maximum amount of resource available
(domain variable or integer, array notation accepted)
*Scheduled*
- Collection of N scheduled booleans for task (0/1 domain variables or integers)

## Description

A cumulative scheduling constraint. StartTimes, Durations, Usages and
Scheduled are collections (a la collection_to_list/2) of equal size N,
representing N task. Durations must be non-negative, Usages and
ResourceLimit must be strictly positive, and Scheduled are booleans
(values of 0/1). 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 task would not be scheduled
if its Scheduled boolean is 0, and must be scheduled if 1.
/P>

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 + Duration

for 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.

## See Also

disjunctive / 2, disjunctive_optional / 3, cumulative / 4, lists : collection_to_list / 2, ic_edge_finder : cumulative / 4, ic_edge_finder3 : cumulative / 4, edge_finder : cumulative / 4, edge_finder3 : cumulative / 4, cumulative : cumulative / 4, ic_cumulative : cumulative / 4