ArticleslgStudy

computer science

Branch and bound

Branch and bound is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Branch and bound rather than just read about it. In short: Branch-and-bound (BB, B&B, or BnB) 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.

Branch and bound — main illustration
Branch and bound — illustration

Key takeaways

  • Branch and bound belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Branch and bound to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Branch and bound from memory before moving on to harder problems.

Reference excerpt

Branch-and-bound (BB, B&B, or BnB) 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 x that maximizes or minimizes the value of a real-valued function f(x), called an objective function, among some set S of admissible or candidate solutions. The set S is called the search space, or feasible region. The rest of this section assumes that minimization of f(x) is desired; this assumption comes without loss of generality, since one can find the maximum value of f(x) by finding the minimum of g(x) = −f(x). A B&B algorithm operates according to two principles:

It recursively splits the search space into smaller spaces, then minimizes f(x) 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. Turning these principles into a concrete algorithm for a specific optimization problem requires some kind of data structure that represents sets of candidate solutions. Such a representation is called an instance of the problem. Denote the set of candidate solutions of an instance I by SI. The instance representation has to come with three operations:

branch(I) produces two or more instances that each represent a subset of SI. (Typically, the subsets are disjoint to prevent the algorithm from visiting the same candidate solution twice, but this is not required. However, an optimal solution among SI must be contained in at least one of the subsets.) bound(I) computes a lower bound on the value of any candidate solution in the space represented by I, that is, bound(I) ≤ f(x) for all x in SI. solution(I) determines whether I represents a single candidate solution. (Optionally, if it does not, then the operation may choose to return some feasible solution from among SI.) If solution(I) returns a solution, then f(solution(I)) provides an upper bound for the optimal objective value over the whole space of feasible solutions. Using these operations, a B&B algorithm performs a top-down recursive search through the tree of instances formed by the branch operation. Upon visiting an instance I, it checks whether bound(I) is equal to or greater than the current upper bound; if so, I may be safely discarded from the search and the recursion stops. This pruning step is usually implemented by maintaining a global variable that records the minimum upper bound seen among all instances examined so far.

Generic version The following is the skeleton of a generic branch-and-bound algorithm for minimizing an arbitrary objective function f. To obtain an actual algorithm from this, one requires a bounding function bound, that computes lower bounds of f on nodes of the search tree, as well as a problem-specific branching rule.

Using a heuristic, find a solution xh to the optimization problem. Store its value, B = f(xh). (If no heuristic is available, set B to infinity.) B 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 N off the queue. If N represents a single candidate solution x and f(x) < B, then x is the best solution so far. Record it and set B ← f(x). The same can be done with a heuristic whenever the node does not identify a unique solution. Else, branch on N to produce new nodes Ni. Add all feasible nodes for which bound(Ni) < B to the queue. The remaining nodes, having a lower bound greater than or equal to the upper bound of the problem, will never lead to the optimal solution and are discarded. Several different queue data structures can be used. A stack (LIFO queue) will yield a depth-first algorithm. A best-first branch-and-bound algorithm can be obtained by using a priority queue that sorts nodes on their lower bounds. 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.

Improvements When 𝐱 is a vector of ℝn, 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:

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Branch and bound

Start with the simplest possible case. Write down what Branch and bound claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Branch and bound before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Branch and bound ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Branch and bound

In research
Branch and bound appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Branch and bound in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Branch and bound is common in secondary-school and first-year university syllabi. It links to neighbouring topics Combinatorial optimization, Optimization algorithms and methods, so understanding it makes those chapters shorter.
In everyday life
Look for Branch and bound outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Branch and bound” →

How to study Branch and bound in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Branch and bound means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Branch and bound out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Branch and bound in simple terms?

Branch-and-bound (BB, B&B, or BnB) 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 optimiza…

Why does Branch and bound matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Branch and bound?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Branch and bound.

Tags

  • Combinatorial optimization
  • Optimization algorithms and methods

Keep exploring