{"id":16730800,"url":"https://github.com/chkwon/tspdrone-rl","last_synced_at":"2025-09-12T20:37:07.016Z","repository":{"id":44928947,"uuid":"448795405","full_name":"chkwon/TSPDrone-RL","owner":"chkwon","description":"A Deep Reinforcement Learning Approach for Solving the Traveling Salesman Problem with Drone","archived":false,"fork":false,"pushed_at":"2022-12-07T03:21:31.000Z","size":57493,"stargazers_count":52,"open_issues_count":2,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-07T16:00:02.844Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chkwon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-17T07:34:53.000Z","updated_at":"2025-09-04T01:27:07.000Z","dependencies_parsed_at":"2022-08-27T23:12:13.447Z","dependency_job_id":null,"html_url":"https://github.com/chkwon/TSPDrone-RL","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chkwon/TSPDrone-RL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chkwon%2FTSPDrone-RL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chkwon%2FTSPDrone-RL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chkwon%2FTSPDrone-RL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chkwon%2FTSPDrone-RL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chkwon","download_url":"https://codeload.github.com/chkwon/TSPDrone-RL/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chkwon%2FTSPDrone-RL/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274873613,"owners_count":25365824,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-12T23:34:52.258Z","updated_at":"2025-09-12T20:37:06.982Z","avatar_url":"https://github.com/chkwon.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Deep Reinforcement Learning Approach for Solving the Traveling Salesman Problem with Drone\n\nThis repository contains code for deep reinforcement learning to solve the Traveling Salesman Problem with Drone (TSPD). For details, please see our paper [A Deep Reinforcement Learning Approach for Solving the Traveling Salesman Problem with Drone](https://arxiv.org/abs/2112.12545). If this code is useful for your work, please cite our paper:\n\n```\n@article{bogyrbayeva2022deep,\n      title={A Deep Reinforcement Learning Approach for Solving the Traveling Salesman Problem with Drone}, \n      author={Aigerim Bogyrbayeva and Taehyun Yoon and Hanbum Ko and Sungbin Lim and Hyokun Yun and Changhyun Kwon},\n      year={2022},\n      journal={Transportation Research Part C: Emerging Technologies},\n      volume={To Appear}\n}\n``` \n\nFor the optimization heuristic algorithms used in the paper, please see [TSPDrone.jl](https://github.com/chkwon/TSPDrone.jl).\n\n\n## Dependencies\n\n* Python\u003e=3.8\n* NumPy\n* SciPy\n* [PyTorch](http://pytorch.org/)\u003e=1.7\n\n\n## Usage\n\n### Generating data\n\nTraining data is generated on the fly with the batch size and node numbers specified in `/utils/options.py`. If test data is not given in the data folder, the test data will be generated randomly as well.\n\n### Training\n\nFor training TSPD, just run the following line. Any other training parameters can also be set in `/utils/options.py` such as the number of nodes, batch size, the number of epochs, decode lengths, etc. \n```bash\npython main.py --train=True\n```\nThe trained weight files will be saved in the `/trained_models` directory.\n\nPre-trained weights files for random data as described in the paper are located in the `/trained_models` directory for some sizes, `n = 11, 15, 20, 50, 100`.\n\n\n### Evaluation\n To perform only inference, please set `train` to `False` in `/utils/options.py` or just run:\n```bash\npython main.py --train=False\n```\nBy default, the greedy decoding will run. \n\n### Sampling\nTo run batch sampling, please set `sampling` to `True` and specify the number of samples `n_samples` in `/utils/options.py`. \n\nThe results of both greedy and batch sampling decoding will be stored in the `results` folder. \n\n\n\n\n## Test Instances\n\nThe `/data` directory includes random test instances used in the paper for `n=11, 15, 20, 50, 100`.\nEach file includes 100 instances. \n\nEach row represents an instance, in the form of \n```\nx_1 y_1 d_1 x_2 y_2 d_2 ... x_n y_n d_n\n```\nwhere `x_i y_i d_i` represents the x-y coordinate of customer `i` and demand. All demands are set to be 1.0 for customers.\nThe last components `x_n y_n d_n` represents the depot and `d_n` is set to 0.0 for the depot.\n\n\n\n## Example TSPD solution\nA sample solution of TSPD for 11 nodes is depicted below:\n![](/images/optimal-n11-6-2.svg)\n\n\n\n## Acknowledgements\nThis repository heavily benefited from the following repositories:\n- https://github.com/wouterkool/attention-learn-to-route\n- https://github.com/OptMLGroup/VRP-RL\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchkwon%2Ftspdrone-rl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchkwon%2Ftspdrone-rl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchkwon%2Ftspdrone-rl/lists"}