Thank you for your prompt reply!
Here is my code, i’ve attached also a screenshot of the whole model:
set i 'inbound trucks ’ / 1*10 /;
Alias (i,j);
Set
i0 ‘i=0 in res2’ / 0 /
n1 ‘n+1 inbound for res3’ / 111 /
o ‘outbound’ / 15 /
g ‘inbound doors available for processing inbound’ / 1*2 /
;
Parameter
p(i) ‘processing time for unloading inbound truck i’
d(o) ‘departure time of outbound truck o’
t(g,o) ‘transshipment time from inbound dock g to the dock where outbound truck o is processed’
w(i,o) ‘weight, e.g., the number of products, of a shipment delivered by inbound truck i dedicated to outbound truck o’
sum_i ‘# of i’
sum_g ‘# of g’;
sum_i = card (i);
sum_g = card (g);
p(i) = normal(30,6);
d(o) = (sum(i,p(i))/sum_g)*uniform(0.5,0.9);
w(i,o) = uniform (1,10);
t(g,o) = uniform (1,10);
Variable
Z ‘ZFW’;
Positive Variable
C(i) ‘completion time of inbound i’;
Binary Variable
x1(j,i,g) ‘res1’
x2(i0,j,g) ‘binary variable: 1, if inbound i is processed first at gate g; 0, otherwise’
x3(i,j,g) ‘res3’
y(i,o) ‘ZF’;
Scalar BIGM;
BIGM = sum(i, p(i))+ smax((g,o),t(g,o));
Equation
ZF ‘ZF’
res1 (i,g) ‘every truck is scheduled’
res2 (g) ‘one truck per gate’
res3 (i,g) ‘’
res4 (i,j,g) ‘’
res5 (i,o) ‘’
;
ZF … Z =e= sum((i,o), w(i,o)*y(i,o));
res1(i,g) … sum(j$(ord(j) ne ord(i)) ,x1(j,i,g)) =e= 1 ;
res2(g) … sum((j,i0),x2(i0,j,g)) =l= 1 ;
res3(i,g) … sum(j$(ord(j) ne ord(i)), x3(i,j,g)) =e= sum(j$(ord(j) ne ord(i)),x1(j,i,g)) ;
res4(i,j,g) … C(i) =g= C(j) +p(i) - BIGM * (1-x1(j,i,g)) ;
res5(i,o) … y(i,o) * BIGM =g= C(i)-d(o)+sum(g,t(g,o))*sum((j$(ord(j) ne ord(i))),x1(j,i,g)) ;
Greetings
Lukas