Quiz 2

🌿 Branch & Bound

536 words
3 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# 🌿 Branch & Bound ## 1. 🎯 Learning Objectives - Trace Branch & Bound search tree for TSP - Compute lower bounds for partial tours - Apply permanent exclusion rules in TSP-BnB - Explain the B&B node expansion order - Compare B&B with A* and brute force ## 2.

🌿 Branch & Bound

1. 🎯 Learning Objectives

  • Trace Branch & Bound search tree for TSP
  • Compute lower bounds for partial tours
  • Apply permanent exclusion rules in TSP-BnB
  • Explain the B&B node expansion order
  • Compare B&B with A* and brute force

2. 📖 Core Content

3.1 Intuition: Pruning with Bounds

Branch & Bound (B&B) systematically explores candidates while using lower bounds to prune unpromising branches. If the lower bound of a partial solution exceeds the current best complete solution, that branch cannot yield a better solution — prune it. B&B for minimization:
  • Branch: Generate subproblems (partial solutions)
  • Bound: Compute lower bound on solution cost
  • Prune: If bound ≥ current best, discard branch

3.2 B&B Algorithm

text
BranchAndBound(initial):
    best_solution = null
    best_cost = infinity
    OPEN = [initial_partial_solution]
    while OPEN is not empty:
        node = select_node(OPEN)  // Usually best-bound-first
        bound = lower_bound(node)
        if bound >= best_cost:
            continue  // Prune
        if node is complete solution:
            if cost(node) < best_cost:
                best_cost = cost(node)
                best_solution = node
        else:
            children = branch(node)
            for child in children:
                if lower_bound(child) < best_cost:
                    OPEN.add(child)
    return best_solution

3.3 TSP-BnB: Lower Bounds

For TSP, a lower bound for a partial tour can be computed using reduced cost matrix:
  1. Row reduction: Subtract minimum value from each row
  2. Column reduction: Subtract minimum value from each column (after row reduction)
  3. Lower bound = sum of all reductions + existing tour cost Example: Distance matrix for 5 cities:
pseudo
[∞, 20, 30, 10, 11]
[15, ∞, 16, 4, 2]
[3, 5, ∞, 2, 4]
[19, 6, 18, ∞, 3]
[16, 4, 7, 16, ∞]
Row minima: row 0=10, row 1=2, row 2=2, row 3=3, row 4=4 After row reduction + column reduction of resulting matrix → total reduction = LB

3.4 Permanent Exclusion Rules

When an edge (i,j) is permanently excluded:
  • Row i and column j can be eliminated from consideration
  • The excluded edge's cost is set to ∞ in the matrix
  • This prevents revisiting cities

3.5 B&B Trace for TSP

Starting from city 0, expanding partial tours: Level 0: Root (no edges). LB = total reduction of full matrix. Level 1: Branches for each possible first edge (0,1), (0,2), (0,3), (0,4). Compute LB for each. Select node with smallest LB. Level 2: From selected node, branch on next edge from current city. Continue until complete tour found.

4. 📐 Key Formulas

ConceptFormula
Row reductionminjd(i,j)\min_j d(i,j) subtracted from each row
Column reductionminid(i,j)\min_i d(i,j) subtracted from each column
Lower boundSum of all reductions
Pruning conditionLBbestcostLB \geq best_cost

5. 📝 Practice Questions

Q1: In B&B for TSP, what happens when lower bound exceeds the current best?
Answer: The branch is pruned — it cannot yield a better solution than the one already found. This is the "bound" part of Branch & Bound. Q2: Why might B&B visit exponentially many nodes in worst case?
Answer: If the lower bound is weak (much lower than actual cost), few branches are pruned. The worst case is exploring the entire search tree, which has O((n-1)!) nodes for TSP. Join Discord PreviousAnt Colony OptimizationNextAdmissibility & Consistency
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.