Selecting an optimizer
Select an optimizer in a C++ application on the basis of the problem type.
IloCplex
treats all problems it solves as Mixed Integer Programming (MIP) problems.
The algorithm used by IloCplex for solving
MIP is known as dynamic search or branch and cut (referred to in some
contexts as branch and bound) and is documented in more detail in
the CPLEX User’s Manual. For this tutorial, it is
sufficient to know that this algorithm consists of solving a sequence
of LPs, QPs, or QCPs that are generated in the course of the algorithm.
The first LP, QP, or QCP to be solved is known as the root, while
all the others are referred to as nodes and are derived from the root
or from other nodes. If the model extracted to the cplex object
is a pure LP, QP, or QCP (no integer variables), then it will be fully
solved at the root.
As mentioned in Optimizer options, various optimizer
options are provided for solving LPs, QPs, and QCPs. While the default
optimizer works well for a wide variety of models, IloCplex allows
you to control which option to use for solving the root and for solving
the nodes, respectively, by the following methods:
void IloCplex::setParam(IloCplex::RootAlg, alg)
void IloCplex::setParam(IloCplex::NodeAlg, alg)
where IloCplex::Algorithm is an enumeration type. It defines the following symbols with their meaning:
| Optimizer | Description |
|---|---|
IloCplex::AutoAlg
|
allow CPLEX to choose the algorithm |
IloCplex::Dual
|
use the dual simplex algorithm |
IloCplex::Primal
|
use the primal simplex algorithm |
IloCplex::Barrier
|
use the barrier algorithm |
IloCplex::Network
|
use the network simplex algorithm for the embedded network |
IloCplex::Sifting
|
use the sifting algorithm |
IloCplex::Concurrent
|
allow CPLEX to use multiple algorithms on multiple computer processors |
For QP models, only the AutoAlg, Dual, Primal, Barrier, and Network algorithms
are applicable.
Set the root algorithm argument to select the optimizer
that CPLEX uses to solve a pure LP or QPs. The example ilolpex2.cpp illustrates
this practice.