ilog.cplex
Class IloCplex.NodeCallback

java.lang.Object
  |
  +--ilog.cplex.IloCplex.Callback
        |
        +--ilog.cplex.IloCplex.MIPCallback
              |
              +--ilog.cplex.IloCplex.NodeCallback
All Implemented Interfaces:
java.lang.Cloneable
Enclosing class:
IloCplex

public abstract static class IloCplex.NodeCallback
extends IloCplex.MIPCallback

This is the base class for user-written callbacks that allow the user to select the node to process next during the branch-and-cut search.

Node callbacks allow you to determine which node from among the unexplored nodes IloCplex will chose to explore next in the branch-and-cut search. They aslo give you the option to override this selection.

When an instance of this callback class executes, the invoking instance of IloCplex still has n = getNremainingNodes (inherited from MIPCallback) 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 NodeCallback is called. To identify a node uniquely, an instance of IloCplex also assigns a unique identifier (IloCplex.NodeId) to each node. That unique identifier remains unchanged throughout the search. The method getNodeId(int i) allows you to access the IloCplex.NodeId for each of the remaining nodes 0 to n-1. Similarly, the method getNodeNumber returns the number of a node specified by its IloCplex.NodeId.

The constructor and methods of this class are protected to make sure that they are used only to derive a user-written callback class or to implement the main method in it.

See Also:
IloCplex.MIPCallback

Constructor Summary
protected IloCplex.NodeCallback()
          This is the constructor for user-written node callbacks.
 
Method Summary
protected  ilog.concert.IloNumVar getBranchVar(int node)
          Returns the variable that was branched upon to create the node specified by number node.
protected  int getDepth(int node)
          Returns the depth of the node in the search tree.
protected  double getEstimatedObjValue(int node)
          Returns the estimated objective value for the node indicated by the node number node.
protected  double getInfeasibilitySum(int node)
          Returns the sum of integer infeasibility of the node indicated by the node number node.
protected  int getNinfeasibilities(int node)
          Returns the number of integer infeasible variables for the node indicated by the node number node.
protected  java.lang.Object getNodeData(int node)
          Returns the user object attached to the node with number node.
protected  IloCplex.NodeId getNodeId(int node)
          Returns the node identifier of the node indicated by the node number node.
protected  int getNodeNumber(IloCplex.NodeId nodeid)
          Returns the node number of the node indicated by the node identifier nodeid.
protected  double getObjValue(int node)
          Returns the objective value of the node indicated by the node number node.
protected  void selectNode(int node)
          Selects the next node to be processed by its number.
 
Methods inherited from class ilog.cplex.IloCplex.MIPCallback
getBestObjValue, getCutoff, getDirection, getIncumbentObjValue, getIncumbentValue, getIncumbentValues, getIncumbentValues, getMyThreadNum, getNcliques, getNcovers, getNdisjunctiveCuts, getNflowCovers, getNflowPaths, getNfractionalCuts, getNGUBcovers, getNimpliedBounds, getNiterations, getNMIRs, getNnodes, getNremainingNodes, getObjCoef, getObjCoefs, getObjCoefs, getPriority, getUserThreads, hasIncumbent
 
Methods inherited from class ilog.cplex.IloCplex.Callback
abort, getModel, getNcols, getNQCs, getNrows, main
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IloCplex.NodeCallback

protected IloCplex.NodeCallback()
This is the constructor for user-written node callbacks. This constructor can be called only to construct objects of derived user-written callback classes; it cannot be used to construct IloCplex.NodeCallback objects directly.

Method Detail

getNodeId

protected IloCplex.NodeId getNodeId(int node)
                             throws IloException
Returns the node identifier of the node indicated by the node number node. An instance of IloCplex numbers the nodes that remain to be explored in the branch and cut sequentially from 0 (zero) to getNremainingNodes()-1. However, when a node is created during search, it also assigns a unique IloCplex.NodeId to it. This method allows you to query this IloCplex.NodeId for all unexplored nodes.

Parameters:
node - The node number of the node for which the node identifier is queried.
Returns:
The IloCplex.NodeId of the specified node.
IloException

getObjValue

protected double getObjValue(int node)
                      throws IloException
Returns the objective value of the node indicated by the node number node.

Parameters:
node - The number of the node for which the objective value is requested.
Returns:
The objective value of node number node.
IloException

getEstimatedObjValue

protected double getEstimatedObjValue(int node)
                               throws IloException
Returns the estimated objective value for the node indicated by the node number node.

Parameters:
node - The number of the node for which the estimated objective value is requested.
Returns:
The estimated object value for the node with node number node.
IloException

getDepth

protected int getDepth(int node)
                throws IloException
Returns the depth of the node in the search tree. The root node is defined to have depth 0 (zero); the depth of other nodes is their distance from the root or, equivalently, the number of branches needed to reach that node from the root.

Parameters:
node - The node number of the node whose depth is being queried.
Returns:
The depth of the node with number node.
IloException

getInfeasibilitySum

protected double getInfeasibilitySum(int node)
                              throws IloException
Returns the sum of integer infeasibility of the node indicated by the node number node.

Parameters:
node - The node number of the node whose infeasibility sum is being queried.
Returns:
The sum of integer infeasibility of the node with number node.
IloException

getNinfeasibilities

protected int getNinfeasibilities(int node)
                           throws IloException
Returns the number of integer infeasible variables for the node indicated by the node number node.

Parameters:
node - The node number of the node whose number of integer infeasibilities is being queried.
Returns:
The number of integer infeasibilities for the node with number node.
IloException

selectNode

protected void selectNode(int node)
                   throws IloException
Selects the next node to be processed by its number.

Selects the node indicated by number node as the next node to process in the branch-and-cut search. The parameter node is the node number of the node to selected and must be between 0 (zero) and getNremainingNodes()-1.

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

Parameters:
node - The number of the node you want to be processed next.
IloException

getBranchVar

protected ilog.concert.IloNumVar getBranchVar(int node)
                                       throws IloException
Returns the variable that was branched upon to create the node specified by number node. If that node has been created by branching on a constraint or on multiple variables, null will be returned.

Parameters:
node - The number of the node from which you want to obtain the variable.
Returns:
The branch variable of the node with number node.
IloException

getNodeData

protected java.lang.Object getNodeData(int node)
                                throws IloException
Returns the user object attached to the node with number node. User objects can be attached to a node when the node is created with method IloCplex.BranchCallback.makeBranch in a branch callback.

Returns:
The user object attached to the node with number node. If no user object is attached to the current node, null will be returned.
IloException

getNodeNumber

protected int getNodeNumber(IloCplex.NodeId nodeid)
                     throws IloException
Returns the node number of the node indicated by the node identifier nodeid.

An instance of IloCplex assigns node identifiers to nodes when it creates them while branching. Within a search, these node identifiers are unique throughout the duration of that search. However, the remaining nodes are implicitely numbered starting from 0 (zero) at each node. This method returns the number that the node with the specified identifier has within that local numbering.

Parameters:
nodeid - The node identifier of the for which to query the ndoe number.
Returns:
The number of the node.
IloException