Git Product home page Git Product logo

vrp-rl's Introduction

Reinforcement Learning for Solving the Vehicle Routing Problem

We use Reinforcement for solving Travelling Salesman Problem (TSP) and Vehicle Routing Problem (VRP).

Paper

Implementation of our paper: Reinforcement Learning for Solving the Vehicle Routing Problem.

Dependencies

How to Run

Train

By default, the code is running in the training mode on a single gpu. For running the code, one can use the following command:

python main.py --task=vrp10

It is possible to add other config parameters like:

python main.py --task=vrp10 --gpu=0 --n_glimpses=1 --use_tanh=False 

There is a full list of all configs in the config.py file. Also, task specific parameters are available in task_specific_params.py

Inference

For running the trained model for inference, it is possible to turn off the training mode. For this, you need to specify the directory of the trained model, otherwise random model will be used for decoding:

python main.py --task=vrp10 --is_train=False --model_dir=./path_to_your_saved_checkpoint

The default inference is run in batch mode, meaning that all testing instances are fed simultanously. It is also possible to do inference in single mode, which means that we decode instances one-by-one. The latter case is used for reporting the runtimes and it will display detailed reports. For running the inference with single mode, you can try:

python main.py --task=vrp10 --is_train=False --infer_type=single --model_dir=./path_to_your_saved_checkpoint

Logs

All logs are stored in result.txt file stored in ./logs/task_date_time directory.

Sample CVRP solution

enter image description here

Acknowledgements

Thanks to pemami4911/neural-combinatorial-rl-pytorch for getting the idea of restructuring the code.

vrp-rl's People

Contributors

rezanazari avatar

Watchers

James Cloos 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.