Skip to main content

Travelling Salesman Problem

TSP · CANONICAL FORMULATION

Logistics · Transportation · Operational

The Travelling Salesman Problem asks for the shortest Hamiltonian cycle visiting each of $n$ cities exactly once and returning to the origin. It is perhaps the most famous problem in combinatorial optimisation — introduced informally by Menger (1932), made computationally famous by Dantzig, Fulkerson & Johnson (1954) with their 49-city LP+cut-plane solution, and today a proving ground for every new exact or heuristic technique. This page gives the two classical integer-programming formulations (MTZ and DFJ), an interactive nearest-neighbour + 2-opt solver on a Euclidean instance, and cross-links to applied instances on this site.

Why TSP matters

A minor miracle of applied mathematics

NP-hard
Decision version is NP-complete (Karp 1972). But exact solvers routinely tackle instances with tens of thousands of cities — the practical-vs-theoretical gap is huge.
85,900 cities
the pla85900 VLSI instance solved to proven optimality by Concorde in 2006 — a demonstration of how far branch-and-cut on TSP has come.
Applegate, Bixby, Chvátal, Cook · math.uwaterloo.ca/tsp
3/2
Christofides' (1976) approximation ratio for metric TSP — improved to $3/2 - \varepsilon$ in 2021 by Karlin, Klein & Oveis Gharan after 45 years standing.
Karlin-Klein-Oveis Gharan (2021) · doi:10.1145/3406325.3451009

Mathematical formulation

Two classical formulations · MTZ and DFJ

Notation

SymbolMeaning
$V = \{1,\ldots,n\}$set of cities
$c_{ij}$distance / cost from city $i$ to city $j$ (symmetric TSP: $c_{ij} = c_{ji}$)
$x_{ij} \in \{0,1\}$1 if the tour travels directly from $i$ to $j$, 0 otherwise
$u_i$auxiliary MTZ position variable for city $i$, $i \ne 1$

Objective (shared by both formulations)

Minimise total tour length
$$\min \; \sum_{i=1}^{n} \sum_{j=1,\, j \ne i}^{n} c_{ij} \, x_{ij}$$

Shared degree constraints

Enter and leave each city exactly once
$$\sum_{j=1,\, j \ne i}^{n} x_{ij} = 1 \quad \forall i \in V$$ $$\sum_{i=1,\, i \ne j}^{n} x_{ij} = 1 \quad \forall j \in V$$

MTZ subtour elimination (Miller-Tucker-Zemlin, 1960)

Compact: polynomial number of constraints
$$u_i - u_j + n \, x_{ij} \le n - 1 \quad \forall i,\, j \in V \setminus \{1\},\, i \ne j$$ $$1 \le u_i \le n - 1 \quad \forall i \in V \setminus \{1\}$$

DFJ subtour elimination (Dantzig-Fulkerson-Johnson, 1954)

Stronger LP relaxation, exponentially many cuts
$$\sum_{i \in S} \sum_{j \in S,\, j \ne i} x_{ij} \le |S| - 1 \quad \forall\, S \subset V,\, 2 \le |S| \le n - 1$$

DFJ gives the tighter LP bound (the convex hull of tours is the TSP polytope) but requires separation procedures to generate violated cuts on demand — handled by modern cutting-plane solvers such as Concorde. MTZ is polynomial-size but weak in the LP; useful for small instances or educational purposes.

Special cases. Metric TSP (triangle inequality: $c_{ij} + c_{jk} \ge c_{ik}$) admits Christofides' 3/2-approximation (improved to $3/2 - \varepsilon$ by Karlin, Klein & Oveis Gharan 2021). Euclidean TSP admits a PTAS (Arora 1996; Mitchell 1999). The asymmetric TSP (ATSP) drops the symmetry and is, until recently, harder to approximate; Svensson-Tarnawski-Végh (2020) gave the first constant-factor approximation.

Real-world to OR mapping

Applied TSP instances across the site

Real-world conceptOR role
Cities, locations, stopsnodes $V$
Road / air distance or drive time$c_{ij}$
“Courier drives $i \to j$”$x_{ij} = 1$
Starting depot / warehousecity 1 (WLOG)
Return requirementHamiltonian cycle (visit all, return to start)

Interactive solver

Nearest-Neighbor construction + 2-opt improvement

Two of the most enduring TSP heuristics. Nearest Neighbor starts at city 1, repeatedly moves to the nearest unvisited city, and returns to the start: $O(n^2)$, typically within 25% of optimal. 2-opt (Croes 1958; Lin 1965) improves any tour by repeatedly reversing any segment whose reversal shortens the tour: the neighbourhood has size $\binom{n}{2}$ and 2-opt-optimal tours are usually within 5% of optimal.

Cities
15
Random seed
11
Cities
Tour length
Algorithm
Improvements
Runtime

Standard benchmarks

TSPLIB and beyond

  • TSPLIB (Reinelt 1991) — the canonical library. ~110 symmetric TSP instances with 14–85,900 nodes; best-known solutions verified for decades. comopt.ifi.uni-heidelberg.de/TSPLIB95
  • DIMACS Challenge (2002) — a systematic computational study of TSP heuristics on large random and clustered instances.
  • VLSI & World TSP — the pla85900 (85,900 cities) and World TSP (~1.9 million cities) instances remain active frontiers.

The Concorde solver (Applegate, Bixby, Chvátal & Cook) holds the record for nearly all exact results. LKH (Helsgaun 2000) is the state-of-the-art heuristic.

Key references

DOIs & permanent URLs

Dantzig, G., Fulkerson, R., & Johnson, S. (1954).
“Solution of a large-scale traveling-salesman problem.”
Operations Research, 2(4), 393–410. doi:10.1287/opre.2.4.393
Miller, C. E., Tucker, A. W., & Zemlin, R. A. (1960).
“Integer programming formulation of traveling salesman problems.”
Journal of the ACM, 7(4), 326–329. doi:10.1145/321043.321046
Held, M., & Karp, R. M. (1962).
“A dynamic programming approach to sequencing problems.”
Journal of SIAM, 10(1), 196–210. doi:10.1137/0110015
Lin, S. (1965).
“Computer solutions of the traveling salesman problem.”
Bell System Technical Journal, 44(10), 2245–2269.
Christofides, N. (1976).
“Worst-case analysis of a new heuristic for the travelling salesman problem.”
Technical Report 388, Graduate School of Industrial Administration, CMU.
Reinelt, G. (1991).
“TSPLIB — A traveling salesman problem library.”
ORSA Journal on Computing, 3(4), 376–384. doi:10.1287/ijoc.3.4.376
Helsgaun, K. (2000).
“An effective implementation of the Lin-Kernighan traveling salesman heuristic.”
European Journal of Operational Research, 126(1), 106–130. doi:10.1016/S0377-2217(99)00284-2
Applegate, D., Bixby, R., Chvátal, V., & Cook, W. (2006).
The Traveling Salesman Problem: A Computational Study.
Princeton University Press. ISBN 978-0-691-12993-8.
Karlin, A. R., Klein, N., & Oveis Gharan, S. (2021).
“A (slightly) improved approximation algorithm for metric TSP.”
TSPLIB.
Traveling Salesman Problem Library.
Maintained by the University of Heidelberg. comopt.ifi.uni-heidelberg.de

Need to solve a routing problem at scale?
The gap between “good heuristic” and “provably optimal” is smaller than you think.

Get in Touch
Data and numerical examples are illustrative. Pages on this site are educational tools, not production software.