this repo has no description
1include "fzn_count_eq.mzn";
2include "fzn_count_eq_reif.mzn";
3
4/** @group globals.counting
5 Constrains \a c to be the number of occurrences of \a y in \a x.
6*/
7predicate count_eq(array[int] of var int: x, var int: y, var int: c) =
8 fzn_count_eq(x,y,c);
9
10/** @group globals.counting
11 Returns the number of occurrences of \a y in \a x.
12*/
13function var int: count_eq(array[int] of var int: x, var int: y) ::promise_total =
14 let { var 0..length(x): c; constraint fzn_count_eq(x,y,c); } in c;
15
16function int: count_eq(array[int] of int: x, int: y) =
17 sum(i in index_set(x))(x[i] = y);
18
19predicate count_eq_reif(array[int] of var int: x, var int: y, var int: c, var bool: b) =
20 fzn_count_eq_reif(x, y, c, b);
21
22%-----------------------------------------------------------------------------%