### Why does GAMS change binary variables to positive ones in a loop?

Posted:

**Thu Apr 26, 2018 4:41 pm**Dear friends,

I have coded a scheduling problem in GAMS using the Sample Average Approximation. This model is a MILP mathematical model. I have chosen Cplex as the solver for this problem. The code solves a problem in a loop for multiple times, and it fixes binary variables, i.e., xa, and xaa, in each iteration. Finally, it will free their upper and lower bounds. For more clarification, I have provided a summary of this model in the following:

loop(rr,

****************** First sample for SAA

Solve Finall using MIP min f;

****************** Second sample for SAA

xa.fx(i,j,k,r,t)=x.l(i,j,k,r,t);

Solve Finalls using MIP min fa;

****************** Solving Simple Model

loop(scenarios,

xaa.fx(i,j,k,r,t)=x.l(i,j,k,r,t);

Solve Finallss using MIP min fss;

xaa.lo(i,j,k,r,t)=0;

xaa.up(i,j,k,r,t)=1;

);

xa.lo(i,j,k,r,t)=0;

xa.up(i,j,k,r,t)=1;

);

My problem is that as the model runs the problem, it changes the first set of binary variables, i.e., x, to positive variables.

Could you please help me out. I have to thank you for the privilege of your time in advance.

I have coded a scheduling problem in GAMS using the Sample Average Approximation. This model is a MILP mathematical model. I have chosen Cplex as the solver for this problem. The code solves a problem in a loop for multiple times, and it fixes binary variables, i.e., xa, and xaa, in each iteration. Finally, it will free their upper and lower bounds. For more clarification, I have provided a summary of this model in the following:

loop(rr,

****************** First sample for SAA

Solve Finall using MIP min f;

****************** Second sample for SAA

xa.fx(i,j,k,r,t)=x.l(i,j,k,r,t);

Solve Finalls using MIP min fa;

****************** Solving Simple Model

loop(scenarios,

xaa.fx(i,j,k,r,t)=x.l(i,j,k,r,t);

Solve Finallss using MIP min fss;

xaa.lo(i,j,k,r,t)=0;

xaa.up(i,j,k,r,t)=1;

);

xa.lo(i,j,k,r,t)=0;

xa.up(i,j,k,r,t)=1;

);

My problem is that as the model runs the problem, it changes the first set of binary variables, i.e., x, to positive variables.

Could you please help me out. I have to thank you for the privilege of your time in advance.