|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectilog.cplex.IloCplex.Callback
ilog.cplex.IloCplex.MIPCallback
ilog.cplex.IloCplex.NodeCallback
Base class for user-written callbacks selecting the next node to process during the branch-and-cut search.
This is an advanced class.
Important:
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.
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 also 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.MIPCallback
Constructor Summary | |
protected |
IloCplex.NodeCallback()
This is the constructor for user-written node callbacks. |
Method Summary | |
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. |
Methods inherited from class ilog.cplex.IloCplex.MIPCallback |
getBestObjValue, getCutoff, getDirection, getIncumbentObjValue, getIncumbentValue, getIncumbentValues, getIncumbentValues, getNcliques, getNcovers, getNdisjunctiveCuts, getNflowCovers, getNflowPaths, getNfractionalCuts, getNGUBcovers, getNimpliedBounds, getNiterations, getNMIRs, getNnodes, getNremainingNodes, getObjCoef, getObjCoefs, getObjCoefs, getPriority, 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 |
protected IloCplex.NodeCallback()
IloCplex.NodeCallback
objects directly.
Method Detail |
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.
node
- The node number of the node for which the node
identifier is queried.
IloCplex.NodeId
of the specified node.
IloException
protected double getObjValue(int node) throws IloException
node
.
node
- The number of the node for which the objective
value is requested.
node
.
IloException
protected double getEstimatedObjValue(int node) throws IloException
node
.
node
- The number of the node for which the estimated
objective value is requested.
node
.
IloException
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.
node
- The node number of the node whose depth is being queried.
node
.
IloException
protected double getInfeasibilitySum(int node) throws IloException
node
.
node
- The node number of the node whose infeasibility sum
is being queried.
node
.
IloException
protected int getNinfeasibilities(int node) throws IloException
node
.
node
- The node number of the node whose
number of integer infeasibilities is being queried.
node
.
IloException
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.
node
- The number of the node you want to be processed next.
IloException
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.
node
- The number of the node from which you want to
obtain the variable.
node
.
IloException
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.
node
. If no user object is attached to the
current node, null
will be returned.
IloException
protected 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.
nodeid
- The node identifier of the for which to query the node
number.
IloException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |