forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
balance_interval.fzn
201 lines (201 loc) · 15.2 KB
/
balance_interval.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
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);
var bool: BOOL____00005 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00006 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00007 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00009 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00010 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00011 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00013 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00014 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00015 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00017 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00018 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00019 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00021 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00022 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00023 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00025 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00026 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00027 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00029 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00030 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00031 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00033 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00034 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00035 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00037 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00038 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00039 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00041 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00042 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00043 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00045 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00046 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00047 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00049 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00050 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00051 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00053 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00054 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00055 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00057 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00058 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00059 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00061 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00062 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00063 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00068 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00069 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00070 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00071 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00072 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00073 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00074 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00075 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00076 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00077 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00078 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00079 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00080 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00081 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00082 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00083 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00084 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00085 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00086 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00087 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00088 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00008 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00012 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00016 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00020 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00024 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00028 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00032 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00036 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00040 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00044 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00048 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00052 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00056 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00060 :: is_defined_var :: var_is_introduced;
var 0..1: INT____00064 :: is_defined_var :: var_is_introduced;
var 0..5: INT____00065 :: is_defined_var :: var_is_introduced;
var 0..5: INT____00066 :: is_defined_var :: var_is_introduced;
var -5..4: bal;
var 0..5: c_max____00003;
var 1..5: c_min____00004;
array [1..3] of var 0..5: counts____00002;
array [1..6] of var 0..12: intervals____00001;
array [1..5] of var 0..6: x :: output_array([1..5]);
constraint array_bool_and([BOOL____00005, BOOL____00006], BOOL____00007) :: defines_var(BOOL____00007);
constraint array_bool_and([BOOL____00009, BOOL____00010], BOOL____00011) :: defines_var(BOOL____00011);
constraint array_bool_and([BOOL____00013, BOOL____00014], BOOL____00015) :: defines_var(BOOL____00015);
constraint array_bool_and([BOOL____00017, BOOL____00018], BOOL____00019) :: defines_var(BOOL____00019);
constraint array_bool_and([BOOL____00021, BOOL____00022], BOOL____00023) :: defines_var(BOOL____00023);
constraint array_bool_and([BOOL____00025, BOOL____00026], BOOL____00027) :: defines_var(BOOL____00027);
constraint array_bool_and([BOOL____00029, BOOL____00030], BOOL____00031) :: defines_var(BOOL____00031);
constraint array_bool_and([BOOL____00033, BOOL____00034], BOOL____00035) :: defines_var(BOOL____00035);
constraint array_bool_and([BOOL____00037, BOOL____00038], BOOL____00039) :: defines_var(BOOL____00039);
constraint array_bool_and([BOOL____00041, BOOL____00042], BOOL____00043) :: defines_var(BOOL____00043);
constraint array_bool_and([BOOL____00045, BOOL____00046], BOOL____00047) :: defines_var(BOOL____00047);
constraint array_bool_and([BOOL____00049, BOOL____00050], BOOL____00051) :: defines_var(BOOL____00051);
constraint array_bool_and([BOOL____00053, BOOL____00054], BOOL____00055) :: defines_var(BOOL____00055);
constraint array_bool_and([BOOL____00057, BOOL____00058], BOOL____00059) :: defines_var(BOOL____00059);
constraint array_bool_and([BOOL____00061, BOOL____00062], BOOL____00063) :: defines_var(BOOL____00063);
constraint array_bool_and([BOOL____00068, BOOL____00073, BOOL____00074], BOOL____00086) :: defines_var(BOOL____00086);
constraint array_bool_and([BOOL____00075, BOOL____00079, BOOL____00080], BOOL____00087) :: defines_var(BOOL____00087);
constraint array_bool_and([BOOL____00081, BOOL____00084, BOOL____00085], BOOL____00088) :: defines_var(BOOL____00088);
constraint array_bool_or([BOOL____00069, BOOL____00070], BOOL____00074) :: defines_var(BOOL____00074);
constraint array_bool_or([BOOL____00071, BOOL____00072], BOOL____00073) :: defines_var(BOOL____00073);
constraint array_bool_or([BOOL____00076, BOOL____00077], BOOL____00080) :: defines_var(BOOL____00080);
constraint array_bool_or([BOOL____00078, BOOL____00072], BOOL____00079) :: defines_var(BOOL____00079);
constraint array_bool_or([BOOL____00082, BOOL____00077], BOOL____00085) :: defines_var(BOOL____00085);
constraint array_bool_or([BOOL____00083, BOOL____00070], BOOL____00084) :: defines_var(BOOL____00084);
constraint array_bool_or([BOOL____00088, BOOL____00086, BOOL____00087], true);
constraint bool2int(BOOL____00007, INT____00008) :: defines_var(INT____00008);
constraint bool2int(BOOL____00011, INT____00012) :: defines_var(INT____00012);
constraint bool2int(BOOL____00015, INT____00016) :: defines_var(INT____00016);
constraint bool2int(BOOL____00019, INT____00020) :: defines_var(INT____00020);
constraint bool2int(BOOL____00023, INT____00024) :: defines_var(INT____00024);
constraint bool2int(BOOL____00027, INT____00028) :: defines_var(INT____00028);
constraint bool2int(BOOL____00031, INT____00032) :: defines_var(INT____00032);
constraint bool2int(BOOL____00035, INT____00036) :: defines_var(INT____00036);
constraint bool2int(BOOL____00039, INT____00040) :: defines_var(INT____00040);
constraint bool2int(BOOL____00043, INT____00044) :: defines_var(INT____00044);
constraint bool2int(BOOL____00047, INT____00048) :: defines_var(INT____00048);
constraint bool2int(BOOL____00051, INT____00052) :: defines_var(INT____00052);
constraint bool2int(BOOL____00055, INT____00056) :: defines_var(INT____00056);
constraint bool2int(BOOL____00059, INT____00060) :: defines_var(INT____00060);
constraint bool2int(BOOL____00063, INT____00064) :: defines_var(INT____00064);
constraint int_eq(3, x[3]);
constraint int_eq(3, x[4]);
constraint int_eq(4, x[2]);
constraint int_eq(4, x[5]);
constraint int_eq(6, x[1]);
constraint int_eq(intervals____00001[1], 0);
constraint int_eq(intervals____00001[2], 2);
constraint int_eq(intervals____00001[3], 3);
constraint int_eq(intervals____00001[4], 5);
constraint int_eq(intervals____00001[5], 6);
constraint int_eq(intervals____00001[6], 8);
constraint int_eq_reif(c_min____00004, counts____00002[1], BOOL____00068) :: defines_var(BOOL____00068);
constraint int_eq_reif(c_min____00004, counts____00002[2], BOOL____00075) :: defines_var(BOOL____00075);
constraint int_eq_reif(c_min____00004, counts____00002[3], BOOL____00081) :: defines_var(BOOL____00081);
constraint int_eq_reif(counts____00002[1], 0, BOOL____00077) :: defines_var(BOOL____00077);
constraint int_eq_reif(counts____00002[2], 0, BOOL____00070) :: defines_var(BOOL____00070);
constraint int_eq_reif(counts____00002[3], 0, BOOL____00072) :: defines_var(BOOL____00072);
constraint int_le_reif(counts____00002[1], counts____00002[2], BOOL____00069) :: defines_var(BOOL____00069);
constraint int_le_reif(counts____00002[1], counts____00002[3], BOOL____00071) :: defines_var(BOOL____00071);
constraint int_le_reif(counts____00002[2], counts____00002[1], BOOL____00076) :: defines_var(BOOL____00076);
constraint int_le_reif(counts____00002[2], counts____00002[3], BOOL____00078) :: defines_var(BOOL____00078);
constraint int_le_reif(counts____00002[3], counts____00002[1], BOOL____00082) :: defines_var(BOOL____00082);
constraint int_le_reif(counts____00002[3], counts____00002[2], BOOL____00083) :: defines_var(BOOL____00083);
constraint int_le_reif(intervals____00001[1], x[1], BOOL____00005) :: defines_var(BOOL____00005);
constraint int_le_reif(intervals____00001[1], x[2], BOOL____00009) :: defines_var(BOOL____00009);
constraint int_le_reif(intervals____00001[1], x[3], BOOL____00013) :: defines_var(BOOL____00013);
constraint int_le_reif(intervals____00001[1], x[4], BOOL____00017) :: defines_var(BOOL____00017);
constraint int_le_reif(intervals____00001[1], x[5], BOOL____00021) :: defines_var(BOOL____00021);
constraint int_le_reif(intervals____00001[3], x[1], BOOL____00025) :: defines_var(BOOL____00025);
constraint int_le_reif(intervals____00001[3], x[2], BOOL____00029) :: defines_var(BOOL____00029);
constraint int_le_reif(intervals____00001[3], x[3], BOOL____00033) :: defines_var(BOOL____00033);
constraint int_le_reif(intervals____00001[3], x[4], BOOL____00037) :: defines_var(BOOL____00037);
constraint int_le_reif(intervals____00001[3], x[5], BOOL____00041) :: defines_var(BOOL____00041);
constraint int_le_reif(intervals____00001[5], x[1], BOOL____00045) :: defines_var(BOOL____00045);
constraint int_le_reif(intervals____00001[5], x[2], BOOL____00049) :: defines_var(BOOL____00049);
constraint int_le_reif(intervals____00001[5], x[3], BOOL____00053) :: defines_var(BOOL____00053);
constraint int_le_reif(intervals____00001[5], x[4], BOOL____00057) :: defines_var(BOOL____00057);
constraint int_le_reif(intervals____00001[5], x[5], BOOL____00061) :: defines_var(BOOL____00061);
constraint int_le_reif(x[1], intervals____00001[2], BOOL____00006) :: defines_var(BOOL____00006);
constraint int_le_reif(x[1], intervals____00001[4], BOOL____00026) :: defines_var(BOOL____00026);
constraint int_le_reif(x[1], intervals____00001[6], BOOL____00046) :: defines_var(BOOL____00046);
constraint int_le_reif(x[2], intervals____00001[2], BOOL____00010) :: defines_var(BOOL____00010);
constraint int_le_reif(x[2], intervals____00001[4], BOOL____00030) :: defines_var(BOOL____00030);
constraint int_le_reif(x[2], intervals____00001[6], BOOL____00050) :: defines_var(BOOL____00050);
constraint int_le_reif(x[3], intervals____00001[2], BOOL____00014) :: defines_var(BOOL____00014);
constraint int_le_reif(x[3], intervals____00001[4], BOOL____00034) :: defines_var(BOOL____00034);
constraint int_le_reif(x[3], intervals____00001[6], BOOL____00054) :: defines_var(BOOL____00054);
constraint int_le_reif(x[4], intervals____00001[2], BOOL____00018) :: defines_var(BOOL____00018);
constraint int_le_reif(x[4], intervals____00001[4], BOOL____00038) :: defines_var(BOOL____00038);
constraint int_le_reif(x[4], intervals____00001[6], BOOL____00058) :: defines_var(BOOL____00058);
constraint int_le_reif(x[5], intervals____00001[2], BOOL____00022) :: defines_var(BOOL____00022);
constraint int_le_reif(x[5], intervals____00001[4], BOOL____00042) :: defines_var(BOOL____00042);
constraint int_le_reif(x[5], intervals____00001[6], BOOL____00062) :: defines_var(BOOL____00062);
constraint int_lin_eq([-1, -1, -1, -1, -1, 1], [INT____00008, INT____00012, INT____00016, INT____00020, INT____00024, counts____00002[1]], 0);
constraint int_lin_eq([-1, -1, -1, -1, -1, 1], [INT____00028, INT____00032, INT____00036, INT____00040, INT____00044, counts____00002[2]], 0);
constraint int_lin_eq([-1, -1, -1, -1, -1, 1], [INT____00048, INT____00052, INT____00056, INT____00060, INT____00064, counts____00002[3]], 0);
constraint int_max(counts____00002[1], counts____00002[1], INT____00065) :: defines_var(INT____00065);
constraint int_max(counts____00002[2], INT____00065, INT____00066) :: defines_var(INT____00066);
constraint int_max(counts____00002[3], INT____00066, c_max____00003);
constraint int_plus(bal, c_min____00004, c_max____00003);
solve satisfy;