12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

For example, an Optimal status indicates that an optimal solution has been found and canbe queried, whereas an Infeasible status indicates that the active model has been provento be infeasible. See the online <strong>ILOG</strong> <strong>CPLEX</strong> Java Reference <strong>Manual</strong> for more informationabout these statuses.More detailed information about the status of the optimizer can be queried with methodgetCplexStatus returning an object corresponding to <strong>ILOG</strong> <strong>CPLEX</strong> status codes. Againthe online <strong>ILOG</strong> <strong>CPLEX</strong> Java Reference <strong>Manual</strong> contains further information about this.Accessing Solution InformationIf a solution was found with the solve method, it can be accessed and then queried using avariety of methods. The objective function can be accessed by callingdouble objval = cplex.getObjValue();The values of individual modeling variables for the solution are accessed by calling methodsIloCplex.getValue, for example:double x1 = cplex.getValue(var1);Frequently, solution values for an array of variables are needed. Rather than having toimplement a loop to query the solution values variable by variable, the methodIloCplex.getValues is provided to do so with only one function call:double[] x = cplex.getValues(vars);Similarly, slack values can be queried for the constraints in the active model using themethods IloCplex.getSlack or IloCplex.getSlacks.Printing the Solution to the Diet ModelThis can now be applied to solving the diet problem discussed earlier, and printing itssolution.82 <strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!