Setting parameters
The parameters in CP Optimizer can be set using a method of the class representing the optimizer.
In the C++ API of CP Optimizer, you set
a parameter on the optimizer with a call to IloCP::setParameter. The
first argument to this function is either IloCP::IntParam or IloCP::NumParam. The second argument is a value
of type IloInt, IloNum or
the enumerated type IloCP::ParameterValues.
To set a parameter on the optimizer in the C++ API, you use the method IloCP::setParameter, for example:
IloCP cp(model);
cp.setParameter(IloCP::SearchType, IloCP::DepthFirst);
cp.solve();
In the Java™ API of
CP Optimizer, you set a parameter on the optimizer with a call to IloCP.setParameter. The first argument to this function
is either IloCP.IntParam or IloCP.DoubleParam.
The second argument is a value of type int or double or an instance of a subclass of IloCP.ParameterValues. To set a parameter on the
optimizer in the Java API, you
use the method IloCP.setParameter, for example:
IloCP cp = new IloCP();
// add variables and constraints
cp.setParameter(IloCP.IntParam.SearchType,
IloCP.ParameterValues.DepthFirst);
cp.solve();
Likewise, in the C# API of CP Optimizer,
you set a parameter on the optimizer with a call to CP.SetParameter.
The first argument to this function is either CP.IntParam or CP.DoubleParam. The second argument is a value of
type Int32 or Double or
an instance of a subclass of CP.ParameterValues.
To set a parameter on the optimizer in the C# API, you use the method CP.SetParameter, for example:
CP cp = new CP();
// add variables and constraints
cp.SetParameter(CP.IntParam.SearchType,
CP.ParameterValues.DepthFirst);
cp.Solve();
Some parameters may not be changed while there is an
active search, such as between calls to the optimizer methods startNewSearch and endSearch.
You can change any limit, such as ChoicePoinLimit, BranchLimit, TimeLimit, SolutionLimit and FailLimit during
search.
The appropriate values are detailed in the CP Optimizer Reference Manuals. Most of the search parameters available for use in CP Optimizer are discussed in more detail throughout this manual.