Infeasibilities in loop solve using CPLEX

Problems with syntax of GAMS
Post Reply
petros.p
User
User
Posts: 10
Joined: 4 years ago

Infeasibilities in loop solve using CPLEX

Post by petros.p »

Hi everyone,

I am trying to do an iterative solution process using the loop statement for a MILP. In each loop I solve my model for a subset of 24 hours and a subset of 15 days, which I declare this way:

Code: Select all

sets     run Solve iterations /run1*run5/
          t Time set        /t1*t2437/
          d Days set            /d1*d100/
          hour(t) Dynamic subset of time 
          day(d) Dynamic subset of days 
          i Warehouse /w1*w10/
I loop over the set run and before each solve statement I define the dynamic subsets that I want as YES by the following statement:

Code: Select all

loop(t,
hour(t) = no;
hour(t) = yes$(ord(t) ge (ord(run)*24-23) and ord(t) le (24*ord(run)));
                 );
And similarly for subset day, but it has an increment of 1. When I try to solve my model I run into infeasibility in the second iteration, so I guessed that for some reason it uses the solution of the previous iteration as a starting point of the next (is this true?). The infeasibility seems to be from the following equation:

Code: Select all

Infeasibility row 'eq6(w4)': 0 = 1 
eq6(i)..   sum(t$hour(t), mp(t,i)) + sum(d$day(d),mpk(d,i)) =e= m(i);
Where mp(t,i) and mpk(d,i) are binary variables and m(i) is a binary parameter. From what I understand, because the subset time of the first iteration had different elements, it set the variables that were outside the subset to zero and created the infeasibility in the second iteration. So, I tried to make starting points automatically, depending on the solution of the previous iteration, seting the level of variable mp.L('t25','w4') equal to 1 to give an initial feasible solution. Unfortunately it still results to an infeasible solution, reporting the exact same infeasibility (which doesn't make sense to me). On the other hand, if I do each iteration manually (changing the subset elements, a few parameter values and pressing the run button) I get optimal integer solution every time. Can anyone tell me what I am doing wrong? Is there any way to make every iteration independent from each other? (options clear = var.L in each iteration still results in infeasibility). Is there a way for CPLEX to automatically find an initial feasible solution in every iteration?

Sorry for the long post and thanks in advance for your answers.

Best,
Petros
petros.p
User
User
Posts: 10
Joined: 4 years ago

Re: Infeasibilities in loop solve using CPLEX

Post by petros.p »

The answer to my problem:

In order for the solver to use initial solution, a solver options file must be created to set mipstart to 1.
Fred
Posts: 373
Joined: 7 years ago

Re: Infeasibilities in loop solve using CPLEX

Post by Fred »

Hi Petros,

Happy to read that you solved your problem.

However, to avoid confusion, I would like to mention that that the mipstart option has little to do with your initial problem.
You wrote that Cplex returns infeasible for your model. Instructing Cplex to use a starting point (which is what you do by setting mipstart=1) does not make an infeasible model feasible. So I guess, you must have made some other changes.

Best,
Fred
petros.p
User
User
Posts: 10
Joined: 4 years ago

Re: Infeasibilities in loop solve using CPLEX

Post by petros.p »

Fred wrote: 4 years ago Hi Petros,

Happy to read that you solved your problem.

However, to avoid confusion, I would like to mention that that the mipstart option has little to do with your initial problem.
You wrote that Cplex returns infeasible for your model. Instructing Cplex to use a starting point (which is what you do by setting mipstart=1) does not make an infeasible model feasible. So I guess, you must have made some other changes.

Best,
Fred
Hi Fred,

I know that mipstart does not search for, or "generate", an initial feasible solution, if that's what you mean. My main problem was that although i provided an initial feasible solution at each loop, I still had the same infeasibilities. Only later I discovered that I had to manually set mipstart = 1, for the solver to read my initial solution. Thanks for your interest though :)

Best,
Petros
Post Reply