If cplex.solve
() returns IloTrue
, a feasible solution has been found and solution values for model variables are available to be queried. For example, the solution value for the numeric variable var1
can be accessed as follows:
IloNum x1 = cplex.getValue(var1);
|
IloNumArray x(env); cplex.getValues(x, var); |
Solution data is not restricted to the solution values of variables. It also includes values of slack variables for linear constraints and the objective value. If the extracted model does not contain an objective object, IloCplex
assumes a 0 expression objective. The objective value is returned by calling method cplex.
getObjValue
(). Slack values are accessed with the methods getSlack()
and getSlacks()
, which take linear constraints as a parameter.
For LPs, solution data includes information such as dual variables and reduced cost. Such information can be queried with the methods, getDual
(), getDuals()
, getReducedCost()
, and getReducedCosts()
.