[ library(gfd) | Reference Manual | Alphabetic Index ]

# <ConsistencyModule:> cumulatives(+StartTimes, +Durations, +Heights, +Assigned, +MachineCapacities)

Multi-resource cumulatives constraint on specified tasks.

StartTimes
  Collection of N start times for tasks (domain variables or integers)
Durations
  Collection of N duration for tasks (domain variables or integers)
Heights
  Collection of N resource usages (positive) or productions (negative) by tasks (domain variables or integers) with the assigned machine
Assigned
  Collection of N ID of machine assigned to tasks (domain variables or integers)
MachineCapacities
  Collection of M maximum amount of resource available for machines (integers)

## Description

A multi-resource cumulatives scheduling constraint - scheduling of M machines providing resources for N tasks. StartTimes, Durations, Heights and Assigned are collections (a la collection_to_list/2) of equal size N of domain variables or integers. MachineLimits is a collection of M integers. The declarative meaning is: If there are N tasks and M machines, each machine having a limit of resource that can be consumed at any single time-point, and each task starting at a certain start time, having a certain duration and consuming/producing a certain (constant) amount of resource for the machine assigned to the task, then the sum of resource usage for each machine by all the tasks does not exceed the capacity for that machine at any time.

Any input variables which are not already domain variables are turned into domain variables with default domain.

This constraint generalise the cumulative constraint to multi-resources, and is also more flexible, in that tasks can both produce and consume a resource.

Note that the Gecode implementation of this constraint has index starting from 0, i.e. the numbering for the machines starts from 0. These native indices are mapped to the ECLiPSe indices starting from 1 with an additional dummy zero'th machine that is not used. A version of this constraint that uses native Gecode indexing is available as cumulatives_g/5.

ConsistencyModule is the optional module specification to give the consistency level for the propagation for this constraint: gfd_vc for value consistency.

This constraint is also known as cumulatives in the global constraint catalog, where CTR is "less than or equal to" case The constraint is implemented using Gecode's cumulatives constraint (with extra constraints on task end-times if any task duration is a domain variable).

## Examples

    [eclipse 4]: cumulatives([2,1,4,2,5,3,1],[2,4,2,3,2,2,4],[-2,1,-1,2,2,-1,1],
                    [1,1,1,1,1,2,2], [2,1]).  % Succeed

    [eclipse 5]: cumulatives([2,1,4,2,5,3,1],[2,4,2,3,2,2,4],[-2,1,-1,2,2,-1,1],
                    [1,1,1,1,1,2,2], [1,1]).  % Fails

## See Also

disjunctive / 2, cumulative / 4, eclipse_6 : collection_to_list / 2, lists : collection_to_list / 2, cumulatives_g / 5