Base class for user-written callbacks that control branching.

Namespace: ILOG.CPLEX
Assembly: ILOG.CPLEX (in ILOG.CPLEX.dll) Version: 22.1.1.0

Syntax

C#
public abstract class BranchCallback : Cplex..::..ControlCallback
Visual Basic
Public MustInherit Class BranchCallback _
	Inherits Cplex..::..ControlCallback

Remarks

This is an advanced class.

Important:

Advanced classes typically demand a profound understanding of the algorithms used by CPLEX. Thus they incur a higher risk of incorrect behavior in your application, behavior that can be difficult to debug. Therefore, the team 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 control branching during the branch-and-cut search. This callback will be called prior to the creation of the children of the current node. It allows you to query how the invoking instance of Cplex is about to create the children, and gives you the opportunity to override creation of this branch.

You can create one or two branches by calling one of the makeBranch methods once or twice. It is an error to call that method more than twice.

By calling method prune, you remove the current node from the search tree. In other words, no subnodes from the current node will be added to the search tree. Calling both prune and makeBranch in one invocation of a branch callback is an error and yields unspecified behavior.

If you call neither prune nor makeBranch, the instance of Cplex proceeds with its own branching.

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.

The user must be careful when using this class. Pruning a valid node can prune the optimal solution. Also, choosing a different branching variable can result in placing an invalid bound on a variable.

In particular, the user must not branch on variables that are implied feasible, as defined in Cplex.IntegerFeasibilityStatus. Implied feasible means that the variable has been presolved out. It will be feasible when all other integer variables are feasible. Branching on such variables can cut off feasible solutions.

If the user intends to branch on continuous variables, the user must disable dual presolve reductions. To disable dual presolve reductions, set the parameter to control primal and dual reduction type, Cplex.Param.Preprocessing.Reduce, either to the value 1 (one) (that is, CPX_PREREDUCE_PRIMALONLY) or to the value 0 (zero) (that is, CPX_PREREDUCE_NOPRIMALORDUAL).

Also, if the user intends to branch on continuous variables, the user must turn off the linear reduction switch, Cplex.Param.Preprocessing.Linear.

By design, the CPLEX branch callback calculates and provides the branching decisions that CPLEX would make in case the user does not create any branches in the callback. Depending on variable selection and other features of your model, the computation of these candidate branches can be time-consuming. Consequently, if you know that you will never use the branching candidates suggested by CPLEX, then you can save time by disabling such features as strong branching.

Inheritance Hierarchy

System..::..Object
  ILOG.CPLEX..::..Cplex..::..Callback
    ILOG.CPLEX..::..Cplex..::..OptimizationCallback
      ILOG.CPLEX..::..Cplex..::..MIPInfoCallback
        ILOG.CPLEX..::..Cplex..::..MIPCallback
          ILOG.CPLEX..::..Cplex..::..ControlCallback
            ILOG.CPLEX..::..Cplex..::..BranchCallback

See Also