forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alldifferent_same_value.fzn
42 lines (42 loc) · 2.62 KB
/
alldifferent_same_value.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
35
36
37
38
39
40
41
42
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 bool: BOOL____00001 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00003 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00005 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00007 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00002 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00004 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00006 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00008 :: is_defined_var :: var_is_introduced;
var 0..4: INT____00009 :: is_defined_var :: var_is_introduced;
var 0..4: nsame :: output_var = INT____00009;
array [1..4] of var 1..7: x :: output_array([1..4]);
array [1..4] of var 1..7: y :: output_array([1..4]);
constraint fzn_all_different_int(x);
constraint bool2int(BOOL____00001, INT____00002) :: defines_var(INT____00002);
constraint bool2int(BOOL____00003, INT____00004) :: defines_var(INT____00004);
constraint bool2int(BOOL____00005, INT____00006) :: defines_var(INT____00006);
constraint bool2int(BOOL____00007, INT____00008) :: defines_var(INT____00008);
constraint int_eq(1, x[3]);
constraint int_eq(1, y[1]);
constraint int_eq(1, y[3]);
constraint int_eq(3, x[2]);
constraint int_eq(3, y[2]);
constraint int_eq(5, x[4]);
constraint int_eq(7, x[1]);
constraint int_eq(7, y[4]);
constraint int_eq_reif(x[1], y[1], BOOL____00001) :: defines_var(BOOL____00001);
constraint int_eq_reif(x[2], y[2], BOOL____00003) :: defines_var(BOOL____00003);
constraint int_eq_reif(x[3], y[3], BOOL____00005) :: defines_var(BOOL____00005);
constraint int_eq_reif(x[4], y[4], BOOL____00007) :: defines_var(BOOL____00007);
constraint int_lin_eq([-1, 1, 1, 1, 1], [INT____00009, INT____00002, INT____00004, INT____00006, INT____00008], 0) :: defines_var(INT____00009);
solve satisfy;