Professional Documents
Culture Documents
Lect 7 B&B Strategy
Lect 7 B&B Strategy
Computing
Lecture 7
Branch & Bound Strategy
(Draft)
1
Lecture Outline
◼ Branch-and-Bound Strategy.
2
The Branch-and-Bound Strategy (B&B)
◼ This strategy can be used to solve optimization problems
without an exhaustive search in the average case.
◼ Using B&B to avoid n! exhaustive search technique on the
average case. (O(n!)>O(2n)).
◼ 2 mechanisms:
◼ A mechanism to generate branches when searching the
solution space
◼ A mechanism to generate a bound so that many branches
can be terminated
◼ It is efficient in the average case because many branches can
be terminated very early.
◼ Although it is usually very efficient, a very large tree may be
generated in the worst case.
3
The Basic Idea of B&B
4
Traveling Salesman Problem (TSP)
• Given a graph, the TSP Optimization problem is to find a tour, starting from
any vertex, visiting every other vertex and returning to the starting vertex,
with minimal cost.
TSP Applications:
❑ Transportation routing.
◼ It’s not likely anyone would want to plan a bike trip to 25 cities
◼ But the solution of several important “real world” problems is the
same as finding a tour of a large number of cities
◼ From A he goes to B
A 2 B 4 C ◼ From B he goes to D
◼ This is not going to result in a
shortest path!
3 3
4 4 ◼ The best result he can get now
will be ABDBCE, at a cost of 16
◼ An actual least-cost path from A
D is ADBCE, at a cost of 14
E
8
TSP Optimization Problem
j 1 2 3 4 5 6 7
i
1 ∞ 3 93 13 33 9 57
2 4 ∞ 77 42 21 16 34
3 45 17 ∞ 36 16 28 25
4 39 90 80 ∞ 56 7 91
5 28 46 88 33 ∞ 25 57
6 3 88 18 46 92 ∞ 7
7 44 26 33 27 84 39 ∞
9
Traveling Salesperson Optimization Problem
j 1 2 3 4 5 6 7 to j
i
1 ∞ 3 93 13 33 9 57
2 4 ∞ 77 42 21 16 34
3 45 17 ∞ 36 16 28 25
4 39 90 80 ∞ 56 7 91
from i
5 28 46 88 33 ∞ 25 57
6 3 88 18 46 92 ∞ 7
7 44 26 33 27 84 39 ∞
10
Traveling Salesperson Optimization Problem
11
TSP Optimization Problem
j 1 2 3 4 5 6 7
i
1 ∞ 0 83 9 30 6 50
2 0 ∞ 66 37 17 12 26
3 29 1 ∞ 19 0 12 5
4 32 83 66 ∞ 49 0 80
5 3 21 56 7 ∞ 0 28
6 0 85 8 42 89 ∞ 0
7 18 0 0 0 58 13 ∞
(-7) (-1) (-4)
◼ Lower bound: The total cost of 84+12=96 is subtracted.
◼ Thus, we know the lower bound of feasible solutions to this TSP
problem is 96.
12
TSP Example (B&B Strategy)
13
TSP Example (Brute Force Strategy)
14
Hamiltonian Circuits Problem
A Hamiltonian circuit or tour of a graph is a path that starts at a given vertex, visits
each vertex in the graph exactly once, and ends at the starting vertex.
A route returning to the beginning is known as a Hamiltonian Circuit
Some graphs do not contain Hamiltonian circuits.
A route not returning to the beginning is known as a Hamiltonian Path
v1 v2 v3 v1 v2 v3
v4 v5 v6 v4 v5 v6
A state space tree for this problem is as follows:
Put the starting vertex at level 0 in the tree, call this the zero'th vertex on the path.
At level 1, consider each vertex other than the starting vertex as the first vertex after the
starting one.
At level 2, consider each of these vertices as the second vertex, and so on. You may now
backtrack in this state space tree.
State Space Tree
2 5
v5 v6 v7 v8
graph
5 7 2 6
6 7 3
3 4 8 :
:
3 8 4
:
:
Example: Identifying Hamilton Circuits
Refer to the graph below. Which of the following are Hamilton circuits?
a) A → B → E → D → C → F → A
b) A → B → C → D → E → F → C →
E→B→F→A B C D
c) B → C → D → E → F → B
Solution A F E
a) It is a Hamilton circuit for the graph.
b) It is not a Hamilton circuit since it visits B more than once.
c) It is not a Hamilton circuit since it does not visit all the vertices.
• Any complete graph with three of more vertices has a Hamilton circuit.
• A complete graph with n vertices has (n – 1)! Hamilton circuits.
• The Hamilton circuits that differ only in their starting points will be considered
to be the same circuit.
• In a weighted graph, a minimum Hamilton circuit is a Hamilton circuit with
the smallest possible weight.
Brute Force Algorithm
D C
3
Solution: Weight of circuit
1. A →B→C→D→A 14
2. A→B→D→C→A 12 Min.
3. A→C→B→D→A 14
4. A→C→D→B→A 12 (opposite of 2)
5. A→D→B→C→A 14 (opposite of 3)
6. A→D→C→B→A 14 (opposite of 1)
Nearest Neighbor Algorithm
Step 1: Choose a starting point, call this vertex A.
Step 3: At each vertex you reach, check the edges from there to
vertices not yet visited.
Choose the smallest weight.
Proceed along this edge to the next vertex.
Step 4: Repeat Step 3 until you have visited all the vertices.
C D
7
Solution:
A
20
• Note that A → B → E → C → D → A 9 13 9
3 E
has a total weight of 36 minutes. All B
we can expect from the nearest 8 8
neighbor algorithm is a reasonably 10 5
good solution. C D
7