Solution quality

Describes methods of the Java API to access information about the quality of a solution.

The CPLEX optimizer uses finite precision arithmetic to compute solutions. To compensate for numeric errors due to this, tolerances are used by which the computed solution is allowed to violate feasibility or optimality conditions. Thus the solution computed by the solve method may in fact slightly violate the bounds specified in the active model.

IloCplex provides the method getQuality to allow you to analyze the quality of the solution. Several quality measures are defined in class IloCplex.QualityType. For example, to query the maximal bound violation of variables or slacks of the solution found by cplex.solve, call getQuality, like this:


IloCplex.QualityType inf = cplex.getQuality(IloCplex.QualityType.MaxPrimalInfeas);

double       maxinfeas = inf.getValue();

The variable or constraint for which this maximum infeasibility occurs can be queried by inf.getNumVar or inf.getRange, one of which returns null. Not all quality measures are available for solutions generated by different optimizers. See the CPLEX Java API Reference Manual for further details.