TSP Using Branch and Bound
TSP Using Branch and Bound
must visit a set of cities exactly once and return to the starting city, minimizing the total distance
traveled. It can be formulated mathematically as follows:
The Branch and Bound (B&B) method is a systematic way of solving the TSP by exploring the
search space of all possible tours in a tree structure. The basic idea is to divide the problem into
smaller subproblems (branching) and calculate bounds on the minimum possible cost of tours
within these subproblems to discard (prune) subproblems that cannot yield an optimal solution.
1. Initialization:
o Start with an initial bound (e.g., using a greedy algorithm or any heuristic).
o The root node represents the starting city with no other cities visited.
2. Branching:
o From the current node (city), create child nodes representing possible next cities
to visit.
o For a node representing a partial tour ending in city kkk, generate child nodes for
tours that extend to unvisited cities.
3. Bounding:
o Calculate a lower bound on the total distance for each partial tour (node).
o A common way to compute a lower bound is to use the reduced cost matrix,
which adjusts the original distance matrix to reflect the minimum additional cost
required to complete the tour.
4. Pruning:
o If the lower bound of a node is greater than or equal to the current best known
solution (upper bound), prune that node and do not explore its children.
o If a node represents a complete tour and its cost is lower than the current best
known solution, update the best known solution.
5. Selection:
o Select the next node to explore (typically the one with the smallest lower bound).
6. Termination:
o The process continues until all nodes have been either explored or pruned.
o The best known solution at the end of the process is the optimal tour.
The branch and bound technique is a method used to solve combinatorial optimization problems
like TSP. It systematically explores all possible solutions to find the optimal one while pruning
suboptimal solutions to reduce the search space. Here's how it works for TSP:
1. Branching: Divide the problem into smaller subproblems, creating a tree structure where
each node represents a partial solution (a set of cities visited).
2. Bounding: Calculate a lower bound on the total travel cost for each node. If the lower
bound of a node is higher than the current best solution, prune that branch.
3. Pruning: Eliminate branches that cannot yield a better solution than the current best one.
4. Backtracking: Explore other branches when a dead end is reached or a branch is pruned.
Let's solve a simple TSP with 4 cities: A, B, C, and D, with the following distances:
A to B: 10, A to C: 15, A to D: 20
B to C: 35, B to D: 25
C to D: 30
(assume symmetric distances)
1. Initial Setup:
o Represent the problem as a distance matrix.
Distance Matrix:
A B C D
A 0 10 15 20
B 10 0 35 25
C 15 35 0 30
D 20 25 30 0
Branching:
Bounding:
Example Calculation:
Assume starting at A.
From A → B (cost = 10).
From B → D (cost = 10 + 25 = 35).
From D → C (cost = 35 + 30 = 65).
Return to A from C (cost = 65 + 15 = 80).
Path: A → B → D → C → A with total cost = 80.
Continue exploring other branches: A → C, A → D, etc., and calculate their bounds.
Prune branches where bounds exceed 80.
Optimal Solution:
Through systematic branching, bounding, and pruning, find the optimal path.
Let's assume A → B → C → D → A gives the optimal cost (e.g., 75).