Skip to main content
FRAMES NO FRAMES

Class IloCplex::NodeCallbackI

Definition file: ilcplex/ilocplexi.h
Map of IloCplex::NodeCallbackIIloCplex::NodeCallbackIIloCplex::NodeCallbackIIloCplex::MIPCallbackIIloCplex::MIPInfoCallbackIIloCplex::OptimizationCallbackIIloCplex::CallbackI
Note

This is an advanced class. Advanced classes typically demand a profound understanding of the algorithms used by CPLEX. Thus they incur a higher risk of incorrect behavior in your application, behavior that can be difficult to debug. Therefore, the team encourages you to consider carefully whether you can accomplish the same task by means of other classes instead.

An instance of the class IloCplex::NodeCallbackI represents a user-written callback in an application that uses an instance of IloCplex to solve a mixed integer programming problem (a MIP). The methods of this class enable you (from a user-derived callback class) to query the instance of IloCplex about the next node that it plans to select in the branch-and-cut search, and optionally to override this selection by specifying a different node.

When an instance of this callback executes, the invoking instance of IloCplex still has n = getNremainingNodes (inherited from IloCplex::MIPCallbackI) nodes left to process. These remaining nodes are numbered from 0 (zero) to (n - 1). For that reason, the same node may have a different number each time an instance of NodeCallbackI is called. To identify a node uniquely, an instance of IloCplex also assigns a unique NodeId to each node. That unique identifier remains unchanged throughout the search. The method getNodeId(int i) allows you to access the NodeId for each of the remaining nodes (0 to n-1). Such a query allows you to associate data with individual nodes.

The methods of this class are protected for use in deriving a user-written callback class and in implementing the main method there.

If an attempt is made to access information not available to an instance of this class, an exception is thrown.

See MIPCallbackI::NodeId.

See Also:

Method Summary
public IloNumVargetBranchVar(NodeId nodeid) const
public IloNumVargetBranchVar(IloInt64 node) const
public virtual IloIntgetCurrentNodeDepth() const
public IloIntgetDepth(NodeId nodeid) const
public IloIntgetDepth(IloInt64 node) const
public IloNumgetEstimatedObjValue(NodeId nodeid) const
public IloNumgetEstimatedObjValue(IloInt64 node) const
public IloNumgetInfeasibilitySum(NodeId nodeid) const
public IloNumgetInfeasibilitySum(IloInt64 node) const
public IloIntgetNinfeasibilities(NodeId nodeid) const
public IloIntgetNinfeasibilities(IloInt64 node) const
public NodeData *getNodeData(NodeId nodeid) const
public NodeData *getNodeData(IloInt64 node) const
public NodeIdgetNodeId(IloInt64 node) const
public IloIntgetNodeNumber(NodeId nodeid) const
public IloInt64getNodeNumber64(NodeId nodeid) const
public IloNumgetObjValue(NodeId nodeid) const
public IloNumgetObjValue(IloInt64 node) const
protected Callback::TypegetType() const
protected NodeCallbackI(IloEnv env)
public voidselectNode(NodeId nodeid)
public voidselectNode(IloInt64 node)
public NodeData *setNodeData(IloInt64 node, NodeData * data)
Inherited Methods from MIPCallbackI
getCurrentNodeDepth, getObjCoef, getObjCoef, getObjCoefs, getObjCoefs, getType, getUserThreads, MIPCallbackI
Inherited Methods from MIPInfoCallbackI
getBestObjValue, getCutoff, getDirection, getDirection, getIncumbentObjValue, getIncumbentSlack, getIncumbentSlacks, getIncumbentValue, getIncumbentValue, getIncumbentValue, getIncumbentValues, getIncumbentValues, getMIPRelativeGap, getMyThreadNum, getNcuts, getNiterations, getNiterations64, getNnodes, getNnodes64, getNremainingNodes, getNremainingNodes64, getPriority, getPriority, getQuality, getType, hasIncumbent, MIPInfoCallbackI
Inherited Methods from OptimizationCallbackI
getModel, getNcols, getNQCs, getNrows
Inherited Methods from CallbackI
abort, duplicateCallback, getCplexTime, getDetTime, getEndDetTime, getEndTime, getEnv, getStartDetTime, getStartTime, getType, main
Method Detail

NodeCallbackI

protected NodeCallbackI(IloEnv env)

This constructor creates a callback for use in an application with user-defined node selection inquiry during branch-and-cut searches.


getBranchVar

public IloNumVar getBranchVar(NodeId nodeid) const

This method returns the variable that was branched on last when CPLEX created the node with the identifier nodeid. If that node has been created by branching on a constraint or on multiple variables, this method returns a null handle.

See MIPCallbackI::NodeId.


getBranchVar

public IloNumVar getBranchVar(IloInt64 node) const

Returns the variable that was branched on last when creating the node specified by the index number node. If that node has been created by branching on a constraint or on multiple variables, this method returns a null handle.


getCurrentNodeDepth

public virtual IloInt getCurrentNodeDepth() const

Returns the depth of the current node in the search tree. This method always throws an IloCplex::Exception exception since the callback is not invoked in the context of any node.


getDepth

public IloInt getDepth(NodeId nodeid) const

This method returns the depth of the node in the search tree for the node with the identifier nodeid. The root node has depth 0 (zero). The depth of other nodes is defined recursively as the depth of their parent node plus one. In other words, the depth of a node is its distance in terms of the number of branches from the root.

See MIPCallbackI::NodeId.


getDepth

public IloInt getDepth(IloInt64 node) const

This method returns the depth of the node in the search tree. The root node has depth 0 (zero). The depth of other nodes is defined recursively as the depth of their parent node plus one. In other words, the depth of a node is its distance in terms of the number of branches from the root.


getEstimatedObjValue

public IloNum getEstimatedObjValue(NodeId nodeid) const

This method returns the estimated objective value of the node with the identifier node.

See MIPCallbackI::NodeId.


getEstimatedObjValue

public IloNum getEstimatedObjValue(IloInt64 node) const

This method returns the estimated objective value of the node specified by the index number node.


getInfeasibilitySum

public IloNum getInfeasibilitySum(NodeId nodeid) const

This method returns the sum of infeasibility measures at the node with the identifier nodeid.

See MIPCallbackI::NodeId.


getInfeasibilitySum

public IloNum getInfeasibilitySum(IloInt64 node) const

This method returns the sum of infeasibility measures at the node specified by the index number node.


getNinfeasibilities

public IloInt getNinfeasibilities(NodeId nodeid) const

This method returns the number of infeasibilities at the node with the identifier nodeid.

See MIPCallbackI::NodeId.


getNinfeasibilities

public IloInt getNinfeasibilities(IloInt64 node) const

This method returns the number of infeasibilities at the node specified by the index number node.


getNodeData

public NodeData * getNodeData(NodeId nodeid) const

This method retrieves the NodeData object that may have previously been assigned by the user to the node with the identifier nodeid with one of the methods IloCplex::BranchCallbackI::makeBranch. If no data object has been assigned to the that node, the method returns 0 (zero).

See MIPCallbackI::NodeId and MIPCallbackI::NodeData.


getNodeData

public NodeData * getNodeData(IloInt64 node) const

This method retrieves the NodeData object that may have previously been assigned to the node with index node by the user with the method IloCplex::BranchCallbackI::makeBranch. If no data object has been assigned to the specified node, the method returns 0 (zero).


getNodeId

public NodeId getNodeId(IloInt64 node) const

This method returns the node identifier of the node specified by the index number node. During branch and cut, an instance of IloCplex assigns node identifiers sequentially from 0 (zero) to (getNodes - 1) as it creates nodes. Within a search, these node identifiers are unique throughout the duration of that search. However, at any point, the remaining nodes, (that is, the nodes that have not yet been processed) are stored in an array in an arbitrary order. This method returns the identifier of the node stored at position node in that array.

See also MIPCallbackI::NodeId.


getNodeNumber

public IloInt getNodeNumber(NodeId nodeid) const

Returns the current index number of the node specified by the node identifier nodeid.

See MIPCallbackI::NodeId.


getNodeNumber64

public IloInt64 getNodeNumber64(NodeId nodeid) const

Returns the current index number of the node specified by the node identifier nodeid.

See MIPCallbackI::NodeId.


getObjValue

public IloNum getObjValue(NodeId nodeid) const

This method returns the objective value of the node with the identifier node.

See MIPCallbackI::NodeId.

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


getObjValue

public IloNum getObjValue(IloInt64 node) const

This method returns the objective value of the node specified by the index number node.

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


selectNode

public void selectNode(NodeId nodeid)

This method selects the node with the identifier nodeid and sets it as the next node to process in the branch-and-cut search. The invoking instance of IloCplex uses the specified node as the next node to process.

See MIPCallbackI::NodeId.


selectNode

public void selectNode(IloInt64 node)

This method selects the node specified by its index number node and sets it as the next node to process in the branch & cut search. The argument node must be an integer between 0 (zero) and (getNremainingNodes - 1).

The invoking instance of IloCplex uses the specified node as the next node to process.


setNodeData

public NodeData * setNodeData(IloInt64 node, NodeData * data)

This method sets the NodeData object assigned to the the node identified by node. If a NodeData object has already been set for the current node, then the method replaces this object and returns the old object. Otherwise, the method returns 0 (zero).


getType

protected Callback::Type getType() const

This method returns the callback type of the invoking callback object.