Branch and bound
Branch-and-bound is a method for solving optimization problems by breaking them down into smaller subproblems and using a bounding function to eliminate subproblems that cannot contain the optimal solution.
It is an algorithm design paradigm for discrete and combinatorial optimization problems, as well as mathematical optimization. A branch-and-bound algorithm consists of a systematic enumeration of candidate solutions by means of state-space search: the set of candidate solutions is thought of as forming a rooted tree with the full set at the root.
The algorithm explores branches of this tree, which represent subsets of the solution set. Before enumerating the candidate solutions of a branch, the branch is checked against upper and lower estimated bounds on the optimal solution, and is discarded if it cannot produce a better solution than the best one found so far by the algorithm.
The algorithm depends on efficient estimation of the lower and upper bounds of regions/branches of the search space. If no bounds are available, then the algorithm degenerates to an exhaustive search.
The method was first proposed by Ailsa Land and Alison Doig whilst carrying out research at the London School of Economics sponsored by British Petroleum in 1960 for discrete programming, and has become the most commonly used tool for solving NP-hard optimization problems. The name "branch and bound" first occurred in the work of Little et al. on the traveling salesman problem.
Overview
The goal of a branch-and-bound algorithm is to find a value that maximizes or minimizes the value of a real-valued function, called an objective function, among some set of admissible or candidate solutions. The set is called the search space, or feasible region. The rest of this section assumes that minimization of is desired; this assumption comes without loss of generality, since one can find the maximum value of by finding the minimum of. A B&B algorithm operates according to two principles:- It recursively splits the search space into smaller spaces, then minimizes on these smaller spaces; the splitting is called branching.
- Branching alone would amount to brute-force enumeration of candidate solutions and testing them all. To improve on the performance of brute-force search, a B&B algorithm keeps track of bounds on the minimum that it is trying to find, and uses these bounds to "prune" the search space, eliminating candidate solutions that it can prove will not contain an optimal solution.
- produces two or more instances that each represent a subset of.
- computes a lower bound on the value of any candidate solution in the space represented by, that is, for all in.
- determines whether represents a single candidate solution. If returns a solution, then provides an upper bound for the optimal objective value over the whole space of feasible solutions.
Generic version
The following is the skeleton of a generic branch-and-bound algorithm for minimizing an arbitrary objective function. To obtain an actual algorithm from this, one requires a bounding function, that computes lower bounds of on nodes of the search tree, as well as a problem-specific branching rule. As such, the generic algorithm presented here is a higher-order function.- Using a heuristic, find a solution to the optimization problem. Store its value,. will denote the best solution found so far, and will be used as an upper bound on candidate solutions.
- Initialize a queue to hold a partial solution with none of the variables of the problem assigned.
- Loop until the queue is empty:
- # Take a node off the queue.
- # If represents a single candidate solution and, then is the best solution so far. Record it and set.
- # Else, branch on to produce new nodes. For each of these:
- ## If, do nothing; since the lower bound on this node is greater than the upper bound of the problem, it will never lead to the optimal solution, and can be discarded.
- ## Else, store on the queue.
Examples of best-first search algorithms with this premise are Dijkstra's algorithm and its descendant A* search. The depth-first variant is recommended when no good heuristic is available for producing an initial solution, because it quickly produces full solutions, and therefore upper bounds.
Pseudocode
A C++-like pseudocode implementation of the above is:// C++-like implementation of branch and bound,
// assuming the objective function f is to be minimized
CombinatorialSolution branch_and_bound_solve
In the above pseudocode, the functions
heuristic_solve and populate_candidates called as subroutines must be provided as applicable to the problem. The functions and are treated as function objects as written, and could correspond to lambda expressions, function pointers, and other types of callable objects in the C++ programming language.Improvements
When is a vector of, branch-and-bound algorithms can be combined with interval analysis and contractor techniques to provide guaranteed enclosures of the global minimum.Applications
This approach is used for a number of NP-hard problems:- Integer programming
- Nonlinear programming
- Travelling salesman problem
- Quadratic assignment problem
- Maximum satisfiability problem
- Nearest neighbor search
- Flow shop scheduling
- Cutting stock problem
- Computational phylogenetics
- Set inversion
- Parameter estimation
- 0/1 knapsack problem
- Set cover problem
- Feature selection in machine learning
- Structured prediction in computer vision
- Arc routing problem, including the Chinese Postman problem
- Talent Scheduling, scenes-shooting arrangement problem
Relation to other algorithms
Nau et al. present a generalization of branch and bound that also subsumes the A*, B* and alpha-beta search algorithms.Optimization example
Branch-and-bound can be used maximize with the constraintsThe first step is to relax the integer constraint. We have two extreme points for the first equation that form a line: and. We can form the second line with the vector points and.
and are integers.
The third point is. This is a convex hull region, so the solution lies on one of the vertices of the region. We can find the intersection using row reduction, which is with a value of 276 + 2/3. We test the other endpoints by sweeping the line over the region and find this is the maximum over the reals.
We choose the variable with the maximum fractional part, in this case becomes the parameter for the branch and bound method. We branch to and obtain 276 at. We have reached an integer solution so we move to the other branch. We obtain 275.75 at. We have a decimal, so we branch to and we find 274.571 at. We try the other branch and there are no feasible solutions. Therefore, the maximum is 276 with and.