Overview | Group | Tree | Graph | Index | Concepts |
IloCplex::NodeEvaluatorI
is the base class for implementing
node evaluators. Node evaluators allow you to control the node selection
strategy for a subtree by assigning values to the nodes. By default,
IloCplex
selects the node with the lowest value when choosing
the next node to process during branch & cut search. This behavior can
be altered by overwriting method subsume
.
To implement your own node evaluator, you need to create a subclass of
IloCplex::NodeEvaluatorI
and implement methods
evaluate
and duplicateEvaluator
. The method
evaluate
must be implemented to compute and return a value
for a given node. The protected methods of class
IloCplex::NodeEvaluatorI
can be called to query information
about the node in order to compute this value. Each node is evaluated only
once, after which the value is attached to the node until the node is
processed or pruned.
The duplicateEvaluator
method is called by
IloCplex
when a copy of the evaluator must be created for use
in parallel branch & cut search. Thus the implementation must simply
create and return a copy of the evaluator itself—calling the copy
constructor will work in most circumstances.
Node evaluators are applied to a search defined by a goal with the method
IloCplex::Apply
. The node selection strategy will be
applied only to the subtree defined by the goal passed to
Apply
.
Using IloCplex::Apply
, you can assign different
node selection strategies to different subtrees. You can also assign
multiple node selection strategies to subtrees. In this case, node selection
strategies applied first have precedence over those assigned later.
If no node evaluators are added, IloCplex
uses the node
selection strategy as controlled by the NodeSel
parameter.
See Also:
IloCplex, IloCplex::NodeEvaluator
Constructor and Destructor Summary | |
---|---|
public | NodeEvaluatorI() |
public | ~NodeEvaluatorI() |
Method Summary | |
---|---|
public virtual NodeEvaluatorI * | duplicateEvaluator() |
public virtual IloNum | evaluate() |
protected IloNumVar | getBranchVar() |
protected IloNum | getDepth() |
protected IloNum | getEstimatedObjValue() |
protected IloNum | getInfeasibilitySum() |
protected IloInt | getNinfeasibilities() |
protected GoalI::NodeId | getNodeId() |
protected IloNum | getObjValue() |
public virtual void | init() |
public virtual IloBool | subsume(IloNum, IloNum) |
Constructor and Destructor Detail |
---|
This constructor creates a node selector for use in an application with a user-defined node selection strategy to solve a MIP.
The virtual destructor allows you to manage your own data inside a node evaluator and delete it when the evaluator is deleted.
Method Detail |
---|
This method must be implemented by the user to return a copy of
the invoking object. It is called internally
to duplicate the current node
evaluator for parallel branch & cut search. This method is not called
for a particular node, so the get
methods cannot be used.
This method must be implemented by the user to return a value
for a given node. When this method is called, the node evaluator is
initialized to the node for which to compute the value. Information
about this node can be obtained by the get
methods of
IloCplex::NodeEvaluatorI
. Returning IloInfinity
instructs IloCplex
to discard the node being evaluated.
This method returns the variable that IloCplex
branched on when creating the node being evaluated from its parent.
If the node has been generated with a more complex branch, 0 (zero)
will be
returned instead. This method can be called only from the methods
init
and evaluate
.
This method returns the depth in the search tree of the node
currently being evaluated. The root node is depth 0 (zero); the depth
of the current node is its distance from the root, or equivalently, the
number of branches taken to get from the root node to the current node.
This member function can be called only from the methods
init
and evaluate
.
This method returns the estimated objective value for the node
being evaluated. It can be called only from the methods
init
and evaluate
.
This method returns the sum of infeasibility measures at the
node being evaluated. It can be called only from the methods
init
and evaluate
.
This method returns the number of infeasibilities at the node
being evaluated. It can be called only from the methods init
and evaluate
.
This method returns the node identifier of the node being
evaluated. It can be called only from the methods init
and
evaluate
.
This method returns the objective value of the node being
evaluated. It can be called only from the methods init
and
evaluate
.
This method is called by IloCplex
immediately
before the first time evaluate
is called for a node,
allowing you to initialize the evaluator based on that node.
Information about the current node can be queried by calling the
get
methods of IloCplex::NodeEvaluatorI
.
IloCplex
maintains a candidate node for selection as the
next node to process. When choosing the next node, it compares the
candidate to all other nodes. If a given node and the candidate node
are governed by the same evaluator, IloCplex
calls
subsume
to determine whether the node should become the new
candidate. The arguments passed to the subsume
call are:
evaluate
to the candidate node as parameter evalBest
, andevaluate
to the node under investigation as parameter evalCurrent
.
By default, this method returns IloTrue
if
evalCurrent
>
evalBest
.
Overwriting this function allows you to change this selection scheme.