-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
2DPacking.fzn
44 lines (44 loc) · 2.66 KB
/
2DPacking.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
array [1..4] of int: ItemHeight = [4, 4, 4, 3];
array [1..4] of int: ItemWidth = [1, 1, 2, 3];
var 0..2: INT____00001 :: is_defined_var :: var_is_introduced;
array [1..2] of var 0..1: bin;
array [1..8] of var 0..1: item :: output_array([1..2, 1..4]);
var 0..2: obj :: output_var = INT____00001;
array [1..16] of var 0..1: x____00002;
array [1..16] of var 0..1: x____00003;
constraint int_eq(x____00002[5], 0);
constraint int_eq(x____00002[9], 0);
constraint int_eq(x____00002[10], 0);
constraint int_eq(x____00002[13], 0);
constraint int_eq(x____00002[14], 0);
constraint int_eq(x____00002[15], 0);
constraint int_eq(x____00003[5], 0);
constraint int_eq(x____00003[9], 0);
constraint int_eq(x____00003[10], 0);
constraint int_eq(x____00003[13], 0);
constraint int_eq(x____00003[14], 0);
constraint int_eq(x____00003[15], 0);
constraint int_lin_eq([1, -1], [item[1], x____00002[1]], 0);
constraint int_lin_eq([1, -1], [item[5], x____00003[1]], 0);
constraint int_lin_eq([1, 1], [item[1], item[5]], 1);
constraint int_lin_eq([1, 1], [item[2], item[6]], 1);
constraint int_lin_eq([1, 1], [item[3], item[7]], 1);
constraint int_lin_eq([1, 1], [item[4], item[8]], 1);
constraint int_lin_eq([1, -1, -1], [item[1], x____00002[2], x____00002[6]], 0);
constraint int_lin_eq([1, -1, -1], [item[5], x____00003[2], x____00003[6]], 0);
constraint int_lin_eq([1, -1, -1, -1], [item[1], x____00002[3], x____00002[7], x____00002[11]], 0);
constraint int_lin_eq([1, -1, -1, -1], [item[5], x____00003[3], x____00003[7], x____00003[11]], 0);
constraint int_lin_eq([1, -1, -1, -1, -1], [item[1], x____00002[4], x____00002[8], x____00002[12], x____00002[16]], 0);
constraint int_lin_eq([1, -1, -1, -1, -1], [item[5], x____00003[4], x____00003[8], x____00003[12], x____00003[16]], 0);
constraint int_lin_le([-2], [x____00002[16]], 0);
constraint int_lin_le([-2], [x____00003[16]], 0);
constraint int_lin_le([-3, 3], [x____00002[11], x____00002[12]], 0);
constraint int_lin_le([-3, 3], [x____00003[11], x____00003[12]], 0);
constraint int_lin_le([-4, 2, 3], [x____00002[6], x____00002[7], x____00002[8]], 0);
constraint int_lin_le([-4, 2, 3], [x____00003[6], x____00003[7], x____00003[8]], 0);
constraint int_lin_le([-4, 1, 2, 3], [x____00002[1], x____00002[2], x____00002[3], x____00002[4]], 0);
constraint int_lin_le([-4, 1, 2, 3], [x____00003[1], x____00003[2], x____00003[3], x____00003[4]], 0);
constraint int_lin_le([-10, 4, 4, 4, 3], [bin[1], x____00002[1], x____00002[6], x____00002[11], x____00002[16]], 0);
constraint int_lin_le([-10, 4, 4, 4, 3], [bin[2], x____00003[1], x____00003[6], x____00003[11], x____00003[16]], 0);
constraint int_plus(bin[1], bin[2], INT____00001) :: defines_var(INT____00001);
solve minimize INT____00001;