NO FRAMES

Class IloCplex::NodeCallbackI

Definition file: ilcplex/ilocplexi.h
Note

This is an advanced class. Advanced classes typically demand a profound understanding of the algorithms used by ILOG CPLEX. Thus they incur a higher risk of incorrect behavior in your application, behavior that can be difficult to debug. Therefore, ILOG 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 & 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 Also:

Constructor Summary
protected NodeCallbackI(IloEnv env)
Method Summary
protected IloNumVargetBranchVar(NodeId nodeid) const
protected IloNumVargetBranchVar(int node) const
protected IloIntgetDepth(NodeId nodeid) const
protected IloIntgetDepth(int node) const
protected IloNumgetEstimatedObjValue(NodeId nodeid) const
protected IloNumgetEstimatedObjValue(int node) const
protected IloNumgetInfeasibilitySum(NodeId nodeid) const
protected IloNumgetInfeasibilitySum(int node) const
protected IloIntgetNinfeasibilities(NodeId nodeid) const
protected IloIntgetNinfeasibilities(int node) const
protected NodeData *getNodeData(NodeId nodeid) const
protected NodeData *getNodeData(int node) const
protected NodeIdgetNodeId(int node) const
protected IloIntgetNodeNumber(NodeId nodeid) const
protected IloNumgetObjValue(NodeId nodeid) const
protected IloNumgetObjValue(int node) const
protected voidselectNode(NodeId nodeid)
protected voidselectNode(int node)
Inherited Methods from MIPCallbackI
getNcliques, getNcovers, getNdisjunctiveCuts, getNflowCovers, getNflowPaths, getNfractionalCuts, getNGUBcovers, getNimpliedBounds, getNMIRs, getObjCoef, getObjCoef, getObjCoefs, getObjCoefs, getUserThreads
Inherited Methods from MIPInfoCallbackI
getBestObjValue, getCutoff, getDirection, getDirection, getIncumbentObjValue, getIncumbentSlack, getIncumbentSlacks, getIncumbentValue, getIncumbentValue, getIncumbentValues, getIncumbentValues, getMyThreadNum, getNiterations, getNnodes, getNremainingNodes, getPriority, getPriority, hasIncumbent
Inherited Methods from OptimizationCallbackI
getModel, getNcols, getNQCs, getNrows
Inherited Methods from CallbackI
abort, duplicateCallback, getEnv, main
Constructor Detail

NodeCallbackI

protected NodeCallbackI(IloEnv env)

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


Method Detail

getBranchVar

protected 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, 0 (zero) will be returned.


getBranchVar

protected IloNumVar getBranchVar(int 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, 0 (zero) will be returned.


getDepth

protected 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.


getDepth

protected IloInt getDepth(int 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

protected IloNum getEstimatedObjValue(NodeId nodeid) const

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


getEstimatedObjValue

protected IloNum getEstimatedObjValue(int node) const

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


getInfeasibilitySum

protected IloNum getInfeasibilitySum(NodeId nodeid) const

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


getInfeasibilitySum

protected IloNum getInfeasibilitySum(int node) const

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


getNinfeasibilities

protected IloInt getNinfeasibilities(NodeId nodeid) const

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


getNinfeasibilities

protected IloInt getNinfeasibilities(int node) const

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


getNodeData

protected 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 identfier nodeid with one of the methods IloCplex::BranchCallbackI::makeBranch. If no data object has been assigned to the that node, 0 (zero) will be returned.


getNodeData

protected NodeData * getNodeData(int 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, 0 (zero) will be returned.


getNodeId

protected NodeId getNodeId(int node) const

This method returns the node identifier of the node specified by the index number node. During branch & 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.


getNodeNumber

protected IloInt getNodeNumber(NodeId nodeid) const

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


getObjValue

protected IloNum getObjValue(NodeId nodeid) const

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

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


getObjValue

protected IloNum getObjValue(int 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

protected 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 & cut search. The invoking instance of IloCplex uses the specified node as the next node to process.


selectNode

protected void selectNode(int 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 parameter 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.