Code Monkey home page Code Monkey logo

tspdrone-rl's Introduction

A Deep Reinforcement Learning Approach for Solving the Traveling Salesman Problem with Drone

This 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. If this code is useful for your work, please cite our paper:

@article{bogyrbayeva2022deep,
      title={A Deep Reinforcement Learning Approach for Solving the Traveling Salesman Problem with Drone}, 
      author={Aigerim Bogyrbayeva and Taehyun Yoon and Hanbum Ko and Sungbin Lim and Hyokun Yun and Changhyun Kwon},
      year={2022},
      journal={Transportation Research Part C: Emerging Technologies},
      volume={To Appear}
}

For the optimization heuristic algorithms used in the paper, please see TSPDrone.jl.

Dependencies

  • Python>=3.8
  • NumPy
  • SciPy
  • PyTorch>=1.7

Usage

Generating data

Training 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.

Training

For 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.

python main.py --train=True

The trained weight files will be saved in the /trained_models directory.

Pre-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.

Evaluation

To perform only inference, please set train to False in /utils/options.py or just run:

python main.py --train=False

By default, the greedy decoding will run.

Sampling

To run batch sampling, please set sampling to True and specify the number of samples n_samples in /utils/options.py.

The results of both greedy and batch sampling decoding will be stored in the results folder.

Test Instances

The /data directory includes random test instances used in the paper for n=11, 15, 20, 50, 100. Each file includes 100 instances.

Each row represents an instance, in the form of

x_1 y_1 d_1 x_2 y_2 d_2 ... x_n y_n d_n

where 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. The last components x_n y_n d_n represents the depot and d_n is set to 0.0 for the depot.

Example TSPD solution

A sample solution of TSPD for 11 nodes is depicted below:

Acknowledgements

This repository heavily benefited from the following repositories:

tspdrone-rl's People

Contributors

chkwon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.