https://github.com/ai4co/routefinder
[ICML'24 FM-Wild Oral] RouteFinder: Towards Foundation Models for Vehicle Routing Problems
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.5%) to scientific vocabulary
Keywords
Repository
[ICML'24 FM-Wild Oral] RouteFinder: Towards Foundation Models for Vehicle Routing Problems
Basic Info
- Host: GitHub
- Owner: ai4co
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://arxiv.org/abs/2406.15007
- Size: 409 MB
Statistics
- Stars: 67
- Watchers: 2
- Forks: 11
- Open Issues: 3
- Releases: 4
Topics
Metadata Files
README.md
RouteFinder
Towards Foundation Models for Vehicle Routing Problems
📰 News
- Feb 2025: A new version (
v0.3.0) of RouteFinder has been released. We have added several improvements, among which increasing the number of VRP variants from 24 to 48! See details on the release notes - Oct 2024: A new version (
v0.2.0) of RouteFinder has been released! We have added the latest contributions from our preprint and much improved codebase - Jul 2024: RouteFinder has been accepted as an Oral presentatation at the ICML 2024 FM-Wild Workshop!
🚀 Installation
We use uv (Python package manager) to manage the dependencies:
bash
uv venv --python 3.12 # create a new virtual environment
source .venv/bin/activate # activate the virtual environment
uv sync --all-extras # for all dependencies
Note that this project is also compatible with normal pip install -e . in case you use a different package manager.
🏁 Quickstart
Download data and checkpoints
To download the data and checkpoints from HuggingFace automatically, you can use:
bash
python scripts/download_hf.py
Running
We recommend exploring this quickstart notebook to get started with the RouteFinder codebase!
The main runner (example here of main baseline) can be called via:
bash
python run.py experiment=main/rf/rf-transformer-100
You may change the experiment by using the experiment=YOUR_EXP, with the path under configs/experiment directory.
Testing
You may use the provided test function to test the model:
bash
python test.py --checkpoint checkpoints/100/rf-transformer.ckpt
or with additional parameters:
```bash usage: test.py [-h] --checkpoint CHECKPOINT [--problem PROBLEM] [--size SIZE] [--datasets DATASETS] [--batchsize BATCHSIZE] [--device DEVICE] [--remove-mixed-backhaul | --no-remove-mixed-backhaul]
options: -h, --help show this help message and exit --checkpoint CHECKPOINT Path to the model checkpoint --problem PROBLEM Problem name: cvrp, vrptw, etc. or all --size SIZE Problem size: 50, 100, for automatic loading --datasets DATASETS Filename of the dataset(s) to evaluate. Defaults to all under data/{problem}/ dir --batchsize BATCHSIZE --device DEVICE --remove-mixed-backhaul, --no-remove-mixed-backhaul Remove mixed backhaul instances. Use --no-remove-mixed-backhaul to keep them. (default: True) ```
We also have a notebook to automatically download and test models on the CVRPLIB here!
Other scripts
Data generation: We also include scripts to re-generate data manually (reproducible via random seeds) with
python scripts/generate_data.py.Classical baselines (OR-Tools and HGS-PyVRP): We additionally include a script to solve the problems using classical baselines with e.g.
python scripts/run_or_solvers.py --num_procs 20 --solver pyvrpto run PyVRP with 20 processes on all the dataset.
🔁 Reproducing Experiments
Main Experiments
The main experiments on 100 nodes are (rf=RouteFinder) RF-TE: rf/rf-transformer-100, RF-POMO: rf/rf-100, RF-MoE: rf/rf-moe-100, MTPOMO mtpomo-100 and MVMoE mvmoe-100. You may substitute 50 instead for 50 nodes. Note that we separate 50 and 100 because we created an automatic validation dataset reporting for all variants at different sizes (i.e. here).
Note that additional Hydra options as described here. For instance, you can add +trainer.devices="[0]" to run on a specific GPU (i.e., GPU 0).
Ablations and more
Other configs are available under configs/experiment directory.
EAL (Efficient Adapter Layers)
To run EAL, you may use the following command:
bash
python run_eal.py
with the following parameters:
``` usage: runeal.py [-h] [--modeltype MODELTYPE] [--experiment EXPERIMENT] [--variantsfinetune VARIANTSFINETUNE] [--checkpoint CHECKPOINT] [--lr LR] [--numruns NUM_RUNS]
options: -h, --help show this help message and exit --modeltype MODELTYPE Model type: rf, mvmoe, mtpomo --experiment EXPERIMENT Experiment type --variantsfinetune VARIANTSFINETUNE Variants to finetune on --checkpoint CHECKPOINT --lr LR --numruns NUMRUNS ```
with additional parameters that can be found in the eal.py file.
Development
To test automatically if the code works, you can run:
bash
python -m pytest tests/*
🚚 Available Environments
We consider 48 VRP variants. All variants include the base Capacity (C). The $k=5$ features O, B, L, TW, and MD can be combined into any subset, including the empty set and itself (i.e., a power set with $2^k = 32$ possible combinations. The Mixed (M) global feature creates new Mixed Backhaul (MB) variants in generalization studies, adding 16 more variants. We have the following environments available:
| VRP Variant | Capacity (C) | Open Route (O) | Backhaul (B) | Mixed (M) | Duration Limit (L) | Time Windows (TW) | Multi-depot (MD) | |------------------|:----------------:|:------------------:|:----------------:|:-------------:|:----------------------:|:---------------------:|:-------------------:| | CVRP | ✔ | | | | | | | | OVRP | ✔ | ✔ | | | | | | | VRPB | ✔ | | ✔ | | | | | | VRPL | ✔ | | | | ✔ | | | | VRPTW | ✔ | | | | | ✔ | | | OVRPTW | ✔ | ✔ | | | | ✔ | | | OVRPB | ✔ | ✔ | ✔ | | | | | | OVRPL | ✔ | ✔ | | | ✔ | | | | VRPBL | ✔ | | ✔ | | ✔ | | | | VRPBTW | ✔ | | ✔ | | | ✔ | | | VRPLTW | ✔ | | | | ✔ | ✔ | | | OVRPBL | ✔ | ✔ | ✔ | | ✔ | | | | OVRPBTW | ✔ | ✔ | ✔ | | | ✔ | | | OVRPLTW | ✔ | ✔ | | | ✔ | ✔ | | | VRPBLTW | ✔ | | ✔ | | ✔ | ✔ | | | OVRPBLTW | ✔ | ✔ | ✔ | | ✔ | ✔ | | | VRPMB | ✔ | | ✔ | ✔ | | | | | OVRPMB | ✔ | ✔ | ✔ | ✔ | | | | | VRPMBL | ✔ | | ✔ | ✔ | ✔ | | | | VRPMBTW | ✔ | | ✔ | ✔ | | ✔ | | | OVRPMBL | ✔ | ✔ | ✔ | ✔ | ✔ | | | | OVRPMBTW | ✔ | ✔ | ✔ | ✔ | | ✔ | | | VRPMBLTW | ✔ | | ✔ | ✔ | ✔ | ✔ | | | OVRPMBLTW | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | | MDCVRP | ✔ | | | | | | ✔ | | MDOVRP | ✔ | ✔ | | | | | ✔ | | MDVRPB | ✔ | | ✔ | | | | ✔ | | MDVRPL | ✔ | | | | ✔ | | ✔ | | MDVRPTW | ✔ | | | | | ✔ | ✔ | | MDOVRPTW | ✔ | ✔ | | | | ✔ | ✔ | | MDOVRPB | ✔ | ✔ | ✔ | | | | ✔ | | MDOVRPL | ✔ | ✔ | | | ✔ | | ✔ | | MDVRPBL | ✔ | | ✔ | | ✔ | | ✔ | | MDVRPBTW | ✔ | | ✔ | | | ✔ | ✔ | | MDVRPLTW | ✔ | | | | ✔ | ✔ | ✔ | | MDOVRPBL | ✔ | ✔ | ✔ | | ✔ | | ✔ | | MDOVRPBTW | ✔ | ✔ | ✔ | | | ✔ | ✔ | | MDOVRPLTW | ✔ | ✔ | | | ✔ | ✔ | ✔ | | MDVRPBLTW | ✔ | | ✔ | | ✔ | ✔ | ✔ | | MDOVRPBLTW | ✔ | ✔ | ✔ | | ✔ | ✔ | ✔ | | MDVRPMB | ✔ | | ✔ | ✔ | | | ✔ | | MDOVRPMB | ✔ | ✔ | ✔ | ✔ | | | ✔ | | MDVRPMBL | ✔ | | ✔ | ✔ | ✔ | | ✔ | | MDVRPMBTW | ✔ | | ✔ | ✔ | | ✔ | ✔ | | MDOVRPMBL | ✔ | ✔ | ✔ | ✔ | ✔ | | ✔ | | MDOVRPMBTW | ✔ | ✔ | ✔ | ✔ | | ✔ | ✔ | | MDVRPMBLTW | ✔ | | ✔ | ✔ | ✔ | ✔ | ✔ | | MDOVRPMBLTW | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
We additionally provide as baseline solvers for all baselines 1) OR-Tools and 2) the SotA PyVRP.
A tip for you!
Do you want to improve the performance of your model with no effort? Use our Transformer structure, based on recent models such as Llama and DeepSeek ;)
Known Bugs
- For some reason, there seem to be bugs when training on M series processors from Apple (but not during inference somehow?). We recommend training with a discrete GPU. We'll keep you posted with updates!
🤗 Acknowledgements
- https://github.com/FeiLiu36/MTNCO/tree/main
- https://github.com/RoyalSkye/Routing-MVMoE
- https://github.com/yd-kwon/POMO
- https://github.com/ai4co/rl4co
🤩 Citation
If you find RouteFinder valuable for your research or applied projects:
@inproceedings{berto2024routefinder,
title={{RouteFinder}: Towards Foundation Models for Vehicle Routing Problems},
author={Berto, Federico and Hua, Chuanbo and Zepeda, Nayeli Gast and Hottung, Andr{\'e} and Wouda, Niels and Lan, Leon and Tierney, Kevin and Park, Jinkyoo},
booktitle={ICML 2024 Workshop on Foundation Models in the Wild (Oral)},
year={2024},
url={https://openreview.net/forum?id=hCiaiZ6e4G},
note={\url{https://github.com/ai4co/routefinder}}
}
Owner
- Name: ai4co
- Login: ai4co
- Kind: organization
- Repositories: 1
- Profile: https://github.com/ai4co
GitHub Events
Total
- Create event: 5
- Issues event: 6
- Release event: 2
- Watch event: 28
- Issue comment event: 16
- Push event: 5
- Fork event: 8
Last Year
- Create event: 5
- Issues event: 6
- Release event: 2
- Watch event: 28
- Issue comment event: 16
- Push event: 5
- Fork event: 8
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 5
- Total pull requests: 0
- Average time to close issues: about 2 months
- Average time to close pull requests: N/A
- Total issue authors: 5
- Total pull request authors: 0
- Average comments per issue: 1.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 4
- Pull requests: 0
- Average time to close issues: about 2 months
- Average time to close pull requests: N/A
- Issue authors: 4
- Pull request authors: 0
- Average comments per issue: 1.25
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- zcaicaros (1)
- lsyysl9711 (1)
- kevinnudt12 (1)
- hanseul-jeong (1)
- gshuangchun (1)
- Learner23333 (1)