{"id":28250808,"url":"https://github.com/tkachenko0/traveling-salesman-problem","last_synced_at":"2025-10-08T17:19:44.461Z","repository":{"id":171931759,"uuid":"648610726","full_name":"tkachenko0/Traveling-Salesman-Problem","owner":"tkachenko0","description":"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.","archived":false,"fork":false,"pushed_at":"2024-01-24T16:14:18.000Z","size":71613,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-19T14:21:21.004Z","etag":null,"topics":["convex-optimization","linear-optimization","salesman-problem","tsp-problem"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tkachenko0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-06-02T11:28:23.000Z","updated_at":"2024-03-06T14:18:40.000Z","dependencies_parsed_at":"2024-01-11T18:58:25.814Z","dependency_job_id":null,"html_url":"https://github.com/tkachenko0/Traveling-Salesman-Problem","commit_stats":null,"previous_names":["tkachenko0/traveling_salesperson_problem","tkachenko0/travelling_salesman_problem"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tkachenko0/Traveling-Salesman-Problem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkachenko0%2FTraveling-Salesman-Problem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkachenko0%2FTraveling-Salesman-Problem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkachenko0%2FTraveling-Salesman-Problem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkachenko0%2FTraveling-Salesman-Problem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkachenko0","download_url":"https://codeload.github.com/tkachenko0/Traveling-Salesman-Problem/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkachenko0%2FTraveling-Salesman-Problem/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259753898,"owners_count":22906277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["convex-optimization","linear-optimization","salesman-problem","tsp-problem"],"created_at":"2025-05-19T14:19:03.994Z","updated_at":"2025-10-08T17:19:39.437Z","avatar_url":"https://github.com/tkachenko0.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Traveling Salesman Problem\n\n\u003e 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).\n\n# About \nTSP is a classic optimization problem in computer science and operations research. The problem is defined as follows:\n\nGiven 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.\n\nThe 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.\n\nIn 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.\n\n![Planets](./images/es_space_sol_connessa_without_back.png)\n\n\n\u003cdiv wigth=\"100%\"\u003e\n\u003cimg src=\"./images/elon-ruotato.png\" alt=\"Elon Musk\" width=\"333px\" heigth=\"187px\" align=\"right\" title=\"Cloud title\" \u003e\n\u003cdiv\u003e\n\n## Getting Started\n\nMove to the source folder\n```bash\ncd src\n```\n\nCreate a virtual environment and activate it\n```bash\npython3.7 -m venv venv\nsource venv/bin/activate\n```\n\nInstall the requirements\n```bash\npip install -r requirements.txt\n```\n\nRun the main.py file\n```bash\npython3 main.py\n```\n\nRemember to free the virtual environment in case of dependency additions\n```bash\npip freeze \u003e requirements.txt\n```\n\n## Resources\n\n- [Python Project](./Python)\n\n- [PDF](./TSP_come_Guida_tra_i_Pianeti.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkachenko0%2Ftraveling-salesman-problem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkachenko0%2Ftraveling-salesman-problem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkachenko0%2Ftraveling-salesman-problem/lists"}