forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
averbach_1.3.fzn
34 lines (34 loc) · 1.68 KB
/
averbach_1.3.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
29
30
31
32
33
34
predicate 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_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_cumulative(array [int] of var int: s, array [int] of int: d, array [int] of int: r, var int: b);
array [1..5] of int: men = [1, 2, 3, 4, 5];
var 1..5: X :: output_var;
array [1..5] of var 1..5: pony :: output_array([1..5]);
array [1..5] of var 1..5: wife :: output_array([1..5]);
constraint all_different_int(pony);
constraint all_different_int(wife);
constraint array_var_int_element(X, pony, wife[2]);
constraint array_var_int_element(X, wife, 2);
constraint int_eq(pony[1], 2);
constraint int_eq(pony[3], 5);
constraint int_eq(pony[4], 1);
constraint int_eq(pony[5], 4);
constraint int_eq(wife[1], 1);
constraint int_eq(wife[3], 3);
constraint int_ne(pony[1], wife[1]);
constraint int_ne(pony[2], wife[2]);
constraint int_ne(pony[3], wife[3]);
constraint int_ne(pony[4], wife[4]);
constraint int_ne(pony[5], wife[5]);
constraint int_ne(wife[1], 2);
constraint int_ne(wife[3], 5);
constraint int_ne(wife[5], 4);
solve satisfy;