Choosing an Optimizer

The most important control is the selection of the optimizer option to use for solving LPs. Solving the extracted model with CPLEX involves solving one or a series of LPs:

The optimizer option used for solving the first LP (whether or not it is the only one or just the first one in a series of problems) is controlled by calling the method:

cplex.setRootAlgorithm(alg);

where alg is a member of the nested enumeration type:

enum IloCplex::Algorithm { 
  Primal, 
  Dual, 
  Barrier, 
  NetworkPrimal, 
  NetworkDual, 
  DualBarrier
};

As a nested enumeration type, the fully qualified names that must be used in the program are IloCplex::Primal, IloCplex::Dual, and so on. Table 1.2 displays the meaning of the optimizer options defined by IloCplex::Algorithm

Table 1.2 Optimizer Options

use the primal simplex algorithm 
use the dual simplex algorithm 
use the barrier algorithm. The type of crossover performed after the barrier algorithm is determined by parameter IloCplex::BarCrossAlg
use the primal network simplex algorithm on an embedded network followed by the primal simplex algorithm on the entire problem 
use the primal network simplex algorithm on an embedded network followed by the dual simplex algorithm on the entire problem 
use the dual simplex algorithm up to the simplex iteration limit, if the LP is not solved by then switch to the barrier algorithm. This option is available only for MIPs.  

.

If the extracted model contains more than one LP, the algorithm for solving all but the first LP is controlled by calling method cplex.setNodeAlgorithm(alg). The current setting for the root and node algorithm can be queried using methods:

IloCplex::Algorithm IloCplex::getRootAlgorithm() const;
IloCplex::Algorithm IloCplex::getNodeAlgorithm() const;

Controlling CPLEX Optimizers

Though CPLEX defaults will prove sufficient to solve most of the problems, CPLEX offers a variety of parameters to control various algorithmic choices. ILOG CPLEX parameters can assume values of type bool, num, int, and string. IloCplex provides four categories of parameters that are listed in the nested enumeration types IloCplex::BoolParam, IloCplex::IntParam, IloCplex::NumParam, IloCplex::StringParam.

To access the current value of a parameter that interests you from the Concert Technology Library, use the method getParam. To access the default value of a parameter, use the method getDefault. Use the methods getMin and getMax to access the minimum and maximum values of num and int type parameters.

Some integer parameters are tied to nested enumerations that define symbolic constants for the values the parameter may assume. In particular, these enumeration types are: IloCplex::MIPEmphasisType, IloCplex::VariableSelect, IloCplex::NodeSelect, IloCplex::PrimalPricing, and IloCplex::DualPricing. They are used for parameters IloCplex::MIPEmphasis, IloCplex::VarSel, IloCplex::NodeSel, IloCplex::PPriInd, and IloCplex::DPriInd, respectively. Only the parameter IloCplex::MIPEmphasis may be of importance for general use.

There are, of course, routines in the Concert Technology Library to set these parameters. Use the following methods to set the values of CPLEX parameters:

IloCplex::setParam(BoolParam, value);
IloCplex::setParam(IntParam, value);
IloCplex::setParam(NumParam, value);
IloCplex::setParam(StringParam, value);

For example, the numerical parameter IloCplex::EpOpt controlling the optimality tolerance for the simplex algorithms can be set to 0.0001 by calling

cplex.setParam(IloCplex::EpOpt, 0.0001); 

The ILOG CPLEX Reference Manual documents the type of each parameter (bool, int, num, string) along with the Concert Technology enumeration value, symbolic constant, and reference number representing the parameter.

The method setDefaults resets all parameters (except the name of the log file) to their default values, including the ILOG CPLEX callback functions. This routine resets the callback functions to NULL.

When solving MIPs, additional controls of the solution process are provided. Priority orders and branching directions can be used to control the branching in a static way. These are discussed in Priority. These controls are static in the sense that they allow you to control the solution process based on data that does not change during the solution and can thus be setup before solving the model.

Dynamic control of the solution process of MIPs is provided through control callbacks. They are discussed in Using Callbacks. Callbacks allow you to control the solution process based on information that is generated during the solution process.


Previous Page: Solving a Model  Return to Top Next Page: Accessing Solution Information