🧩 Constraint Solving POTD:Traveling Salesman Problem (TSP) #23894
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 #24106. |
Beta Was this translation helpful? Give feedback.
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.
-
The Traveling Salesman Problem is one of the most famous problems in combinatorial optimization — deceptively simple to state, yet NP-hard to solve optimally. Today we explore how constraint solving, MIP, and hybrid approaches each take on this classic routing challenge.
Problem Statement
A salesman must visit n cities exactly once and return to the starting city, minimizing the total travel distance (or cost).
Concrete instance — 5 cities:
Trade-offs: The
circuitconstraint performs propagation equivalent to shortest-path reasoning (e.g., filtering based on 1-tree bounds in some solvers). Very expressive — easy to add side constraints (time windows, capacity). Scales less well to large pure TSP instances than dedicated MIP branch-and-cut, but shines when combined with side constraints.Example Model (OR-Tools CP-SAT, Python)
Key Techniques
1. Lower Bounding via 1-Tree Relaxation
A minimum spanning tree on
n-1cities plus the two cheapest edges incident to the depot gives a Held-Karp lower bound — often within 1–2% of optimal. This bound drives branch-and-bound pruning and guides CP propagation through thecircuitconstraint in many solvers.2. Symmetry Breaking
TSP tours have two trivial symmetries: direction (A→B→C and A→C→B are the same tour) and starting point (any rotation is equivalent). Fixing city 0 as the first node and requiring
next[0] < prev[0](or equivalent) cuts the search space by2n.3. Large Neighbourhood Search (LNS) / Lin-Kernighan Moves
For large instances (n > 1000), exact methods are impractical. LNS destroys part of the current solution (e.g., removes 3 random edges) and repairs it optimally. The Lin-Kernighan heuristic iteratively applies
k-opt moves — swappingkedges — and is the foundation of the world-class LKH solver. Hybrid approaches use LNS as a metaheuristic driving a CP or MIP subproblem.Challenge Corner
Bonus: the Asymmetric TSP (ATSP) has
d[i][j] ≠ d[j][i]. How does this break the directional symmetry, and what subtour elimination technique is most effective for ATSP?References
Beta Was this translation helpful? Give feedback.
All reactions