Issues regarding sequentially solving several problems ..

42 views
Skip to first unread message

MarioVelez

unread,
Oct 27, 2008, 11:06:47 AM10/27/08
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

Christian Bermúdez

unread,
Oct 27, 2008, 3:49:56 PM10/27/08
to xpre...@googlegroups.com

¿Trataste con getsol(Objective)?

Lo más probable es que el optimizador esté cargando los problemas nuevos junto con los anteriores (o sea que esté agregando restricciones en vez de crear problemas nuevos en cada iteración). Busca el ejemplo del capítulo 16.2.2 del archivo pdf  "Xpress-MP Getting Started" (lo consigues en la página de dashoptmization) para saber como cargar un problema a la vez.

2008/10/27 MarioVelez <marv...@eafit.edu.co>

MarioVelez

unread,
Nov 14, 2008, 9:18:24 PM11/14/08
to Xpress-MP
Gracias Christian...

Efectivamente el problema es que tu dices.
Finalmente descubrí el problema: Es necesario darle nombre a las
restricciones. Si no se hace, Mosel las agrega a las restricciones del
problema anterior.

Te agradezco la respuesta.

saludos

Mario




On 27 oct, 14:49, "Christian Bermúdez" <as.corazon.no...@gmail.com>
wrote:
> ¿Trataste con getsol(Objective)?
>
> Lo más probable es que el optimizador esté cargando los problemas nuevos
> junto con los anteriores (o sea que esté agregando restricciones en vez de
> crear problemas nuevos en cada iteración). Busca el ejemplo del capítulo
> 16.2.2 del archivo pdf  "Xpress-MP Getting Started" (lo consigues en la
> página de dashoptmization) para saber como cargar un problema a la vez.
>
> 2008/10/27 MarioVelez <marve...@eafit.edu.co>
Reply all
Reply to author
Forward
0 new messages