MarioVelez
unread,Oct 27, 2008, 11:06:47 AM10/27/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Xpress-MP
I need to solve many instances of an MIP model ..
If I load the problems one by one, I get one solution .. but if run
the a program that automatically reads, sovles and writes the output,
the solution is different (worse), although correct..
Any ideas why this is happening?
here's the code:
model Chung_et_al
uses "mmxprs"
setparam("XPRS_cputime", 0); setparam("XPRS_MAXTIME", 60)
declarations
n=10, Capacity=20; M=3
mu=0.0001; Q1=10*n
!Indexes
Jobs=1..n
Batches=1..n
Machines=1..M
!Coeficients
ProcessTime: array(1..n) of real
ReadyTime: array(1..n) of real
Size: array(1..n) of real
!Decision Variables
x: array(Jobs, Batches, Machines) of mpvar
y: array(Batches, Batches, Machines) of mpvar
z: array(Batches, Machines) of mpvar
t: array(Batches, Machines) of mpvar
Pt: array(Batches) of mpvar
Cmax: mpvar
!Data files
FileName: array(1..60) of string
end-declarations
initializations from 'C:\BPM2\10JFileNames.txt'
!A text file with the paths of the files to load
FileName
end-initializations
i:=1
repeat
CPUTime:=currenttime
!Load data
initializations from FileName(i)
[ProcessTime, ReadyTime, Size] as 'X'
end-initializations
Q2:=sum(j in Jobs) (ProcessTime(j)+ReadyTime(j)+Size(j))
!Constraints
forall (j in Jobs) sum(b in Batches, m in Machines) x(j,b,m)=1
forall (b in Batches) sum(m in Machines) z(b, m)<=1
forall (b in Batches, m in Machines) sum(j in Jobs) x(j, b,
m)<=Q1*z(b,m)
forall (b in Batches) sum(j in Jobs, m in Machines) Size(j)*x(j, b,
m)<=Capacity
forall (j in Jobs, b in Batches, m in Machines)
Pt(b)>=ProcessTime(j)*x(j, b, m)
forall (b in Batches, m in Machines) Cmax>=t(b, m)+Pt(b)
forall (j in Jobs, b in Batches, m in Machines) t(b,
m)>=ReadyTime(j)*x(j, b, m)
forall (b1 in Batches, b2 in Batches, m in Machines | b1<>b2) t(b1,m)
+Pt(b1)-t(b2,m)+Q2*(y(b1,b2,m)-1)<=0
forall (b1 in Batches, b2 in Batches, m in Machines | b1<>b2) y(b1,
b2, m)+y(b2, b1, m)-Q2*(z(b1, m)+z(b2, m)-2)>=1
forall (b1 in Batches, b2 in Batches, m in Machines | b1<>b2) y(b1,
b2, m)+y(b2, b1, m)+Q2*(z(b1, m)+z(b2, m)-2)<=1
forall (b1 in Batches, b2 in Batches, m in Machines | b1<>b2) y(b1,
b2, m)+y(b2, b1, m)-Q2*(z(b1, m)+z(b2, m))<=0
forall (b1 in Batches, b2 in Batches, m in Machines | b1<>b2) y(b1,
b2, m)+y(b2, b1, m)-Q2*(z(b2, m)-z(b1, m)+1)<=0
forall (b1 in Batches, b2 in Batches, m in Machines | b1<>b2) y(b1,
b2, m)+y(b2, b1, m)-Q2*(z(b1, m)-z(b2, m)+1)<=0
forall (j in Jobs, b in Batches, m in Machines) x(j, b, m) is_binary
forall (b1 in Batches, b2 in Batches, m in Machines | b1<>b2) y(b1,
b2, m) is_binary
forall (b in Batches, m in Machines) z(b, m) is_binary
!Objective function
Objective:= Cmax+mu*sum(b in Batches, m in Machines) z(b,m)
!Solve model
minimize(Objective)
BestBound:=getparam("XPRS_bestbound")
BestIntSln:=getparam("XPRS_mipobjval")
CPUTime:=(currenttime-CPUTime)
writeln (FileName(i), " ", BestIntSln, " ", BestBound, " ", CPUTime/
1000)
i+=1
until i>60
end-model