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:
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:
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:
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