help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] syntax problem ?


From: Matthieu Bollot
Subject: [Help-glpk] syntax problem ?
Date: Sat, 26 Jan 2008 02:20:49 +0100

Hi,
I've spent some time finding my error but I don't see what's wrong.

I've got jobs (i) containing tasks (j), one by machine (k) at a time (a)
in a table of binary : var x[i,j,k,a]
What I want to do is task j+1 must start after task j.

this seems to work but uses a lot of memory :
subject to cont4{i in 1..n,j in 1..(OFi[i]-1), k in 1..m, a in
1..BS-1} :
(x[i,j,k,a] - x[i,j,k,a+1]) * p[i,j] + sum{kk in 1..m, aa in 1..a} x[i,j
+1,kk,aa] <= sum{c in 1..m, l in 1..a}x[i,j,c,l];

My last try is :
subject to cont4{i in 1..n, j in 2..OFi[i],k in 1..m, a in 1..BS-1} :
(x[i,j-1,k,a]-x[i,j-1,k,a+1])*a<=sum{kk in 1..m, aa in
1..BS-1}((x[i,j,kk,aa+1] - x[i,j,kk,aa])*(aa+1));

time when first stop is less than time when second start. Obviously sum
isn't what I want, but I haven't found anything else more relevant. And
the result here is not what it should.
x is binary so I tried x[i,j,kk,aa+1] && ! x[i,j,kk,aa] but it isn't
correct (syntax)

below, there is my foul model. I hope that it is obvious for someone who
knows glpsol.

Cheers,
Matthieu Bollot.


#=========Data========
param n; #number of jobs
param OFi{i in 1..n}; #nunber of task by job
param m; #nunber of machine
param p{i in 1..n,j in 1..OFi[i],k in 1..m}; #duration of task j
param d{i in 1..n}; #deadline
param BS; #upper borne
param trmax;
param I; #number of isles
param mk{k in 1..I};   #nbre de machines by isle
param mi{l in 1..I,k in 1..m} binary; #1 if machine m is in isle k 
param tr{k1 in 1..m,k2 in 1..m}; #1 time going from a machine to another


#=========Variables======
var r{i in 1..n}>=0;
var x{i in 1..n,j in 1..OFi[i],k in 1..m, l in 1..BS} binary; # =1 if ij
is running on k at time l
var lmax;
var wmax;
var z{i in 1..n, j in 1..OFi[i],k in 1..m} binary;

#=========Contraintes====

minimize optimum1 : lmax;
minimize optimum2 : wmax;

subject to deflmax{i in 1..n} : lmax >= r[i];
subject to defretard{i in 1..n, j in 1..OFi[i], k in 1..m, l in 1..BS} :
r[i]>=((l*x[i,j,k,l]+1)-d[i]);

subject to defwmax {l in 1..I} : wmax>=1/mk[l]*sum{i in 1..n, j in
1..OFi[i], k in 1..m, t in 1..BS}(x[i,j,k,t]*mi[l,k]);

#(3) one work on a machine at a time
subject to cont3{k in 1..m,l in 1..BS} : sum{i in 1..n,j in
1..OFi[i]}x[i,j,k,l] <= 1;

#(4) j is before j+1
subject to cont4{i in 1..n, j in 2..OFi[i],k in 1..m, a in 1..BS-1} :
(x[i,j-1,k,a]-x[i,j-1,k,a+1])*a<=sum{kk in 1..m, aa in
1..BS-1}((x[i,j,kk,aa+1] - x[i,j,kk,aa])*(aa+1));

#(5) a task is done in pij unit

subject to cont5{i in 1..n, j in 1..OFi[i], k in 1..m} : sum{l in
1..BS}x[i,j,k,l] = p[i,j,k]*z[i,j,k];
subject to cont51{i in 1..n, j in 1..OFi[i]} : sum{k in 1..m, l in
1..BS}x[i,j,k,l] >=1 ;

#(6) non splitting
subject to cont6{i in 1..n, j in 1..OFi[i], l in 1..BS} : sum{k in
1..m}x[i,j,k,l]<=1;

#(7) a task is done in one block
subject to cont7{i in 1..n,j in 1..OFi[i], k in 1..m,l in 1..(BS-2)} :
p[i,j,k]*(x[i,j,k,l]-x[i,j,k,l+1])+sum{b in (l+2)..BS}x[i,j,k,b] <=
p[i,j,k];

end;






reply via email to

[Prev in Thread] Current Thread [Next in Thread]