public abstract static class IloCplex.NodeCallback extends IloCplex.MIPCallback
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.
IloCplex.MIPCallbackIloCplex.MIPCallback.NodeData| Modifier | Constructor and Description |
|---|---|
protected |
IloCplex.NodeCallback()
This is the constructor for user-written node callbacks.
|
| Modifier and Type | Method and Description |
|---|---|
protected 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.
|
protected java.lang.Object |
setNodeData(long id,
java.lang.Object o) |
getObjCoef, getObjCoefs, getObjCoefs, getUserThreadsgetBestObjValue, getCutoff, getDirection, getIncumbentObjValue, getIncumbentValue, getIncumbentValue, getIncumbentValues, getIncumbentValues, getMIPRelativeGap, getMyThreadNum, getNiterations, getNnodes, getNremainingNodes, getPriority, hasIncumbentabort, getCplexTime, getDetTime, getEndDetTime, getEndTime, getEnvImpl, getModel, getNcols, getNQCs, getNrows, getStartDetTime, getStartTime, mainprotected IloCplex.NodeCallback()
IloCplex.NodeCallback objects
directly.protected IloCplex.NodeId getNodeId(int node) throws IloException
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.IloExceptionnode - The node number of the node for which the node identifier is
queried.IloCplex.NodeId of the specified node.protected double getObjValue(int node)
throws IloException
node.IloExceptionnode - The number of the node for which the objective value is
requested.node.protected double getEstimatedObjValue(int node)
throws IloException
node.IloExceptionnode - The number of the node for which the estimated objective value is
requested.node.protected int getDepth(int node)
throws IloException
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.IloExceptionnode - The node number of the node whose depth is being queried.node.protected double getInfeasibilitySum(int node)
throws IloException
node.IloExceptionnode - The node number of the node whose infeasibility sum is being
queried.node.protected int getNinfeasibilities(int node)
throws IloException
node.IloExceptionnode - The node number of the node whose number of integer
infeasibilities is being queried.node.protected void selectNode(int node)
throws IloException
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.
IloExceptionnode - The number of the node you want to be processed next.protected IloNumVar getBranchVar(int node) throws IloException
node. If that node has been created by branching on a
constraint or on multiple variables, null will be returned.IloExceptionnode - The number of the node from which you want to obtain the
variable.node.protected java.lang.Object getNodeData(int node)
throws IloException
node.
User objects can be attached to a node when the node is created with method
IloCplex.BranchCallback.makeBranch in a branch callback.IloExceptionnode.
If no user object is attached to the current node, null
will be returned.protected java.lang.Object setNodeData(long id,
java.lang.Object o)
throws IloException
IloExceptionprotected int getNodeNumber(IloCplex.NodeId nodeid) throws IloException
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 implicitly 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.
IloExceptionnodeid - The node identifier of the for which to query the ndoe number.