{"id":16887675,"url":"https://github.com/ethanhe42/tsp","last_synced_at":"2025-04-11T12:44:33.058Z","repository":{"id":109158191,"uuid":"73705491","full_name":"ethanhe42/TSP","owner":"ethanhe42","description":"evaluation of various algorithms for traveling salesman problem","archived":false,"fork":false,"pushed_at":"2020-02-14T17:24:10.000Z","size":28,"stargazers_count":7,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-19T07:42:03.468Z","etag":null,"topics":["algorithm","animation","python","tsp"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/1705.09058","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/ethanhe42.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}},"created_at":"2016-11-14T13:07:31.000Z","updated_at":"2024-02-14T21:20:43.000Z","dependencies_parsed_at":"2023-03-14T22:15:29.173Z","dependency_job_id":null,"html_url":"https://github.com/ethanhe42/TSP","commit_stats":{"total_commits":10,"total_committers":2,"mean_commits":5.0,"dds":"0.30000000000000004","last_synced_commit":"303e499d2f2867454d8d6fe59deb94c385048882"},"previous_names":["ethanhe42/tsp","yihui-he/tsp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanhe42%2FTSP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanhe42%2FTSP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanhe42%2FTSP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanhe42%2FTSP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethanhe42","download_url":"https://codeload.github.com/ethanhe42/TSP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248402541,"owners_count":21097331,"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":["algorithm","animation","python","tsp"],"created_at":"2024-10-13T16:46:11.161Z","updated_at":"2025-04-11T12:44:32.891Z","avatar_url":"https://github.com/ethanhe42.png","language":"Python","readme":"TSP algorithms survey\n=============\n\nAn animation of four algorithms trying to solve a traveling salesman problem.\n\n### algorithms\n\nGiven a set of 200 cities four algorithms are used to find the shortest tour\nof all 200 cities.  The algorithms are:\n\n1. Random path, start a city and randomly select the next city from the remaining not visited cities until all cities are visited.\n2. Greedy, start a city select as next city the unvisited city that is closest to the current city\n3. 2-Opt, First create a random tour, and then optimize this with the 2-opt\n   algorithm\n4. Simulated Annealing. First create a random tour, and then optimize this with 2-opt in combination\n   with simualted annealing.\n\n### results\n\nlenth | greedy | 2opt | sa | optimal | random\n --- | --- | --- | --- | --- | --- \np15 | 284.38 | 284.38 | 284.38 | 284.38 | 818\natt48 | 40526 | 35579 | 33607 | 33523 | 157530\nrand200 | 36226 | 31887 | 30944 | x | 327452\n\ntime | greedy | 2opt | sa\n --- | --- | --- | --- \np15 | 1ms | 5ms | 11.12\natt48 | 6ms | .24s | 11s\nrand200 | 10ms | 18s | 14.5s\n\n### citation\n\nIf you find the code useful in your research, please consider citing:\n\n      @article{he2017empirical,\n        title={An Empirical Analysis of Approximation Algorithms for the Euclidean Traveling Salesman Problem},\n        author={He, Yihui and Xiang, Ming},\n        journal={arXiv preprint arXiv:1705.09058},\n        year={2017}\n      }\n\n[Paper](https://github.com/yihui-he/TSP-paper) and [实验报告](https://github.com/yihui-he/TSP-report) latex code are also available.\n\n### setups\n\nTo create the animation you will need python (Version 2) and ffmpeg.\n\nFor python you need one additional library (matplotlib) and its dependcies.\nYou can install it with:\n\n    pip install matplotlib\n\n\nTo create the animation use:\n\n    make .anim\n    make\n\nThis should create a file called sa.mp4.  This should be playable with vlc.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethanhe42%2Ftsp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethanhe42%2Ftsp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethanhe42%2Ftsp/lists"}