Overview | Group | Tree | Graph | Index | Concepts |
An instance of the class IloCplex::BranchCallbackI
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 & 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.
BranchCallbackI::prune
removes the
current node from the search tree. No subnodes from the current node will be
added to the search tree.BranchCallbackI::makeBranch
tells an
instance of IloCplex
how to create a subproblem. You may call
this method 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).IloCplex::BranchCallBackI::prune
nor IloCplex::BranchCallBackI::makeBranch
,
the instance of IloCplex
proceeds
with its own selection.IloCplex::BranchCallBackI::prune
and
IloCplex::BranchCallBackI::makeBranch
in one invocation
of a branch callback is an error and results in unspecified behavior.The methods of this class are 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:
ILOBRANCHCALLBACK0, IloCplex::BranchDirection, IloCplex::Callback, IloCplex::CallbackI, IloCplex::MIPCallbackI, IloCplex::ControlCallbackI
Constructor Summary | |
---|---|
protected | BranchCallbackI() |
Method Summary | |
---|---|
protected IloNum | getBranch(IloNumVarArray, IloNumArray, IloCplex::BranchDirectionArray, IloInt) |
protected BranchCallbackI::BranchType | getBranchType() |
protected IloInt | getNbranches() |
protected NodeId | getNodeId() |
protected IloBool | isIntegerFeasible() |
protected NodeId | makeBranch(const IloConstraintArray, const IloIntVarArray, const IloNumArray, const IloCplex::BranchDirectionArray, IloNum, NodeData *) |
protected NodeId | makeBranch(const IloConstraintArray, const IloNumVarArray, const IloNumArray, const IloCplex::BranchDirectionArray, IloNum, NodeData *) |
protected NodeId | makeBranch(const IloConstraint, IloNum, NodeData *) |
protected NodeId | makeBranch(const IloConstraintArray, IloNum, NodeData *) |
protected NodeId | makeBranch(const IloIntVar, IloNum, IloCplex::BranchDirection, IloNum, NodeData *) |
protected NodeId | makeBranch(const IloNumVar, IloNum, IloCplex::BranchDirection, IloNum, NodeData *) |
protected NodeId | makeBranch(const IloIntVarArray, const IloNumArray, const IloCplex::BranchDirectionArray, IloNum, NodeData *) |
protected NodeId | makeBranch(const IloNumVarArray, const IloNumArray, const IloCplex::BranchDirectionArray, IloNum, NodeData *) |
protected void | prune() |
Inherited Methods from CallbackI |
---|
abort, duplicateCallback, getEnv, getModel, getNcols, getNQCs, getNrows, main |
Inner Enumeration |
---|
BranchCallbackI::BranchType |
Constructor Detail |
---|
This constructor creates a branch callback, that is, a control callback for splitting a node into two branches.
Method Detail |
---|
This method accesses branching information for the i-th branch
that the invoking instance of IloCplex
is about to create. The parameter i
must be between 0
(zero) and (getNbranches - 1)
; that is, it must be a valid
index of a branch; normally, it will be zero or one.
A branch is normally defined by a set of variables and the bounds for these variables. Branches that are more complex cannot be queried. The return value is the node estimate for that branch.
vars
contains the variables for which
new bounds will be set in the i
-th 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] == IloCplex::BranchUp
means that bounds[j]
specifies a lower bound for
vars[j]
.
dirs[j] == IloCplex::BranchDown
means that bounds[j]
specifies an upper bound for
vars[j]
.
This method returns the type of branching IloCplex
is going to do for the current node.
This method returns the number of branches IloCplex
is going to create at the current node.
Returns the NodeId
of the current node.
This method returns IloTrue
if the solution of the
current node is integer feasible.
This method offers the same facilities as the other methods
IloCplex::BranchCallbackI::makeBranch
, but for a branch
specified by a set of constraints and a set of variables.
This method offers the same facilities as the other methods
IloCplex::BranchCallbackI::makeBranch
, but for a branch
specified by a set of constraints and a set of variables.
This method offers the same facilities for a branch
specified by only one constraint as
IloCplex::BranchCallbackI::makeBranch
does for a
branch specified by a set of constraints.
This method overrides the branch chosen by an instance of
IloCplex
, by specifying a branch on
constraints. A method named
makeBranch
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.
cons
specifies an array of constraints
that are to be added for the subnode being created.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 he solution, but it
may influence performance. Using the objective value of the current
node is usually a safe choice.data
allows you to add an object of type
IloCplex::MIPCallbackI::NodeData
to the node representing
the branch created by the makeBranch
call. Such
data objects must be instances of a user-written subclass of
IloCplex::MIPCallbackI::NodeData
.For a branch specified by only one variable, this method offers
the same facilities as
IloCplex::BranchCallbackI::makeBranch
for a branch specified
by a set of variables.
For a branch specified by only one variable, this method offers
the same facilities as
IloCplex::BranchCallbackI::makeBranch
for a branch specified
by a set of variables.
This method overrides the branch chosen by an instance of
IloCplex
. A method named
makeBranch
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 instructs the
invoking IloCplex
object how to create a subnode from
the current node by specifying new, tighter bounds for a set of
variables.
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 to be set for vars[j]
.dirs
indicates the branching direction
for the variables in vars
. dir[j] == IloCplex::BranchUp
means that bounds[j]
specifies a lower bound for
vars[j]
.
dirs[j] == IloCplex::BranchDown
means that 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 he solution, but it
may influence performance. Using the objective value of the current
node is usually a safe choice.data
allows you to add an object of type
IloCplex::MIPCallbackI::NodeData
to the node representing
the branch created by the makeBranch
call. Such
data objects must be instances of a user-written subclass of
IloCplex::MIPCallbackI::NodeData
.This method overrides the branch chosen by an instance of
IloCplex
. A method named
makeBranch
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 instructs the
invoking IloCplex
object how to create a subnode from
the current node by specifying new, tighter bounds for a set of
variables.
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 to be set for vars[j]
.dirs
indicates the branching direction
for the variables in vars
. dir[j] == IloCplex::BranchUp
means that bounds[j]
specifies a lower bound for
vars[j]
.
dirs[j] == IloCplex::BranchDown
means that 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 he solution, but it
may influence performance. Using the objective value of the current
node is usually a safe choice.data
allows you to add an object of type
IloCplex::MIPCallbackI::NodeData
to the node representing
the branch created by the makeBranch
call. Such
data objects must be instances of a user-written subclass of
IloCplex::MIPCallbackI::NodeData
.By calling this method, you instruct the CPLEX branch & cut
search not to create any child nodes from the current node, or, in
other words, to discard nodes below the current node; it does not
revisit the discarded nodes below the current node. In short, it
creates no branches. It is an error to call both prune
and makeBranch
in one invocation of a callback.
Inner Enumeration Detail |
---|
IloCplex::BranchCallbackI::BranchType
is an enumeration
limited in scope to the class IloCplex::BranchCallbackI
. This enumeration is used by the
method IloCplex::BranchCallbackI::getBranchType
to tell what
kind of branch IloCplex
is about to do:
BranchOnVariable
indicates branching on a single variable.
BranchOnAny
indicates multiple bound changes and constraints
will be used for branching.
BranchOnSOS1
indicates branching on an SOS of type 1.
BranchOnSOS2
indicates branching on an SOS of type 2.See Also:
Fields |
---|
BranchOnVariable |
= CPX_TYPE_VAR
|
BranchOnSOS1 |
= CPX_TYPE_SOS1
|
BranchOnSOS2 |
= CPX_TYPE_SOS2
|
BranchOnAny |
= CPX_TYPE_ANY
|
UserBranch |