-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
assignment4.fzn
47 lines (47 loc) · 2.51 KB
/
assignment4.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
43
44
45
46
47
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 1..2: A1;
var 1..2: A2;
var 1..3: A3;
var 2..5: A4;
var 3..5: A5;
array [1..5] of var 1..5: A :: output_array([1..5]) = [A1, A2, A3, A4, A5];
var 1..3: B1;
var 1..4: B2;
var 3..5: B3;
var 4..5: B4;
var 4..5: B5;
array [1..5] of var 1..5: B :: output_array([1..5]) = [B1, B2, B3, B4, B5];
var 1..5: INT____00002 :: is_defined_var :: var_is_introduced;
var 1..5: INT____00004 :: is_defined_var :: var_is_introduced;
var 1..5: INT____00006 :: is_defined_var :: var_is_introduced;
var 1..5: INT____00008 :: is_defined_var :: var_is_introduced;
var 1..5: INT____00010 :: is_defined_var :: var_is_introduced;
array [1..10] of var 1..5: x :: output_array([1..5, 1..2]);
constraint fzn_all_different_int([x[1], x[3], x[5], x[7], x[9]]);
constraint fzn_all_different_int([x[2], x[4], x[6], x[8], x[10]]);
constraint array_var_int_element(x[1], A, INT____00002);
constraint array_var_int_element(x[2], B, INT____00002) :: defines_var(INT____00002);
constraint array_var_int_element(x[3], A, INT____00004);
constraint array_var_int_element(x[4], B, INT____00004) :: defines_var(INT____00004);
constraint array_var_int_element(x[5], A, INT____00006);
constraint array_var_int_element(x[6], B, INT____00006) :: defines_var(INT____00006);
constraint array_var_int_element(x[7], A, INT____00008);
constraint array_var_int_element(x[8], B, INT____00008) :: defines_var(INT____00008);
constraint array_var_int_element(x[9], A, INT____00010);
constraint array_var_int_element(x[10], B, INT____00010) :: defines_var(INT____00010);
constraint int_eq(x[1], 1);
constraint int_eq(x[3], 2);
constraint int_eq(x[5], 3);
constraint int_eq(x[7], 4);
constraint int_eq(x[9], 5);
solve satisfy;