|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ilog.cplex.IloCplex.Callback | +--ilog.cplex.IloCplex.MIPCallback | +--ilog.cplex.IloCplex.ControlCallback | +--ilog.cplex.IloCplex.BranchCallback
An instance of this class represents a
user-written callback in an application that uses an instance of
IloCplex
to solve a mixed integer program (MIP). The
user-written callback is called prior to branching at a node in the
branch and cut tree during the optimization of a MIP. It allows you to
query how the invoking instance of IloCplex
is about to
create subnodes at the current node and gives you the option to override
the selection made by the invoking instance of IloCplex
.
You can create zero, one, or two branches. The method
prune()
removes the current node from the search tree. No
subnodes from the current node will be added to the search tree.
The method makeBranch
tells an instance of
IloCplex
how to create a subproblem. You may call this member
function zero, one, or two times in every invocation of the branch
callback. If you call it once, it creates one node; it you call it twice,
it creates two nodes (one node at each call).
If you call neither prune()
nor makeBranch
,
then the instance of IloCplex
proceeds with its own
selection.
Calling both prune()
and makeBranch
in one
invocation of a branch callback is an error and yields unspecified
behavior.
The methods of this class are for use in deriving a user-written callback
class and in implementing the main
method in it. If an attempt
is made to access information not available to an instance of this class,
an exception is thrown.
IloCplex.ControlCallback
Constructor Summary | |
protected |
IloCplex.BranchCallback()
This constructor is used to create a user-written callback class which is called prior to branching at a node in the branch and cut tree during the optimization of a MIP. |
Method Summary | |
protected void |
getBranches(IloNumVar[][] vars,
double[][] bounds,
IloCplex.BranchDirection[][] dirs)
Queries the branches IloCplex would create at the current
node. |
protected IloCplex.BranchType |
getBranchType()
Gets the type of branching IloCplex is going to do for the
current node. |
protected int |
getNbranches()
Gets the number of branches IloCplex is going to create at
the current node. |
protected IloCplex.NodeId |
getNodeId()
Gets the node id of the current node. |
protected IloCplex.NodeId |
makeBranch(IloNumVar[] vars,
double[] bounds,
IloCplex.BranchDirection[] dirs,
double objestimate)
Creates one or two nodes which override the branch chosen by an instance of IloCplex . |
protected IloCplex.NodeId |
makeBranch(IloNumVar var,
double bound,
IloCplex.BranchDirection dir,
double objestimate)
Creates one or two nodes which override the branch chosen by an instance of IloCplex at variable var . |
protected void |
prune()
Instructs the CPLEX branch and cut search not to create any child nodes from the current node. |
Methods inherited from class ilog.cplex.IloCplex.ControlCallback |
getDownPseudoCost,
getFeasibilities,
getFeasibilities,
getFeasibility,
getLB,
getLBs,
getLBs,
getObjCoef,
getObjCoefs,
getObjCoefs,
getObjValue,
getSlack,
getSlacks,
getSlacks,
getSOSFeasibility,
getSOSFeasibility,
getUB,
getUBs,
getUBs,
getUpPseudoCost,
getValue,
getValue,
getValues,
getValues |
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,
getPriority,
isIntegerFeasible |
Methods inherited from class ilog.cplex.IloCplex.Callback |
abort,
main |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
protected IloCplex.BranchCallback()
Method Detail |
protected IloCplex.NodeId getNodeId()
protected int getNbranches()
IloCplex
is going to create at
the current node.IloCplex
is going to create
at the current node.protected IloCplex.BranchType getBranchType()
IloCplex
is going to do for the
current node.IloCplex
is going to do for
the current node.protected void getBranches(IloNumVar[][] vars, double[][] bounds, IloCplex.BranchDirection[][] dirs) throws IloException
IloCplex
would create at the current
node.vars
- An array of length at least getNbranches()
of arrays, where the variables for each branch will be
stored.
vars[i]
will contain an array with the
list of variables used for branch i
.bounds
- An array of length at least getNbranches()
of arrays
where the bound values for each branch will be stored.
bounds[i]
will contain an array with the
list of
new bounds used for branch i
. One bound
of variable
vars[i][j]
will be set to
bounds[i][j]
for all possible
pairs i, j
.bounds
- An array of length at least getNbranches()
of arrays
where the branch directions for each branch will be stored.
dirs[i] will contain an array with the list of branch
directions used for branch i
. If
dirs[i][j]
is
IloCplex.BranchDirection.Up
the lower
bound of variable
vars[i][j]
will be set to
bounds[i][j]
for all possible
pairs i, j
. Similarly, if
dirs[i][j]
is
IloCplex.BranchDirection.Down
the upper
bound of variable
vars[i][j]
will be set to
bounds[i][j]
for all possible
pairs i, j
.protected IloCplex.NodeId makeBranch(IloNumVar[] vars, double[] bounds, IloCplex.BranchDirection[] dirs, double objestimate) throws IloException
IloCplex
. It can be called zero, one, or two
times in every invocation of the branch callback. If you call it once,
it creates one node; it you call it twice, it creates two nodes (one
node at each call). If you call it more than twice, it throws an
exception.
Each call specifies a branch; in other words, it tells how to create a
subnode from the current node by specifying new, tighter bounds for a
set of variables. The variables used to specify a branch must not have
been presolved out. That is, calling getFeasibility
must
not return ImpliedFeasible
.
vars
contains the variables for which
new bounds will be set in the branch.
bounds
contains the new bounds for the
variables listed in vars
; that is, bounds[j]
is the new bound for vars[j]
.
dirs
indicates the branching direction
for the variables in vars
.
dir[j] == BranchUp
bounds[j]
specifies a lower bound for
vars[j]
.
dirs[j] == BranchDown
bounds[j]
specifies an upper bound for
vars[j]
.
objestimate
provides an estimate of the
resulting optimal objective value for the subnode specified by this
branch. The invoking instance of IloCplex
may use this
estimate to select nodes to process. Providing a wrong estimate will
not influence the correctness of the solution, but it may influence
performance. Using the objective value of the current node is usually a
safe choice.vars
- The array of variables for which new bounds will be set in
the branch.bounds
- The array of new bounds for the variables corresponding to
the variables in vars
.dirs
- The array of branching directions for the variables in
vars
.objestimate
- An estimate of the objective value at the subnode
specified by this branch.protected IloCplex.NodeId makeBranch(IloNumVar var, double bound, IloCplex.BranchDirection dir, double objestimate) throws IloException
IloCplex
at variable var
.
It can be called zero, one, or two
times in every invocation of the branch callback. If you call it once,
it creates one node; it you call it twice, it creates two nodes (one
node at each call). If you call it more than twice, it throws an
exception.
Each call specifies a branch; in other words, it tells how to create a
subnode from the current node by specifying new, tighter bounds for a
set of variables. The variables used to specify a branch must not have
been presolved out. That is, calling getFeasibility
must
not return ImpliedFeasible
.
var
contains the variable for which
new bound will be set in the branch.
bound
is the new bound for the
variable var
.
dir
indicates the branching direction
for the variable var
.
dir == BranchUp
bound
specifies a lower bound for
var
.
dir == BranchDown
bound
specifies an upper bound for
var
.
objestimate
provides an estimate of the
resulting optimal objective value for the subnode specified by this
branch. The invoking instance of IloCplex
may use this
estimate to select nodes to process. Providing a wrong estimate will
not influence the correctness of the solution, but it may influence
performance. Using the objective value of the current node is usually a
safe choice.var
- The variable for which a new bound will be set in
the branch.bounds
- The new bound for the variable var
.dirs
- The branching direction for the variable
var
.objestimate
- An estimate of the objective value at the subnode
specified by this branch.protected void prune()
prune
and code>makeBranch in one invocation of a
callback.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |