Skip to content

Attention learn to solve routing problems, TensorFlow2 (TF2), PyTorch, Capacitated Vehicle Routing Problem (CVRP), Transformer, Multi Head Attention, Deep Reinforcement Learning (DRL) (Rollout baseline, REINFORCE) (https://arxiv.org/pdf/1803.08475.pdf)

License

Notifications You must be signed in to change notification settings

daunfamily/VRP_MHA

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CVRP solver with Multi Heads Attention

TensorFlow2 and PyTorch implementation of ATTENTION, LEARN TO SOLVE ROUTING PROBLEMS!(Kool et al. 2019)(https://arxiv.org/pdf/1803.08475.pdf)

Description

Slide Share -- CVRP solver with Multi Heads Attention --

Dependencies

  • Python >= 3.6
  • TensorFlow >= 2.0
  • PyTorch = 1.5
  • tqdm
  • scipy
  • numpy
  • plotly (only for plotting)
  • matplotlib (only for plotting)

Usage

First move to "PyTorch" or "TensorFlow2" dir.

cd PyTorch

Then, generate the pickle file contaning hyperparameter values by running the following command.

python config.py

you would see the pickle file in "Pkl" dir. now you can start training the model.

python train.py -p Pkl/***.pkl

Plot prediction of the pretrained model

python plot.py -p Weights/***.pt(or ***.h5)

If you want to verify your model, you can use opensource dataset in "OpenData" dir.

Opensource data is obtained from Augerat et al.(1995)

please refer to Capacitated VRP Instances by NEO Research Group

python plot.py -p Weights/***.pt -t ../OpenData/A-n***.txt

Reference

About

Attention learn to solve routing problems, TensorFlow2 (TF2), PyTorch, Capacitated Vehicle Routing Problem (CVRP), Transformer, Multi Head Attention, Deep Reinforcement Learning (DRL) (Rollout baseline, REINFORCE) (https://arxiv.org/pdf/1803.08475.pdf)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%