An important feature of CPLEX is that even if no feasible solution has been found, that is, if cplex.
solve
() returns IloFalse
, some information about the problem can be queried when solving LPs. All the methods discussed so far may successfully return information about the current (infeasible) solution CPLEX maintains.
Unfortunately, there is no simple comprehensive rule about whether or not current solution information can be queried. This is because, by default, CPLEX uses a presolve procedure to simplify the model. If, for example, the model is proven to be infeasible during the presolve, no current solution is generated by the optimizer. If, in contrast, infeasibility is only proven by the optimizer, current solution information is available to be queried. The status returned by calling cplex.
getCplexStatus
() may help to determine which case you are facing, but it is probably safer and easier to include the methods for querying solution within try/catch statements.
When an LP has been proven to be infeasible, CPLEX provides assistance for determining the cause of the infeasibility. This is done by computing what is known as an irreducibly inconsistent set (IIS), which is a description of the minimal subproblem that is still infeasible. Here minimality is defined by the property: if you remove any of the constraints (including finite bounds), the infeasibility vanishes. An IIS is computed for an infeasible model by calling method cplex.
getIIS
().