This repository provides a reference implementation of MatNet and saved trained models as described in the paper:
Matrix Encoding Networks for Neural Combinatorial Optimization
(NeurIPS 2021, accepted)
https://arxiv.org/abs/2106.11113
The code is written using Pytorch.
We provide codes for two CO (combinatorial optimization) problems:
- Asymmetric Traveling Salesman Problem (ATSP)
- Flexible Flow Shop Problem (FFSP)
For both ATSP_MatNet and FFSP_MatNet,
python3 train.py
train.py contains parameters you can modify.
At the moment, it is set to train N=20 problems.
python3 test.py
You can specify the model as a parameter contained in test.py.
At the moment, it is set to use the saved model (N=20) we have provided (in "result" folder), but you can easily use the one you have trained from running train.py.
To test for the N=50 model, make sure that saved problem files exist in the path (see below for Datasets). Also, modify test.py so that
- all "20"'s are changed to "50"
- "path" and "epoch" in the "tester_params" are correctly pointing to the saved model
- test batch size is decreased (by a factor of something like 4)
Trained models for ATSP are provided with the codes.
However, the sizes of the trained model files for FFSP-MatNet are too large to upload here. So we provide them as links below.
- MatNet_saved_models_FFSP.zip (size: 358MB) <-- a zip file containing all three models
- MatNet_saved_models_N100 (size: 119MB)
- MatNet_saved_models_N50 (size: 119MB)
- MatNet_saved_models_N20 (size: 119MB)
Test datasets for larger N (N=50, N=100) problems are given as links below.
Download the dataset and add them to the "data" directories under ATSP and FFSP folders.
- MatNet_dataset_ATSP (size: 374MB)
- MatNet_dataset_FFSP (size: 19.6MB)
python v3.7.6
torch==1.7.0