NO FRAMES

Class IloCplex::BranchCallbackI

Definition file: ilocplexi.h
Include files: ilcplex/ilocplex.h

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.

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:

Constructor Summary
protected BranchCallbackI()
Method Summary
protected IloNumgetBranch(IloNumVarArray, IloNumArray, IloCplex::BranchDirectionArray, IloInt)
protected BranchCallbackI::BranchTypegetBranchType()
protected IloIntgetNbranches()
protected NodeIdgetNodeId()
protected IloBoolisIntegerFeasible()
protected NodeIdmakeBranch(const IloConstraintArray, const IloIntVarArray, const IloNumArray, const IloCplex::BranchDirectionArray, IloNum, NodeData *)
protected NodeIdmakeBranch(const IloConstraintArray, const IloNumVarArray, const IloNumArray, const IloCplex::BranchDirectionArray, IloNum, NodeData *)
protected NodeIdmakeBranch(const IloConstraint, IloNum, NodeData *)
protected NodeIdmakeBranch(const IloConstraintArray, IloNum, NodeData *)
protected NodeIdmakeBranch(const IloIntVar, IloNum, IloCplex::BranchDirection, IloNum, NodeData *)
protected NodeIdmakeBranch(const IloNumVar, IloNum, IloCplex::BranchDirection, IloNum, NodeData *)
protected NodeIdmakeBranch(const IloIntVarArray, const IloNumArray, const IloCplex::BranchDirectionArray, IloNum, NodeData *)
protected NodeIdmakeBranch(const IloNumVarArray, const IloNumArray, const IloCplex::BranchDirectionArray, IloNum, NodeData *)
protected voidprune()
Inherited Methods from ControlCallbackI
getDownPseudoCost, getDownPseudoCost, getFeasibilities, getFeasibilities, getFeasibility, getFeasibility, getFeasibility, getFeasibility, getLB, getLB, getLBs, getLBs, getNodeData, getObjValue, getSlack, getSlacks, getUB, getUB, getUBs, getUBs, getUpPseudoCost, getUpPseudoCost, getValue, getValue, getValue, getValues, getValues, isSOSFeasible, isSOSFeasible
Inherited Methods from MIPCallbackI
getBestObjValue, getCutoff, getDirection, getDirection, getIncumbentObjValue, getIncumbentValue, getIncumbentValue, getIncumbentValues, getIncumbentValues, getMyThreadNum, getNcliques, getNcovers, getNdisjunctiveCuts, getNflowCovers, getNflowPaths, getNfractionalCuts, getNGUBcovers, getNimpliedBounds, getNiterations, getNMIRs, getNnodes, getNremainingNodes, getObjCoef, getObjCoef, getObjCoefs, getObjCoefs, getPriority, getPriority, getUserThreads, hasIncumbent
Inherited Methods from CallbackI
abort, duplicateCallback, getEnv, getModel, getNcols, getNQCs, getNrows, main
Inner Enumeration
BranchCallbackI::BranchType
Constructor Detail

BranchCallbackI

protected BranchCallbackI()

This constructor creates a branch callback, that is, a control callback for splitting a node into two branches.


Method Detail

getBranch

protected IloNum getBranch(IloNumVarArray vars, IloNumArray bounds, IloCplex::BranchDirectionArray dirs, IloInt i)

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.

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].


getBranchType

protected BranchCallbackI::BranchType getBranchType()

This method returns the type of branching IloCplex is going to do for the current node.


getNbranches

protected IloInt getNbranches()

This method returns the number of branches IloCplex is going to create at the current node.


getNodeId

protected NodeId getNodeId()

Returns the NodeId of the current node.


isIntegerFeasible

protected IloBool isIntegerFeasible()

This method returns IloTrue if the solution of the current node is integer feasible.


makeBranch

protected NodeId makeBranch(const IloConstraintArray cons, const IloIntVarArray vars, const IloNumArray bounds, const IloCplex::BranchDirectionArray dirs, IloNum objestimate, NodeData * data)

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.


makeBranch

protected NodeId makeBranch(const IloConstraintArray cons, const IloNumVarArray vars, const IloNumArray bounds, const IloCplex::BranchDirectionArray dirs, IloNum objestimate, NodeData * data)

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.


makeBranch

protected NodeId makeBranch(const IloConstraint con, IloNum objestimate, NodeData * data)

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.


makeBranch

protected NodeId makeBranch(const IloConstraintArray cons, IloNum objestimate, NodeData * data)

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.


makeBranch

protected NodeId makeBranch(const IloIntVar var, IloNum bound, IloCplex::BranchDirection dir, IloNum objestimate, NodeData * data)

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.


makeBranch

protected NodeId makeBranch(const IloNumVar var, IloNum bound, IloCplex::BranchDirection dir, IloNum objestimate, NodeData * data)

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.


makeBranch

protected NodeId makeBranch(const IloIntVarArray vars, const IloNumArray bounds, const IloCplex::BranchDirectionArray dirs, IloNum objestimate, NodeData * data)

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.

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].


makeBranch

protected NodeId makeBranch(const IloNumVarArray vars, const IloNumArray bounds, const IloCplex::BranchDirectionArray dirs, IloNum objestimate, NodeData * data)

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.

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].


prune

protected void prune()

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

Enumeration BranchType

Definition file: ilocplexi.h
Include files: ilcplex/ilocplex.h

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:

See Also:

Fields
BranchOnVariable
= CPX_TYPE_VAR
BranchOnSOS1
= CPX_TYPE_SOS1
BranchOnSOS2
= CPX_TYPE_SOS2
BranchOnAny
= CPX_TYPE_ANY
UserBranch