-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
alldifferent_modulo.fzn
28 lines (28 loc) · 1.61 KB
/
alldifferent_modulo.fzn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
predicate fzn_all_different_int(array [int] of var int: x);
predicate count(array [int] of var int: x, var int: y, var int: c);
predicate fixed_fzn_cumulative(array [int] of var int: s, array [int] of int: d, array [int] of int: r, int: b);
predicate global_cardinality(array [int] of var int: x, array [int] of int: cover, array [int] of var int: counts);
predicate maximum_int(var int: m, array [int] of var int: x);
predicate minimum_int(var int: m, array [int] of var int: x);
predicate sliding_sum(int: low, int: up, int: seq, array [int] of var int: vs);
predicate sort(array [int] of var int: x, array [int] of var int: y);
predicate table_bool(array [int] of var bool: x, array [int, int] of bool: t);
predicate table_int(array [int] of var int: x, array [int, int] of int: t);
predicate var_fzn_cumulative(array [int] of var int: s, array [int] of int: d, array [int] of int: r, var int: b);
var 5..5: m :: output_var = 5;
array [1..4] of var int: mods____00001;
var 0..4: INT____00005 :: var_is_introduced = mods____00001[4];
var 0..4: INT____00004 :: var_is_introduced = mods____00001[3];
var 0..4: INT____00003 :: var_is_introduced = mods____00001[2];
var 0..4: INT____00002 :: var_is_introduced = mods____00001[1];
array [1..4] of var 1..25: x :: output_array([1..4]);
constraint fzn_all_different_int(mods____00001);
constraint int_eq(1, x[2]);
constraint int_eq(3, x[4]);
constraint int_eq(14, x[3]);
constraint int_eq(25, x[1]);
constraint int_mod(x[1], 5, mods____00001[1]);
constraint int_mod(x[2], 5, mods____00001[2]);
constraint int_mod(x[3], 5, mods____00001[3]);
constraint int_mod(x[4], 5, mods____00001[4]);
solve satisfy;