The 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 model for example. You can call:
IloNum violation = cplex.getQuality(IloCplex::MaxPrimalInfeas);
|
IloRange maxrange; IloNumVar maxvar; IloNum violation = cplex.getQuality(IloCplex::MaxPrimalInfeas, &maxrange, &maxvar); |
CPLEX will copy the variable or constraint handle in which the maximum violation occurs to maxvar
or maxrange
and make the other handle an empty one. The maximum primal infeasibility is only one example of a wealth of quality measures. The full list is defined by the nested enumeration type IloCplex::Quality
. All of these can be used as a parameter for the getQuality()
methods, though some measures are not available for all optimizer option choices.