The ILOG CPLEX optimizer uses finite precision arithmetic to compute solutions. To compensate for numerical 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:
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 calling inf.getNumVar
or inf.getRange
, one of which returns null
. Not all quality measures are available for solutions generated by different optimizers. See the ILOG CPLEX Java Reference Manual for further details.