Page 1 of 1

epgap=0

Posted: Thu Aug 30, 2018 7:15 am
by richard
Hi

i have a three "MIP" model , i want to solve these model in one GAMS file ,i write equation for every model first, when i write


model my_model1/obj1,c1,c2/;
my_model1.Optfile =1;
file opts cplex option file/ cplex.opt /;
putclose opts /'epgap=0' /'epagap=0';
solve my_model1 using mip minimizing z;
and


model my_model2/obj2,c3,c4/;;
my_model2.Optfile =1;
file opts cplex option file/ cplex.opt /;
putclose opts /'epgap=0' /'epagap=0';
solve my_model2 using mip minimizing z1;

i have this errror "symbol redefined -a second data statement for the same symbol or data statement after an assignment ,

how can fix this problem ?

thanks

Re: epgap=0

Posted: Thu Aug 30, 2018 8:34 am
by Fred
Hi,

You are using the same file statement twice.

Code: Select all

file opts cplex option file/ cplex.opt /;
[...]
file opts cplex option file/ cplex.opt /;
You cannot use the same internal file name ("opts") more than once. Just get rid of the second one and you should be good.

I hope this helps!

Fred

Re: epgap=0

Posted: Thu Aug 30, 2018 10:39 am
by richard
Can you explain a little more?
What exactly should I do?
I did not understand yet

Thanks

Re: epgap=0

Posted: Thu Aug 30, 2018 1:28 pm
by Fred
Richard,

Just change your code to

Code: Select all

model my_model1/obj1,c1,c2/;
my_model1.Optfile =1;
file opts cplex option file/ cplex.opt /;
putclose opts /'epgap=0' /'epagap=0';
solve my_model1 using mip minimizing z;
[...]
model my_model2/obj2,c3,c4/;;
my_model2.Optfile =1;
putclose opts /'epgap=0' /'epagap=0';
solve my_model2 using mip minimizing z1; 
I hope this helps!

Fred

Re: epgap=0

Posted: Thu Aug 30, 2018 3:21 pm
by richard
I can’t thank you enough!