-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
balanced_brackets.fzn
144 lines (144 loc) · 10.9 KB
/
balanced_brackets.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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);
array [1..2] of int: t = [1, -1];
var 1..2: INT____00001 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00002 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00003 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00004 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00005 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00006 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00007 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00008 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00009 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00010 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00011 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00012 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00013 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00014 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00015 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00016 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00017 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00018 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00019 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00020 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00021 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00022 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00023 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00024 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00025 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00026 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00027 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00028 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00029 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00030 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00031 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00032 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00033 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00034 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00035 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00036 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00037 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00038 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00039 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00040 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00041 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00042 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00043 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00044 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00045 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00046 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00047 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00048 :: is_defined_var :: var_is_introduced;
var 1..2: INT____00049 :: is_defined_var :: var_is_introduced;
var -1..1: INT____00050 :: is_defined_var :: var_is_introduced;
array [1..26] of var 0..26: c :: output_array([1..26]);
array [1..26] of var 0..1: x :: output_array([1..26]);
constraint array_int_element(INT____00001, t, INT____00002) :: defines_var(INT____00002);
constraint array_int_element(INT____00003, t, INT____00004) :: defines_var(INT____00004);
constraint array_int_element(INT____00005, t, INT____00006) :: defines_var(INT____00006);
constraint array_int_element(INT____00007, t, INT____00008) :: defines_var(INT____00008);
constraint array_int_element(INT____00009, t, INT____00010) :: defines_var(INT____00010);
constraint array_int_element(INT____00011, t, INT____00012) :: defines_var(INT____00012);
constraint array_int_element(INT____00013, t, INT____00014) :: defines_var(INT____00014);
constraint array_int_element(INT____00015, t, INT____00016) :: defines_var(INT____00016);
constraint array_int_element(INT____00017, t, INT____00018) :: defines_var(INT____00018);
constraint array_int_element(INT____00019, t, INT____00020) :: defines_var(INT____00020);
constraint array_int_element(INT____00021, t, INT____00022) :: defines_var(INT____00022);
constraint array_int_element(INT____00023, t, INT____00024) :: defines_var(INT____00024);
constraint array_int_element(INT____00025, t, INT____00026) :: defines_var(INT____00026);
constraint array_int_element(INT____00027, t, INT____00028) :: defines_var(INT____00028);
constraint array_int_element(INT____00029, t, INT____00030) :: defines_var(INT____00030);
constraint array_int_element(INT____00031, t, INT____00032) :: defines_var(INT____00032);
constraint array_int_element(INT____00033, t, INT____00034) :: defines_var(INT____00034);
constraint array_int_element(INT____00035, t, INT____00036) :: defines_var(INT____00036);
constraint array_int_element(INT____00037, t, INT____00038) :: defines_var(INT____00038);
constraint array_int_element(INT____00039, t, INT____00040) :: defines_var(INT____00040);
constraint array_int_element(INT____00041, t, INT____00042) :: defines_var(INT____00042);
constraint array_int_element(INT____00043, t, INT____00044) :: defines_var(INT____00044);
constraint array_int_element(INT____00045, t, INT____00046) :: defines_var(INT____00046);
constraint array_int_element(INT____00047, t, INT____00048) :: defines_var(INT____00048);
constraint array_int_element(INT____00049, t, INT____00050) :: defines_var(INT____00050);
constraint int_eq(c[1], 1);
constraint int_eq(c[26], 0);
constraint int_eq(x[1], 0);
constraint int_eq(x[26], 1);
constraint int_lin_eq([-1, 1], [INT____00001, x[2]], -1) :: defines_var(INT____00001) :: domain;
constraint int_lin_eq([-1, 1], [INT____00003, x[3]], -1) :: defines_var(INT____00003) :: domain;
constraint int_lin_eq([-1, 1], [INT____00005, x[4]], -1) :: defines_var(INT____00005) :: domain;
constraint int_lin_eq([-1, 1], [INT____00007, x[5]], -1) :: defines_var(INT____00007) :: domain;
constraint int_lin_eq([-1, 1], [INT____00009, x[6]], -1) :: defines_var(INT____00009) :: domain;
constraint int_lin_eq([-1, 1], [INT____00011, x[7]], -1) :: defines_var(INT____00011) :: domain;
constraint int_lin_eq([-1, 1], [INT____00013, x[8]], -1) :: defines_var(INT____00013) :: domain;
constraint int_lin_eq([-1, 1], [INT____00015, x[9]], -1) :: defines_var(INT____00015) :: domain;
constraint int_lin_eq([-1, 1], [INT____00017, x[10]], -1) :: defines_var(INT____00017) :: domain;
constraint int_lin_eq([-1, 1], [INT____00019, x[11]], -1) :: defines_var(INT____00019) :: domain;
constraint int_lin_eq([-1, 1], [INT____00021, x[12]], -1) :: defines_var(INT____00021) :: domain;
constraint int_lin_eq([-1, 1], [INT____00023, x[13]], -1) :: defines_var(INT____00023) :: domain;
constraint int_lin_eq([-1, 1], [INT____00025, x[14]], -1) :: defines_var(INT____00025) :: domain;
constraint int_lin_eq([-1, 1], [INT____00027, x[15]], -1) :: defines_var(INT____00027) :: domain;
constraint int_lin_eq([-1, 1], [INT____00029, x[16]], -1) :: defines_var(INT____00029) :: domain;
constraint int_lin_eq([-1, 1], [INT____00031, x[17]], -1) :: defines_var(INT____00031) :: domain;
constraint int_lin_eq([-1, 1], [INT____00033, x[18]], -1) :: defines_var(INT____00033) :: domain;
constraint int_lin_eq([-1, 1], [INT____00035, x[19]], -1) :: defines_var(INT____00035) :: domain;
constraint int_lin_eq([-1, 1], [INT____00037, x[20]], -1) :: defines_var(INT____00037) :: domain;
constraint int_lin_eq([-1, 1], [INT____00039, x[21]], -1) :: defines_var(INT____00039) :: domain;
constraint int_lin_eq([-1, 1], [INT____00041, x[22]], -1) :: defines_var(INT____00041) :: domain;
constraint int_lin_eq([-1, 1], [INT____00043, x[23]], -1) :: defines_var(INT____00043) :: domain;
constraint int_lin_eq([-1, 1], [INT____00045, x[24]], -1) :: defines_var(INT____00045) :: domain;
constraint int_lin_eq([-1, 1], [INT____00047, x[25]], -1) :: defines_var(INT____00047) :: domain;
constraint int_lin_eq([-1, 1], [INT____00049, x[26]], -1) :: defines_var(INT____00049) :: domain;
constraint int_lin_eq([-1, -1, 1], [INT____00002, c[1], c[2]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00004, c[2], c[3]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00006, c[3], c[4]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00008, c[4], c[5]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00010, c[5], c[6]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00012, c[6], c[7]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00014, c[7], c[8]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00016, c[8], c[9]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00018, c[9], c[10]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00020, c[10], c[11]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00022, c[11], c[12]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00024, c[12], c[13]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00026, c[13], c[14]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00028, c[14], c[15]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00030, c[15], c[16]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00032, c[16], c[17]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00034, c[17], c[18]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00036, c[18], c[19]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00038, c[19], c[20]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00040, c[20], c[21]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00042, c[21], c[22]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00044, c[22], c[23]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00046, c[23], c[24]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00048, c[24], c[25]], 0);
constraint int_lin_eq([-1, -1, 1], [INT____00050, c[25], c[26]], 0);
solve :: int_search([x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16], x[17], x[18], x[19], x[20], x[21], x[22], x[23], x[24], x[25], x[26], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15], c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23], c[24], c[25], c[26]], first_fail, indomain_split, complete) satisfy;