Code: Select all

```
Sets
i 'designs' /1*37/
j 'operations for each design' /1*96/
k 'machines' /1*3/
;
Scalar
M 'a large positive number' /100000/
;
Table
P(i,k) 'standard time to design i'
1 2 3
1 18.2 18.2 6.1
2 13.2 13.2 4.4
3 13.1 13.1 4.4
4 19.0 19.0 6.3
5 10.0 10.0 3.3
6 13.1 13.1 4.4
7 9.0 9.0 3.0
8 5.0 5.0 1.7
9 12.3 12.3 4.1
10 10.4 10.4 3.5
11 10.0 10.0 3.3
12 18.2 18.2 6.1
13 15.6 15.6 5.2
14 15.6 15.6 5.2
15 13.0 13.0 4.3
16 17.0 17.0 5.7
17 13.8 13.8 4.6
18 12.7 12.7 4.2
19 9.0 9.0 3.0
20 12.3 12.3 4.1
21 12.8 12.8 4.3
22 12.8 12.8 4.3
23 6.5 6.5 2.2
24 2.5 2.5 0.8
25 11.9 11.9 4.0
26 13.1 13.1 4.4
27 14.0 14.0 4.7
28 15.8 15.8 5.3
29 12.5 12.5 4.2
30 4.0 4.0 1.3
31 6.8 6.8 2.3
32 2.6 2.6 0.9
33 6.0 6.0 2.0
34 3.0 3.0 1.0
35 18.9 18.9 6.3
36 5.0 5.0 1.7
37 10.4 10.4 3.5
;
Binary Variable
X(i,j,k) '1 if jth is processed on machine k, 0 else'
;
Variables
Z 'Objective'
;
Positive Variables
Cmax
Tm(k) 'start of working time for machine k'
t(i,j) 'starting time of j'
;
Equations
E1 'each operation belonged to a design should be assigned to only one available machine'
E2 'defining the operations on machine sets'
E3 'the precedence relationships should be between the operation starting times'
E4 'an operation can be assigned to one position of a machine when the machine is idle'
E5 'an operation can be assigned to one position of a machine when the machine is idle'
E6 'determining the makespan of operations by considering last completed time for all operations'
Objective 'minimizing makespan'
;
Objective.. Z =e= Cmax;
E1(i,j).. sum(k, X(i,j,k)) =e= 1;
E2(k).. sum(i, sum(j, X(i,j,k))) =l= 1;
E3(i,j).. t(i,j+1) =g= t(i,j) + sum(k, X(i,j,k) * P(i,k));
E4(i,j,k).. Tm(k) =g= t(i,j) + M * (1- X(i,j,k));
E5(i,j,k).. Tm(k) =l= t(i,j) - M * (1- X(i,j,k));
E6(i,j).. Cmax =g= t(i,j) + sum(k, X(i,j,k)* P(i,k));
Model detop / all /;
solve detop using mip minimizing Z;
display X.m, Z.m, X.l, Z.l;
```