Hi everyone, right now I am building a code for scheduling using a case of 4 jobs in 10 machines during 4 months, at the begining I had a code much more dummy but it worked, so I’ve been trying to modify it so I can use it in every problem but for some reason gams doesn’t solve it, at the begining it just put the first or last job but I know for another program that it isnt correct, so ive been trying to solve it for different ways and at the end of the day it doesnt make any sequence, even when I comeback to an earlier version that was able to make a sequence of the code it still without sequencing, the original program which I am trying to adapt is this:
$onText
j m1 m2 m3
1 8 14 7
2 10 6 10
3 9 8 16
4 11 14 12
xij / i= maquina ^ j=trabajo
$offtext
Variables
x11, x12, x13, x14, x21, x22, x23, x24,x31, x32, x33, x34, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, cmax;
Positive Variables x11, x12, x13, x14, x21, x22, x23, x24, x31, x32, x33, x34;
Binary Variables y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18;
EQUATIONS
funobj, a11, a12, a13, a23, a24, a34, b11, b12, b13, b23, b24, b34,c11, c12, c13, c23, c24, c34, d11, d12, d13, d23, d24, d34,
e11, e12, e13, e23, e24, e34, f11, f12, f13, f23, f24, f34, c1, c2, c3, c4, z, eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8;
funobj.. cmax =e= cmax;
*restricciones de secuencia de trabajos
eq1.. x21 =g= x11+8;
eq2.. x22 =g= x12+10;
eq3.. x23 =g= x13+9;
eq4.. x24 =g= x14+11;
eq5.. x31 =g= x21+14;
eq6.. x32 =g= x22+6;
eq7.. x33 =g= x23+8;
eq8.. x34 =g= x24+14;
*restriccion que evita que dos trabajos entren a la misma maquina al mismo tiempo
a11.. x11+8 =l= x12+1000*y1;
b11.. x12+10 =l= x11+1000*(1-y1);
a12.. x11+8 =l= x13+1000*y2;
b12.. x13+9 =l= x11+1000*(1-y2);
a13.. x11+8 =l= x14+1000*y3;
b13.. x14 + 11 =l= x11 + 1000 * (1 - y3);
a23.. x12+10 =l= x13+1000*y4;
b23.. x13+9 =l= x12+1000*(1-y4);
a24.. x12+10 =l= x14+1000*y5;
b24.. x14+11 =l= x12+1000*(1-y5);
a34.. x13+9 =l= x14+1000*(y6);
b34.. x14+11 =l= x13+1000*(1-y6);
c11.. x21+14 =l= x22+1000*y7;
d11.. x22+6 =l= x21+1000*(1-y7);
c12.. x21+14 =l= x23+1000*(y8);
d12.. x23+8 =l= x21+1000*(1-y8);
c13.. x21+14 =l= x24+1000*y9;
d13.. x24+14 =l= x21+1000*(1-y9);
c23.. x22+6 =l= x23+1000*(y10);
d23.. x23+8 =l= x22+1000*(1-y10);
c24.. x22+6 =l= x24+1000*(y11);
d24.. x24+14 =l= x22+1000*(1-y11);
c34.. x23+8 =l= x24+1000*(y12);
d34.. x24+14 =l= x23+1000*(1-y12);
e11.. x31+7 =l= x32+1000*y13;
f11.. x32+10 =l= x31+1000*(1-y13);
e12.. x31+7 =l= x33+1000*y14;
f12.. x33+16 =l= x31+1000*(1-y14);
e13.. x31+7 =l= x34+1000*y15;
f13.. x34+12 =l= x31+1000*(1-y15);
e23.. x32+10 =l= x33+1000*y16;
f23.. x33+16 =l= x32+1000*(1-y16);
e24.. x32+10 =l= x34+1000*y17;
f24.. x34+12 =l= x32+1000*(1-y17);
e34.. x33+16 =l= x34+1000*y18;
f34.. x34+12 =l= x33+1000*(1-y18);
*restricciones para limitar hacia el cmax
c1.. x31+7 =l= cmax;
c2.. x32+10 =l= cmax;
c3.. x33+16 =l= cmax;
c4.. x34+12 =l= cmax;
z.. cmax =g= 0;
And this is the final program which isnt working
Sets
m máquinas /110/
j trabajos /14/;
alias(j,j1,j2)
Set pares(j1,j2) /
(1.2), (1.3), (1.4)
(2.3), (2.4)
(3.4)
/;
$onText(5.6), (5.7), (5.8)
(6.7), (6.8),
(7.8),
(9.10), (9.11), (9.12)
(10.11), (10.12)
(11.12),
(13.14), (13.15), (13.16)
(14.15), (14.16)
(15.16)
$offText
Parameter p(m,j) tiempos de procesamiento /
1.1 302, 1.2 167, 1.3 152, 1.4 287,
2.1 362, 2.2 200, 2.3 182, 2.4 344,
3.1 241, 3.2 133, 3.3 121, 3.4 229,
4.1 201, 4.2 111, 4.3 101, 4.4 191,
5.1 1100, 5.2 605, 5.3 550, 5.4 1045,
6.1 201, 6.2 111, 6.3 101, 6.4 191,
7.1 1000, 7.2 550, 7.3 500, 7.4 950,
8.1 441, 8.2 243, 8.3 221, 8.4 419,
9.1 303, 9.2 168, 9.3 153, 9.4 288,
10.1 662, 10.2 365, 10.3 332, 10.4 629
/
$onText
1.5 257, 1.6 257, 1.7 257, 1.8 242, 1.9 302, 1.10 257, 1.11 302, 1.12 227, 1.13 272, 1.14 302, 1.15 257, 1.16 302,
2.5 308, 2.6 308, 2.7 308, 2.8 290, 2.9 362, 2.10 308, 2.11 362, 2.12 272, 2.13 326, 2.14 362, 2.15 308, 2.16 362,
3.5 205, 3.6 205, 3.7 205, 3.8 193, 3.9 241, 3.10 205, 3.11 241, 3.12 181, 3.13 217, 3.14 241, 3.15 205, 3.16 241,
4.5 171, 4.6 171, 4.7 171, 4.8 161, 4.9 201, 4.10 171, 4.11 201, 4.12 151, 4.13 181, 4.14 201, 4.15 171, 4.16 201,
5.5 935, 5.6 935, 5.7 935, 5.8 880, 5.9 1100, 5.10 935, 5.11 1100, 5.12 825, 5.13 990, 5.14 1100, 5.15 935, 5.16 1100,
6.5 171, 6.6 171, 6.7 171, 6.8 161, 6.9 201, 6.10 171, 6.11 201, 6.12 151, 6.13 181, 6.14 201, 6.15 171, 6.16 201,
7.5 850, 7.6 850, 7.7 850, 7.8 800, 7.9 1000, 7.10 850, 7.11 1000, 7.12 750, 7.13 900, 7.14 1000, 7.15 850, 7.16 1000,
8.5 375, 8.6 375, 8.7 375, 8.8 353, 8.9 441, 8.10 375, 8.11 441, 8.12 331, 8.13 397, 8.14 441, 8.15 375, 8.16 441,
9.5 258, 9.6 258, 9.7 258, 9.8 243, 9.9 303, 9.10 258, 9.11 303, 9.12 228, 9.13 273, 9.14 303, 9.15 258, 9.16 303,
10.5 563, 10.6 563, 10.7 563, 10.8 530, 10.9 662, 10.10 563, 10.11 662, 10.12 497, 10.13 596, 10.14 662, 10.15 563, 10.16 662
$offText
dd(j) due date / 1*4 7200 /
$onText 58 14400, 912 21600, 13*16 28800
$offText
;
Variables
x(m,j) tiempo de inicio del trabajo j en la máquina i
y(m,j1,j2) variable binaria para secuenciación (para cada par de trabajos)
cmax tiempo total de finalización
obj
T(j);
scalar
w1 peso cmax /1/
w2 peso tardanza izquierda (entregar antes) /0/;
Positive Variable x;
Binary Variable y;
Equations
Secuencia(m,j) Restricciones de flujo del trabajo
noOverlap(m,j1,j2) Restricciones de no solapamiento
noOverlap1(m,j2,j1) Precedencia entre trabajos
MakespanLim(j) Límite del makespan
Objetivo
Tardanza(j) Tardanza izquierda
;
$onText
secMes1(j)
secMes2(j)
secMes3(j)
$offtext
-
Restricción de secuencia entre máquinas consecutivas
Secuencia(m,j)$(ord(m)<card(m))..
x(m+1,j) =g= x(m,j) + p(m,j); -
Restricciones de no solapamiento
noOverlap(m,j1,j2)$(pares(j1,j2))..
x(m,j1) + p(m,j1) =l= x(m,j2) + 10000000000*(1 - y(m,j1,j2));
noOverlap1(m,j2,j1)$(pares(j1,j2))..
x(m,j2) + p(m,j2) =l= x(m,j1) + 10000000000*y(m,j1,j2);
- Makespan (tiempo máximo de finalización en última máquina)
MakespanLim(j)..
cmax =g= x(‘10’,j) + p(‘10’,j);
Tardanza(j)..
T(j) =e= dd(j) - x(‘10’,j) + p(‘10’,j);
Objetivo..
obj =e= w1*cmax + sum(j,T(j))*w2;
onText
secMes1(j)(ord(j) <= 8 and ord(j) >= 5)..
x(‘1’,j) =g= 7200;
secMes2(j)$(ord(j) <= 12 and ord(j) >= 9)..
x(‘1’,j) =g= 7200*2;
secMes3(j)$(ord(j) <= 16 and ord(j) >= 13)..
x(‘1’,j) =g= 7200*3;
$offText