https://github.com/rodrigo-arenas/tspme
Python metaheuristics for Traveling Salesman Problem (TSP)
https://github.com/rodrigo-arenas/tspme
Last synced: 7 months ago
JSON representation
Python metaheuristics for Traveling Salesman Problem (TSP)
- Host: GitHub
- URL: https://github.com/rodrigo-arenas/tspme
- Owner: rodrigo-arenas
- License: mit
- Created: 2020-05-11T02:16:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-02T16:32:19.000Z (about 1 year ago)
- Last Synced: 2025-03-01T17:24:14.225Z (8 months ago)
- Language: Python
- Size: 164 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tspme
Python metaheuristics for Traveling Salesman Problem (TSP)## Example
```python
import matplotlib.pyplot as plt
from tspme.utils.routes_generator import RandomRouteGenerator
from tspme.utils.plot_routes import plot_routes, plot_history
from tspme.metaheuristics import SimulatedAnnealingSIZE = 50
route_generator = RandomRouteGenerator(size=SIZE)
routes = route_generator.generate()sa = SimulatedAnnealing()
sa.set_distance_matrix(routes)
solution = sa.fit(return_cost_hist=True)
print(solution)
plot_routes(cities=routes, solution=solution)
plot_history(solution=solution)
plt.show()
```
![]()