I'm willing to solve the linear relaxation of an ILP model I have.
Thus, I set all of my {0,1}
variables as IloNumVar
and called the function solve()
of CPLEX.
However, this call solves the root node performing a costly preprocessing and inserting a lot of cuts, but all I want to do is to get the solution of the linear relaxation of my model.
I set all of the above parameters. However, the linear relaxation is not solved fastly enough due to the CPLEX preprocessing.
cplex->setParam(IloCplex::Cliques, -1);
cplex->setParam(IloCplex::Covers, -1);
cplex->setParam(IloCplex::DisjCuts, -1);
cplex->setParam(IloCplex::FlowCovers, -1);
cplex->setParam(IloCplex::FlowPaths, -1);
cplex->setParam(IloCplex::GUBCovers, -1);
cplex->setParam(IloCplex::ImplBd, -1);
cplex->setParam(IloCplex::MIRCuts, -1);
cplex->setParam(IloCplex::FracCuts, -1);
cplex->setParam(IloCplex::ZeroHalfCuts, -1);
How can I get rid of this preprocessing and obtain the solution of the linear relaxation only?
If you want to solve the linear relaxation then you have to solve the model as an LP, not as a MIP. To do this, convert all variables to continuous variables. This can be done by adding an IloConversion for each variable. See for example function solveRelaxed
in example iloadmipex6.cpp
that is shipped with CPLEX:
void solveRelaxed(IloModel mdl, IloNumVarArray vars, IloNumArray rel) {
IloEnv env = mdl.getEnv();
IloModel relax(env);
relax.add(mdl);
relax.add(IloConversion(env, vars, ILOFLOAT));
IloCplex cplex(relax);
cplex.solve();
env.out() << "Solution status = " << cplex.getStatus() << endl;
cplex.getValues(rel, vars);
cplex.end();
relax.end();
}
Btw, a simpler way to disable all cutting planes is to set parameter CutPass
.
Also note that even when solving as an LP CPLEX will do presolve. Presolve can be disabled via parameter PreInd
.