You have 3 free guides left 😟
Unlock your guides
You have 3 free guides left 😟
Unlock your guides

12.9 Traveling Salesperson Problem

3 min readjune 18, 2024

The is a classic optimization challenge. It's about finding the shortest route that visits every city once and returns to the start. This problem showcases the difficulty of finding optimal solutions in complex scenarios.

Various algorithms tackle this problem, from brute force to more sophisticated approaches. While some guarantee optimal solutions but are slow, others provide quick approximations. The choice depends on the specific needs and constraints of the situation.

Traveling Salesperson Problem

Algorithms for Traveling Salesperson Problem

Top images from around the web for Algorithms for Traveling Salesperson Problem
Top images from around the web for Algorithms for Traveling Salesperson Problem
  • generates all possible Hamilton cycles (complete tours visiting each vertex exactly once) in a weighted graph, calculates the total weight (sum of edge weights) of each Hamilton cycle, and selects the Hamilton cycle with the lowest total weight as the optimal solution to minimize travel distance or cost
  • provide faster but potentially suboptimal solutions to the Traveling Salesperson Problem
    • starts at a randomly selected vertex, visits the nearest unvisited vertex at each step based on edge weights, and returns to the starting vertex after visiting all to form a complete tour
    • starts with the cheapest edge in the graph, adds the next cheapest edge that doesn't create a cycle or a vertex with degree 3 (already connected to 3 other vertices), and continues until a Hamilton cycle is formed
  • can be used to solve the Traveling Salesperson Problem by breaking it down into smaller subproblems and storing solutions to avoid redundant calculations

Hamilton cycles in complete graphs

  • is a graph in which every pair of vertices is connected by an edge, allowing for many possible Hamilton cycles (complete tours)
  • Number of distinct Hamilton cycles in a complete graph with nn vertices can be calculated using the formula (n1)!2\frac{(n-1)!}{2}
    • In a complete graph with 4 vertices (K4K_4), there are (41)!2=3!2=3\frac{(4-1)!}{2} = \frac{3!}{2} = 3 distinct Hamilton cycles (possible complete tours)
  • As the number of vertices in a complete graph increases, the number of distinct Hamilton cycles grows rapidly due to factorial growth
    • K5K_5 (complete graph with 5 vertices) has (51)!2=4!2=12\frac{(5-1)!}{2} = \frac{4!}{2} = 12 distinct Hamilton cycles
    • K6K_6 (complete graph with 6 vertices) has (61)!2=5!2=60\frac{(6-1)!}{2} = \frac{5!}{2} = 60 distinct Hamilton cycles

Brute force vs nearest neighbor methods

  • guarantees finding the optimal solution (lowest-weight Hamilton cycle) but has a time complexity of [O(n!)](https://www.fiveableKeyTerm:O(n!))[O(n!)](https://www.fiveableKeyTerm:O(n!)), where nn is the number of vertices, making it impractical for large graphs due to factorial growth in computation time
  • is a heuristic approach that finds a reasonably good solution quickly with a time complexity of [O(n2)](https://www.fiveableKeyTerm:O(n2))[O(n^2)](https://www.fiveableKeyTerm:O(n^2)), where nn is the number of vertices, making it more efficient than the brute force method, especially for large graphs
    • However, the nearest neighbor method does not guarantee finding the optimal solution and may produce suboptimal results, particularly in graphs with many vertices
  • There is a trade-off between efficiency and accuracy when choosing between brute force and nearest neighbor methods for solving the Traveling Salesperson Problem
    • Brute force is slow but accurate, guaranteeing the optimal solution
    • Nearest neighbor is fast but potentially suboptimal, providing a good approximation quickly

Advanced Techniques for Solving TSP

  • of the Traveling Salesperson Problem is , making it challenging to solve optimally for large instances
  • and are used to find near-optimal solutions in reasonable time
  • techniques iteratively improve a solution by making small changes to the current tour
  • , such as genetic algorithms or simulated annealing, combine multiple strategies to explore the solution space more effectively
© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.


© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.

© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.
Glossary
Glossary