High-performance Python library for solving the Traveling Salesman Problem
Novel heuristic approaches that outperform classical methods by ~25% on real-world clustered data.
Smart TSP Solver is a high-performance Python library for solving the Traveling Salesman Problem (TSP) using novel heuristic approaches. Features advanced algorithms that outperform classical methods by ~25% on real-world clustered data while maintaining practical computational efficiency.
Research-driven design: This library implements cutting-edge spatial optimization techniques including dynamic gravitational attraction modeling and angular-radial spatial indexing for intelligent pathfinding.
Dynamic Gravity Approach — Complexity: O(n²)
delta parameter acts as an "inertia coefficient," preventing sharp turns and creating smooth, natural-looking routesAngular-Radial Method — Complexity: O(n²) with near O(n·log n) practical performance
look_ahead) with points pre-sorted in a polar coordinate system| Algorithm | Complexity | Quality | Speed | Primary Use Case |
|---|---|---|---|---|
| Greedy v2 | O(n²) | ███░░ | █████ | Real-time, microseconds |
| Dynamic-gravity v2 | O(n²) | █████ | ████░ | Balanced, milliseconds |
| Angular-radial v2 | O(n²)* | █████ | ███░░ | Quality, offline |
*Practical performance approaches O(n·log n) due to spatial heuristics.
Algorithm Evolution (v1 vs. v2)
Algorithm Characteristics
O(n²)), ideal for real-time applications, sacrifices solution quality (+17-20% longer routes)Practical Recommendations
pip install smart-tsp-solver
With Benchmark:
pip install smart-tsp-benchmark
git clone https://github.com/smartlegionlab/smart-tsp-solver.git cd smart-tsp-solver python -m venv venv source venv/bin/activate pip install -r requirements.txt python main.py