epgap=0

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

Hi,

You are using the same file statement twice.

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

Can you explain a little more?
What exactly should I do?
I did not understand yet

Thanks

Richard,

Just change your code to

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

I can’t thank you enough!