https://github.com/tkachenko0/traveling-salesman-problem
TSP is a classic optimization problem in computer science and operations research. In this essay, we playfully apply TSP to the case where Elon Musk, the visionary entrepreneur of SpaceX, wishes to visit all the planets of our solar system with minimum cost.
https://github.com/tkachenko0/traveling-salesman-problem
convex-optimization linear-optimization salesman-problem tsp-problem
Last synced: 8 months ago
JSON representation
TSP is a classic optimization problem in computer science and operations research. In this essay, we playfully apply TSP to the case where Elon Musk, the visionary entrepreneur of SpaceX, wishes to visit all the planets of our solar system with minimum cost.
- Host: GitHub
- URL: https://github.com/tkachenko0/traveling-salesman-problem
- Owner: tkachenko0
- License: mit
- Created: 2023-06-02T11:28:23.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-24T16:14:18.000Z (over 2 years ago)
- Last Synced: 2025-05-19T14:21:21.004Z (about 1 year ago)
- Topics: convex-optimization, linear-optimization, salesman-problem, tsp-problem
- Language: Python
- Homepage:
- Size: 68.3 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Traveling Salesman Problem
> This is a project created for the final project of the Decision Science subject of the Master's Degree in Computer science of the [University of Cagliari](https://www.unica.it/unica/en/homepage.page).
# About
TSP is a classic optimization problem in computer science and operations research. The problem is defined as follows:
Given a set of cities and the distances between each pair of cities, the objective is to find the shortest possible route that allows a salesperson to visit each city exactly once and return to the starting city.
The TSP is classified as an NP-hard problem, which means that it is computationally difficult to find an optimal solution for large instances of the problem. As the number of cities increases, the number of possible routes grows exponentially, making it infeasible to brute-force all possibilities.
In this essay, we playfully apply TSP to the case where Elon Musk, the visionary entrepreneur of SpaceX, wishes to visit all the planets of our solar system. Each path between planets has an associated cost. The goal is to find the overall route that allows Elon Musk to visit all planets while reducing the cost as much as possible.

## Getting Started
Move to the source folder
```bash
cd src
```
Create a virtual environment and activate it
```bash
python3.7 -m venv venv
source venv/bin/activate
```
Install the requirements
```bash
pip install -r requirements.txt
```
Run the main.py file
```bash
python3 main.py
```
Remember to free the virtual environment in case of dependency additions
```bash
pip freeze > requirements.txt
```
## Resources
- [Python Project](./Python)
- [PDF](./TSP_come_Guida_tra_i_Pianeti.pdf)