# 4.2.2.10. Scheduling constraints

In this section: alternative, cumulative, cumulatives, disjunctive, disjunctive_strict, span.

## alternative

 ```predicate alternative(var opt int: s0, var int: d0, array [int] of var opt int: s, array [int] of var int: d) ``` Alternative constraint for optional tasks. The task with start time s0 and duration d0 spans the optional tasks with start times s[i] and durations d[i]), and at most one of those tasks can occur.

## cumulative

 ```1. predicate cumulative(array [int] of var int: s, array [int] of var int: d, array [int] of var int: r, var int: b) 2. predicate cumulative(array [int] of var opt int: s, array [int] of var int: d, array [int] of var int: r, var int: b) ``` Requires that a set of tasks given by start times s, durations d, and resource requirements r, never require more than a global resource bound b at any one time. Assumptions: forall i, d[i] >= 0 and r[i] >= 0 Requires that a set of tasks given by start times s, durations d, and resource requirements r, never require more than a global resource bound b at any one time. Start times are optional variables, so that absent tasks do not need to be scheduled. Assumptions: forall i, d[i] >= 0 and r[i] >= 0

## cumulatives

 ```predicate cumulatives(array [\$\$E] of var int: s, array [\$\$E] of var int: d, array [\$\$E] of var int: r, array [\$\$E] of var \$\$M: m, array [\$\$M] of var int: b, bool: upper) ``` We have a set of tasks given by start times s, durations d, resource requirements r, and machines m. We also have a set of machines given by resource bounds b. Finally, we have a Boolean flag upper. The constraint requires that forall i, m[i] is in the index set of b and that for each machine j and time instant t, either no task assigned to j executes at \t, or the total resource requirement of such tasks is not greater than, if upper is true, or not less than, if upper is false, the given bound b[j]. Resource requirements can be positive (for consumption) or negative (for production). Assumptions: forall i, d[i] >= 0

## disjunctive

 ```1. predicate disjunctive(array [\$\$T] of var int: s, array [\$\$T] of var int: d) 2. predicate disjunctive(array [\$\$T] of var opt int: s, array [\$\$T] of var int: d) ``` Requires that a set of tasks given by start times s and durations d do not overlap in time. Tasks with duration 0 can be scheduled at any time, even in the middle of other tasks. Assumptions: forall i, d[i] >= 0 Requires that a set of tasks given by start times s and durations d do not overlap in time. Tasks with duration 0 can be scheduled at any time, even in the middle of other tasks. Start times are optional variables, so that absent tasks do not need to be scheduled. Assumptions: forall i, d[i] >= 0

## disjunctive_strict

 ```1. predicate disjunctive_strict(array [\$\$T] of var int: s, array [\$\$T] of var int: d) 2. predicate disjunctive_strict(array [\$\$T] of var opt int: s, array [\$\$T] of var int: d) ``` Requires that a set of tasks given by start times s and durations d do not overlap in time. Tasks with duration 0 CANNOT be scheduled at any time, but only when no other task is running. Assumptions: forall i, d[i] >= 0 Requires that a set of tasks given by start times s and durations d do not overlap in time. Tasks with duration 0 CANNOT be scheduled at any time, but only when no other task is running. Start times are optional variables, so that absent tasks do not need to be scheduled. Assumptions: forall i, d[i] >= 0

## span

 ```predicate span(var opt int: s0, var int: d0, array [\$\$E] of var opt int: s, array [\$\$E] of var int: d) ``` Span constraint for optional tasks. Task (s0,d0) spans the optional tasks (s[i],d[i]) in the array arguments.