this repo has no description
1include "all_different.mzn";
2include "disjunctive.mzn";
3include "fzn_cumulative.mzn";
4include "fzn_cumulative_reif.mzn";
5
6/** @group globals.scheduling
7 Requires that a set of tasks given by start times \a s, durations \a d, and
8 resource requirements \a r, never require more than a global resource bound
9 \a b at any one time.
10
11 Assumptions:
12 - forall \p i, \a d[\p i] >= 0 and \a r[\p i] >= 0
13*/
14predicate cumulative(array[int] of var int: s,
15 array[int] of var int: d,
16 array[int] of var int: r, var int: b) =
17 assert(index_set(s) == index_set(d) /\ index_set(s) == index_set(r),
18 "cumulative: the 3 array arguments must have identical index sets",
19 assert(lb_array(d) >= 0 /\ lb_array(r) >= 0,
20 "cumulative: durations and resource usages must be non-negative",
21 if is_fixed(b) /\
22 forall(i in index_set(r))
23 (is_fixed(r[i]) /\ fix(r[i]) + lb_array(r) > ub(b))
24 then
25 if forall(i in index_set(d))(is_fixed(d[i]) /\ fix(d[i]) == 1)
26 then
27 all_different(s)
28 else
29 disjunctive(s, d)
30 endif
31 else
32 fzn_cumulative(s, d, r, b)
33 endif
34 ));