Originally posted by: Michael_D
The following strange behaviour occurs when solving an MIP with Concert C++ with presolve turned on, using a branch callback:
After extracting a model into a cplex object via
IloCplex cplex(model);
, and before calling
cplex.solve()
, the model is exported to a .lp file via
cplex.exportModel(
"aaa.lp");
.
In the
main()
function of the branch callback, when the callback is called for the first time, the model is again exported (to a different file, say, bbb.lp).
The two files are very much different. Most importantly, in the bbb.lp file, several variables that are supposed to have zero coefficients in the objective function do appear there with nonzero coefficients. These variables rightly do not appear in the objective function of aaa.lp, and also not when the objective function is output to the console before calling
solve()
.
Solving bbb.lp with the interactive optimizer nevertheless yields the correct optimal solution (at least for the cases tested).
Presolve eliminates some variables. What could be a possible cause for cplex to modify the objective function in the described way? And why should, in general, the resulting modified model still be equivalent to the original one? Could it be that cplex changes the names of some variables (the variables are assigned names using
IloNumVar::setName())
?
When turning presolve off via
CurCplex.setParam(IloCplex::PreInd, 0);
, aaa.lp and bbb.lp are identical, and the objective looks as it should.
#CPLEXOptimizers#DecisionOptimization