forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
abbott.fzn
57 lines (57 loc) · 5.72 KB
/
abbott.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
var 0..64: INT____00001 :: is_defined_var :: var_is_introduced;
array [1..8] of var 0..4: a;
array [1..8] of var 0..4: b;
array [1..6] of var 0..4: c;
array [1..7] of var 0..4: d;
array [1..7] of var 0..4: e;
array [1..6] of var 0..4: f;
var 0..64: total_sum :: output_var = INT____00001;
array [1..64] of var 0..1: x :: output_array([1..8, 1..8]);
constraint int_eq(x[1], 1);
constraint int_eq(x[8], 1);
constraint int_eq(x[57], 1);
constraint int_eq(x[64], 1);
constraint int_lin_eq([-2, 1, 1], [c[1], x[2], x[9]], 0);
constraint int_lin_eq([-2, 1, 1], [d[7], x[56], x[63]], 0);
constraint int_lin_eq([-2, 1, 1], [e[7], x[7], x[16]], 0);
constraint int_lin_eq([-2, 1, 1], [f[6], x[49], x[58]], 0);
constraint int_lin_eq([-2, 1, 1, 1], [c[2], x[3], x[10], x[17]], 0);
constraint int_lin_eq([-2, 1, 1, 1], [d[6], x[48], x[55], x[62]], 0);
constraint int_lin_eq([-2, 1, 1, 1], [e[6], x[6], x[15], x[24]], 0);
constraint int_lin_eq([-2, 1, 1, 1], [f[5], x[41], x[50], x[59]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1], [c[3], x[4], x[11], x[18], x[25]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1], [d[5], x[40], x[47], x[54], x[61]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1], [e[5], x[5], x[14], x[23], x[32]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1], [f[4], x[33], x[42], x[51], x[60]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1], [c[4], x[5], x[12], x[19], x[26], x[33]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1], [d[4], x[32], x[39], x[46], x[53], x[60]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1], [e[4], x[4], x[13], x[22], x[31], x[40]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1], [f[3], x[25], x[34], x[43], x[52], x[61]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1], [c[5], x[6], x[13], x[20], x[27], x[34], x[41]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1], [d[3], x[24], x[31], x[38], x[45], x[52], x[59]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1], [e[3], x[3], x[12], x[21], x[30], x[39], x[48]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1], [f[2], x[17], x[26], x[35], x[44], x[53], x[62]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [c[6], x[7], x[14], x[21], x[28], x[35], x[42], x[49]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[2], x[16], x[23], x[30], x[37], x[44], x[51], x[58]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [e[2], x[2], x[11], x[20], x[29], x[38], x[47], x[56]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [f[1], x[9], x[18], x[27], x[36], x[45], x[54], x[63]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [a[1], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [a[2], x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [a[3], x[17], x[18], x[19], x[20], x[21], x[22], x[23], x[24]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [a[4], x[25], x[26], x[27], x[28], x[29], x[30], x[31], x[32]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [a[5], x[33], x[34], x[35], x[36], x[37], x[38], x[39], x[40]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [a[6], x[41], x[42], x[43], x[44], x[45], x[46], x[47], x[48]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [a[7], x[49], x[50], x[51], x[52], x[53], x[54], x[55], x[56]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [a[8], x[57], x[58], x[59], x[60], x[61], x[62], x[63], x[64]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [b[1], x[1], x[9], x[17], x[25], x[33], x[41], x[49], x[57]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [b[2], x[2], x[10], x[18], x[26], x[34], x[42], x[50], x[58]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [b[3], x[3], x[11], x[19], x[27], x[35], x[43], x[51], x[59]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [b[4], x[4], x[12], x[20], x[28], x[36], x[44], x[52], x[60]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [b[5], x[5], x[13], x[21], x[29], x[37], x[45], x[53], x[61]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [b[6], x[6], x[14], x[22], x[30], x[38], x[46], x[54], x[62]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [b[7], x[7], x[15], x[23], x[31], x[39], x[47], x[55], x[63]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [b[8], x[8], x[16], x[24], x[32], x[40], x[48], x[56], x[64]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [d[1], x[8], x[15], x[22], x[29], x[36], x[43], x[50], x[57]], 0);
constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1, 1], [e[1], x[1], x[10], x[19], x[28], x[37], x[46], x[55], x[64]], 0);
constraint int_lin_eq([-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [INT____00001, 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], x[27], x[28], x[29], x[30], x[31], x[32], x[33], x[34], x[35], x[36], x[37], x[38], x[39], x[40], x[41], x[42], x[43], x[44], x[45], x[46], x[47], x[48], x[49], x[50], x[51], x[52], x[53], x[54], x[55], x[56], x[57], x[58], x[59], x[60], x[61], x[62], x[63], x[64]], 0) :: defines_var(INT____00001);
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], x[27], x[28], x[29], x[30], x[31], x[32], x[33], x[34], x[35], x[36], x[37], x[38], x[39], x[40], x[41], x[42], x[43], x[44], x[45], x[46], x[47], x[48], x[49], x[50], x[51], x[52], x[53], x[54], x[55], x[56], x[57], x[58], x[59], x[60], x[61], x[62], x[63], x[64]], first_fail, indomain, complete) maximize INT____00001;