0
votes

I have the following problem: My CPLEX model runs into an out-of-memory-error (1001). This is to be expected, but I would like to retain the last solution (incumbent and gap, as well as all variable values). 

try {
    if (cplex.solve()) {
         //feasible and ran without memory issues
    } else {
         //infeasible
     }
} catch (IloException e) {
     e.printStackTrace();
     //memory issues end up in here
}​

The problem is that I "end up" in the catch part, where I can no longer retain any variable values, objective function values etc.  Is there a work-around to help me get the last found solution? THANK YOU!

1

1 Answers

2
votes

instead of

cplex.solve() 

in the try you could do a loop with

cplex.setParam(IloCplex.Param.MIP.Limits.Solutions, 1);
cplex.solve();

and then you ll get solutions one by one. If you crash in the last one, you ll be able to have the previous one.