Trees | Indices | Help |
|
---|
|
Subclassable class for branch callback classes.
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. ImpliedFeasible specifies that the variable has been presolved out. It will be feasible when all other integer variables are integer 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, parameters.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, parameters.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. This callback will be used prior to branching at a node in the branch and cut tree.
Nested Classes | |
branch_type Constants defining types of branches. |
|
Inherited from Inherited from |
Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from Inherited from Inherited from Inherited from |
Properties | |
Inherited from |
Method Details |
Returns one of the candidate branches at the current node. which_branch must be an integer such that 0 <= which_branch < self.get_num_branches(). The return value of get_branch is a tuple t with two entries. The first entry is the node estimate for the specified branch. The second entry is a list of (var, dir, bnd) triples, where var is the index of a variable whose bound will change, bnd is the new bound, and dir is one of "L", "U", and "B", indicating that the branch will change the lower bound, the upper bound, or both, respectively. |
Returns the type of the branch. One of the following: self.branch_type.any self.branch_type.SOS1 self.branch_type.SOS2 self.branch_type.variable |
Makes a new branch with the specified data. objective_estimate is a float representing the estimated objective value resulting from the specified branch. variables is a sequence of (var, dir, bnd) triples specifying the variables on which to branch. var must be an index of a variable, dir must be one of "L" and "U", indicating that the bound is a lower or upper bound, respectively, and bnd is an integer specifying the new bound for the variable. constraints is a sequence of (vec, sense, rhs) triples specifying the constraints with which to branch. vec must be either an instance of SparsePair or a sequence with two entries, the first of which specifies the indices and the second of which specifies the values of the constraint. rhs must be a float determining the righthand side of the constraint. sense must be one of "L", "G", or "E", specifying whether the constraint is a less-than, greater-than, or equality constraint. node_data may be any object to be associated with the created node. It can be queried by the get_node_data methods of the IncumbentCallback class and the NodeCallback class. |
Replicates a CPLEX branch. The function replicates the n-th branch that CPLEX would create at the current node. The purpose of this function is to branch exactly like CPLEX, but at the same time attach a user object to the newly created node. which_branch must be an integer such that 0 <= which_branch < self.get_num_branches(). node_data may be any object to be associated with the created node. It can be queried by the get_node_data methods of various callback classes. The function returns the sequence number of the newly created node. |
Removes the current node from the search tree.
|
Trees | Indices | Help |
|
---|