forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
3_jugs.fzn
69 lines (69 loc) · 6.7 KB
/
3_jugs.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
array [1..225] of int: d = [999, 1, 999, 999, 999, 999, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1, 999, 999, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1, 1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1, 999, 999, 999, 999, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1, 999, 999, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999];
var 0..21: INT____00001 :: is_defined_var :: var_is_introduced;
array [1..15] of var 0..1: inFlow :: output_array([1..15]);
array [1..15] of var 0..1: outFlow :: output_array([1..15]);
array [1..15] of var -1..1: rhs;
array [1..225] of var 0..1: x :: output_array([1..15, 1..15]);
var 0..21: z :: output_var = INT____00001;
constraint int_eq(inFlow[1], 0);
constraint int_eq(outFlow[15], 0);
constraint int_eq(rhs[1], 1);
constraint int_eq(rhs[2], 0);
constraint int_eq(rhs[3], 0);
constraint int_eq(rhs[4], 0);
constraint int_eq(rhs[5], 0);
constraint int_eq(rhs[6], 0);
constraint int_eq(rhs[7], 0);
constraint int_eq(rhs[8], 0);
constraint int_eq(rhs[9], 0);
constraint int_eq(rhs[10], 0);
constraint int_eq(rhs[11], 0);
constraint int_eq(rhs[12], 0);
constraint int_eq(rhs[13], 0);
constraint int_eq(rhs[14], 0);
constraint int_eq(rhs[15], -1);
constraint int_lin_eq([1, -1], [inFlow[3], x[18]], 0);
constraint int_lin_eq([1, -1], [inFlow[4], x[34]], 0);
constraint int_lin_eq([1, -1], [inFlow[5], x[50]], 0);
constraint int_lin_eq([1, -1], [inFlow[6], x[66]], 0);
constraint int_lin_eq([1, -1], [inFlow[7], x[82]], 0);
constraint int_lin_eq([1, -1], [inFlow[8], x[98]], 0);
constraint int_lin_eq([1, -1], [inFlow[10], x[130]], 0);
constraint int_lin_eq([1, -1], [inFlow[11], x[146]], 0);
constraint int_lin_eq([1, -1], [inFlow[12], x[162]], 0);
constraint int_lin_eq([1, -1], [inFlow[13], x[178]], 0);
constraint int_lin_eq([1, -1], [inFlow[14], x[194]], 0);
constraint int_lin_eq([1, -1], [outFlow[2], x[18]], 0);
constraint int_lin_eq([1, -1], [outFlow[4], x[50]], 0);
constraint int_lin_eq([1, -1], [outFlow[6], x[82]], 0);
constraint int_lin_eq([1, -1], [outFlow[8], x[120]], 0);
constraint int_lin_eq([1, -1], [outFlow[9], x[130]], 0);
constraint int_lin_eq([1, -1], [outFlow[11], x[162]], 0);
constraint int_lin_eq([1, -1], [outFlow[13], x[194]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[1], outFlow[1], rhs[1]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[2], outFlow[2], rhs[2]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[3], outFlow[3], rhs[3]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[4], outFlow[4], rhs[4]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[5], outFlow[5], rhs[5]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[6], outFlow[6], rhs[6]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[7], outFlow[7], rhs[7]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[8], outFlow[8], rhs[8]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[9], outFlow[9], rhs[9]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[10], outFlow[10], rhs[10]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[11], outFlow[11], rhs[11]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[12], outFlow[12], rhs[12]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[13], outFlow[13], rhs[13]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[14], outFlow[14], rhs[14]], 0);
constraint int_lin_eq([-1, 1, -1], [inFlow[15], outFlow[15], rhs[15]], 0);
constraint int_lin_eq([1, -1, -1], [inFlow[15], x[120], x[210]], 0);
constraint int_lin_eq([1, -1, -1], [outFlow[1], x[2], x[9]], 0);
constraint int_lin_eq([1, -1, -1], [outFlow[3], x[34], x[39]], 0);
constraint int_lin_eq([1, -1, -1], [outFlow[5], x[66], x[69]], 0);
constraint int_lin_eq([1, -1, -1], [outFlow[7], x[98], x[99]], 0);
constraint int_lin_eq([1, -1, -1], [outFlow[10], x[137], x[146]], 0);
constraint int_lin_eq([1, -1, -1], [outFlow[12], x[167], x[178]], 0);
constraint int_lin_eq([1, -1, -1], [outFlow[14], x[197], x[210]], 0);
constraint int_lin_eq([1, -1, -1, -1, -1], [inFlow[2], x[2], x[137], x[167], x[197]], 0);
constraint int_lin_eq([1, -1, -1, -1, -1], [inFlow[9], x[9], x[39], x[69], x[99]], 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], [INT____00001, x[2], x[9], x[18], x[34], x[39], x[50], x[66], x[69], x[82], x[98], x[99], x[120], x[130], x[137], x[146], x[162], x[167], x[178], x[194], x[197], x[210]], 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], x[65], x[66], x[67], x[68], x[69], x[70], x[71], x[72], x[73], x[74], x[75], x[76], x[77], x[78], x[79], x[80], x[81], x[82], x[83], x[84], x[85], x[86], x[87], x[88], x[89], x[90], x[91], x[92], x[93], x[94], x[95], x[96], x[97], x[98], x[99], x[100], x[101], x[102], x[103], x[104], x[105], x[106], x[107], x[108], x[109], x[110], x[111], x[112], x[113], x[114], x[115], x[116], x[117], x[118], x[119], x[120], x[121], x[122], x[123], x[124], x[125], x[126], x[127], x[128], x[129], x[130], x[131], x[132], x[133], x[134], x[135], x[136], x[137], x[138], x[139], x[140], x[141], x[142], x[143], x[144], x[145], x[146], x[147], x[148], x[149], x[150], x[151], x[152], x[153], x[154], x[155], x[156], x[157], x[158], x[159], x[160], x[161], x[162], x[163], x[164], x[165], x[166], x[167], x[168], x[169], x[170], x[171], x[172], x[173], x[174], x[175], x[176], x[177], x[178], x[179], x[180], x[181], x[182], x[183], x[184], x[185], x[186], x[187], x[188], x[189], x[190], x[191], x[192], x[193], x[194], x[195], x[196], x[197], x[198], x[199], x[200], x[201], x[202], x[203], x[204], x[205], x[206], x[207], x[208], x[209], x[210], x[211], x[212], x[213], x[214], x[215], x[216], x[217], x[218], x[219], x[220], x[221], x[222], x[223], x[224], x[225]], first_fail, indomain_min, complete) minimize INT____00001;