Search code examples
c++cplexmixed-integer-programming

Why is MIP infeasible when cplex presolve is ON?


I am using the cplex callable library (version 12.6.3) in a c++ program to solve a Mixed Integer Program. The relevant part of the code looks like this:

loadSubProblem();

double TimeLimit = 999999;
double MipGap = 0.00;
double NbMipSol = 999999;

//status = CPXsetintparam(subenv, CPX_PARAM_PREIND, CPX_OFF); // set presolve on/off
status = CPXsetdblparam(subenv, CPX_PARAM_TILIM, TimeLimit);   // time limit of ... (s)
status = CPXsetintparam(subenv, CPX_PARAM_INTSOLLIM, 1); // stop after 1 solution
status = CPXsetintparam(subenv, CPXPARAM_MIP_Strategy_File, 3); // 0    No node file  // 1  Node file in memory and compressed; default // 2    Node file on disk // 3  Node file on disk and compressed (see: https://www.ibm.com/support/knowledgecenter/de/SSSA5P_12.7.0/ilog.odms.cplex.help/CPLEX/Parameters/topics/NodeFileInd.html)

FILE * fp;
fp = CPXfopen("logfile_sub.log", "w");
status = CPXsetlogfile(subenv, fp);

status = CPXmipopt(subenv, subproblem);
status = CPXgetstat(subenv, subproblem);
// close log file
status = CPXsetlogfile(subenv, NULL);

int cur_numcols = CPXgetnumcols(subenv, subproblem);

// Obtain solution
double objval;
double best_bound;
solstat = 0; // reset solstat
status = CPXgetbestobjval(subenv, subproblem, &best_bound);
status = CPXsolution(subenv, subproblem, &solstat, &objval, primalsolution_subproblem, NULL, NULL, NULL); 

The first line correctly builds the subproblem, as I can check from the lp-file. The status of CPXmipopt is 0. However, according to the log-file the solver seems to stop prematurely and no integer solution is found. CPXgetstat returns status 103 ("integer infeasible"). Consequently, the error occurs in the last line, were status is 1217 ("no solution exists"). Solstat is still 0.

However, when the presolver is turned OFF (in line 7), there does not seem to be a problem. CPXmipopt finishes with status 0, the log-file shows an integer solution is found and the solution can be obtained using CPXsolution (solstat is 104, as expected).

My question being: what reasons could cause this behaviour? Why does turning on the preprocessor causes a failure to find a solution, and how can it be solved?


Solution

  • Based on the useful comments, I figured out my problem was indeed ill-conditioned. The differences in tolerances (as described in the comments and the tech note), caused the problem to be "feasible" when presolve was off.

    After rewriting my problem, it turns out to be infeasible no matter if presolve is on or off.