Solve the model
Java methods create the object-oriented optimizer in a Java application of CPLEX.
So far you have seen some methods of IloCplex for creating models. All such methods are defined in the interfaces IloModeler and its extension IloMPModeler and IloCplexModeler. However, IloCplex not only implements these interfaces but also provides additional methods for solving a model and querying its results.
After you have created a model as explained in Create the model, the object IloCplex is ready to solve the problem, which consists of the model and all the modeling objects that have been added to it. Invoking the optimizer then is as simple as calling the method solve .
That method returns a Boolean value indicating whether
the optimization succeeded in finding a solution. If no solution was
found, false is returned. If true is
returned, then CPLEX found a feasible solution, though it is not necessarily
an optimal solution. More precise information about the outcome of
the last call to the method solve can be
obtained from the methodgetStatus .
The returned value tells you what CPLEX found out about the model: whether it found the optimal solution or only a feasible solution, whether it proved the model to be unbounded or infeasible, or whether nothing at all has been proved at this point. Even more detailed information about the termination of the optimizer call is available through the method getCplexStatus .