Skip to content
プロジェクト

概要

"Attention, Learn to Solve Routing Problems!"[Kool+, 2019], Capacitated Vehicle Routing Problem solver

AI・機械学習

この数値の測り方

計測したスター増加

24時間
0
7日間
0
15日間
0
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

CVRP solver with Multi-Head 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 (in this example, batch size is 128, number of customer nodes is 50)

python plot.py -p Weights/***.pt(or ***.h5) -b 128 -n 50

You can change plot.py into plot_2opt.py.

2opt is a local search method, which improves a crossed route by swapping arcs.

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 -b 128

One example would be cd PyTorch && python plot.py -p Weights/VRP50_train_epoch19.pt -t ../OpenData/A-n45-k7.txt -d sampling -b 128

Reference

関連プロジェクトを探す

読み込み中…