NO FRAMES

Class IloCplex::NodeEvaluatorI

Definition file: ilcplex/ilocplexi.h

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:

Constructor and Destructor Summary
public NodeEvaluatorI()
public ~NodeEvaluatorI()
Method Summary
public virtual NodeEvaluatorI *duplicateEvaluator()
public virtual IloNumevaluate() const
protected IloNumVargetBranchVar() const
protected IloNumgetDepth() const
protected IloNumgetEstimatedObjValue() const
protected IloNumgetInfeasibilitySum() const
protected IloIntgetNinfeasibilities() const
protected GoalI::NodeIdgetNodeId() const
protected IloNumgetObjValue() const
public virtual voidinit()
public virtual IloBoolsubsume(IloNum evalBest, IloNum evalCurrent) const
Constructor and Destructor Detail

NodeEvaluatorI

public NodeEvaluatorI()

This constructor creates a node selector for use in an application with a user-defined node selection strategy to solve a MIP.


~NodeEvaluatorI

public ~NodeEvaluatorI()

The virtual destructor allows you to manage your own data inside a node evaluator and delete it when the evaluator is deleted.


Method Detail

duplicateEvaluator

public virtual NodeEvaluatorI * duplicateEvaluator()

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.


evaluate

public virtual IloNum evaluate() const

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.


getBranchVar

protected IloNumVar getBranchVar() const

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.


getDepth

protected IloNum getDepth() const

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.


getEstimatedObjValue

protected IloNum getEstimatedObjValue() const

This method returns the estimated objective value for the node being evaluated. It can be called only from the methods init and evaluate.


getInfeasibilitySum

protected IloNum getInfeasibilitySum() const

This method returns the sum of infeasibility measures at the node being evaluated. It can be called only from the methods init and evaluate.


getNinfeasibilities

protected IloInt getNinfeasibilities() const

This method returns the number of infeasibilities at the node being evaluated. It can be called only from the methods init and evaluate.


getNodeId

protected GoalI::NodeId getNodeId() const

This method returns the node identifier of the node being evaluated. It can be called only from the methods init and evaluate.


getObjValue

protected IloNum getObjValue() const

This method returns the objective value of the node being evaluated. It can be called only from the methods init and evaluate.

If you need the object representing the objective itself, consider the method IloCplex::getObjective instead.


init

public virtual void init()

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.


subsume

public virtual IloBool subsume(IloNum evalBest, IloNum evalCurrent) const

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:

By default, this method returns IloTrue if evalCurrent>evalBest. Overwriting this function allows you to change this selection scheme.