← 🤖 Algorithms

🤝 TSP

Algorithm
Annealing params
Tour length
Best found
Iterations 0
Temperature
Improvements 0
Current tour
Best tour
City
Start city
Click canvas to add a city · Drag to move · Right-click to delete

📍 Travelling Salesman — Optimisation

Three algorithms compete on the same city set: Nearest Neighbour (greedy), 2-opt (local search) and Simulated Annealing (probabilistic). Drag cities or click to add new ones and watch routes optimise.

🔬 What It Demonstrates

TSP asks: what's the shortest route visiting all cities exactly once? It's NP-hard — no known polynomial-time algorithm exists, but heuristics find near-optimal solutions.

🎮 How to Use

Click to add cities. Drag to reposition them. Run all three algorithms and compare tour lengths. Watch Simulated Annealing escape local optima that trap 2-opt.

💡 Did You Know?

With just 20 cities, there are 20!/2 ≈ 1.2 × 10¹⁸ possible routes. The record exact solution for real TSP is 85,900 cities, computed in 2006 by Applegate, Bixby, Chvátal and Cook.