🧩 Constraint Solving POTD:Problem of the Day: The Traveling Salesman Problem (TSP) #55752
Closed
Replies: 1 comment
|
This discussion has been marked as outdated by Constraint Solving — Problem of the Day. A newer discussion is available at Discussion #56013. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem Statement
The Traveling Salesman Problem asks: given a set of cities and the distances between them, find the shortest route that visits every city exactly once and returns to the starting city.
Concrete Instance: Consider 5 cities {A, B, C, D, E} with symmetric distances:
Find a tour through all 5 cities with minimum total distance. For example, the tour A → B → E → D → C → A has cost 10 + 15 + 14 + 30 + 15 = 84.
Input: Complete graph with
nvertices and edge weightsd[i,j]Output: A permutation of cities forming a tour with minimum total distance
Why It Matters
Delivery route optimization: Logistics companies use TSP solvers daily to plan package delivery routes for drivers, reducing fuel costs and delivery times across thousands of routes worldwide.
Printed circuit board drilling: Manufacturers must drill holes in PCBs efficiently; the order of drill positions directly impacts production time—TSP determines the drilling sequence.
DNA sequencing: In genome assembly, TSP helps order DNA fragments to minimize the cost of reconstructing genomes from short sequencing reads.
Airport scheduling: Airlines optimize the sequence of aircraft maintenance tasks to minimize equipment downtime and hangar congestion.
Modeling Approaches
Approach 1: Constraint Programming (Subtour Elimination)
Paradigm: Integer Programming with logic-based constraints
Trade-offs: Simple formulation with polynomial number of constraints. The MTZ inequalities are weak (loose LP relaxation) but easy to implement. Works well for n ≤ 50 in practice.
Approach 2: Constraint Programming (Circuit Constraint + Search)
Paradigm: Pure CP with global constraints
Trade-offs: The
circuitglobal constraint encodes subtour elimination directly via sophisticated propagation (faster pruning than MTZ inequalities). Requires a CP solver (OR-Tools, Gurobi, Chuffed). Excellent for large instances (n ≥ 100) when paired with search heuristics.Approach 3: Local Search Heuristic
Paradigm: Metaheuristic/neighborhood exploration
Trade-offs: No optimality guarantee, but finds high-quality solutions in seconds for instances with thousands of cities. Combines simplicity with impressive practical performance. Often seeded with a construction heuristic (nearest neighbor, Christofides).
Example: OR-Tools TSP Solver (Python)
Key Techniques
1. Cutting Planes & Constraint Strengthening
The basic subtour elimination formulation has a weak LP relaxation (can be far from the integer optimum). Solvers add cutting planes (Gomory cuts, Chvátal-Gomory cuts) to strengthen bounds. For TSP specifically, comb inequalities and blossom inequalities are particularly effective but computationally expensive. Branch-and-cut algorithms alternate between solving LP relaxations and adding cuts.
2. Search Heuristics: Variable & Value Ordering
When solving TSP via CP/search, the choice of which city to visit next is critical:
distance - LP_relaxation_valueto guide search toward proven optimal edges.3. Lower Bounds & Relaxation
Tight lower bounds prune the search tree efficiently:
Challenge Corner
Open Question for You:
Suppose you are solving a dynamic TSP where the customer locations and distances change over time (e.g., real-time delivery requests). Classical exact algorithms recompute from scratch, which is slow. How would you design a warm-start strategy that reuses solutions from the previous time step? Consider:
References
Applegate, D., Bixby, R., Chvátal, V., Cook, W. (2006). The Traveling Salesman Problem: A Computational Study. Princeton University Press.
→ The definitive reference on modern TSP solving techniques, including branch-and-cut algorithms.
Croes, G. A. (1958). "A method for solving traveling-salesman problems." Operations Research, 6(6), 791–812.
→ Classic paper introducing the 2-opt local search heuristic.
Miller, C. E., Tucker, A. W., Zemlin, R. A. (1960). "Integer programming formulations and traveling salesman problems." Journal of the ACM, 7(4), 326–329.
→ Introduces the Held-Karp (MTZ) subtour elimination formulation.
Google OR-Tools TSP Documentation: (developers.google.com/redacted)
→ Practical guide with code examples for solving vehicle routing (generalization of TSP).
All reactions