ILOG CPLEX 11.0 User's Manual > Languages and APIs > ILOG Concert Technology for C++ Users > Accessing Solution Information > Solution Quality

The ILOG CPLEX optimizer uses finite precision arithmetic to compute solutions. To compensate for numeric errors due to this convention, 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); 

to query the maximum bound violation among all variables and slacks. If you are also interested in the variable or constraint where the maximum violation occurs, call instead:

IloRange maxrange; 
IloNumVar maxvar; 
IloNum violation = cplex.getQuality(IloCplex::MaxPrimalInfeas,
                                    &maxrange, 
                                    &maxvar);

ILOG 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. A list of solution qualities appears in the ILOG CPLEX Reference Manual, Callable Library and C++ API, as the group optim.cplex.solutionquality.