Improve model card: Add pipeline tag, paper link, abstract, code link, and usage examples
#3
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,7 +1,124 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
| 3 |
---
|
| 4 |
|
| 5 |
-
# RouteFinder
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
pipeline_tag: reinforcement-learning
|
| 4 |
---
|
| 5 |
|
| 6 |
+
# RouteFinder: Towards Foundation Models for Vehicle Routing Problems
|
| 7 |
|
| 8 |
+
This repository contains the checkpoints for **RouteFinder**, a comprehensive foundation model framework designed to tackle different Vehicle Routing Problem (VRP) variants, as presented in the paper [RouteFinder: Towards Foundation Models for Vehicle Routing Problems](https://huggingface.co/papers/2406.15007).
|
| 9 |
+
|
| 10 |
+
## Abstract
|
| 11 |
+
This paper introduces RouteFinder, a comprehensive foundation model framework to tackle different Vehicle Routing Problem (VRP) variants. Our core idea is that a foundation model for VRPs should be able to represent variants by treating each as a subset of a generalized problem equipped with different attributes. We propose a unified VRP environment capable of efficiently handling any combination of these attributes. The RouteFinder model leverages a modern transformer-based encoder and global attribute embeddings to improve task representation. Additionally, we introduce two reinforcement learning techniques to enhance multi-task performance: mixed batch training, which enables training on different variants at once, and multi-variant reward normalization to balance different reward scales. Finally, we propose efficient adapter layers that enable fine-tuning for new variants with unseen attributes. Extensive experiments on 48 VRP variants show RouteFinder outperforms recent state-of-the-art learning methods. Our code is publicly available at this https URL .
|
| 12 |
+
|
| 13 |
+
## Code
|
| 14 |
+
The official code repository is available at: [https://github.com/ai4co/routefinder](https://github.com/ai4co/routefinder)
|
| 15 |
+
|
| 16 |
+
## Model Overview
|
| 17 |
+
<div align="center">
|
| 18 |
+
<img src="https://github.com/ai4co/routefinder/raw/main/assets/overview.png" alt="RouteFinder Overview" style="width: 100%; height: auto;">
|
| 19 |
+
</div>
|
| 20 |
+
|
| 21 |
+
## ๐ Installation
|
| 22 |
+
|
| 23 |
+
We use [uv](https://github.com/astral-sh/uv) (Python package manager) to manage the dependencies:
|
| 24 |
+
|
| 25 |
+
```bash
|
| 26 |
+
uv venv --python 3.12 # create a new virtual environment
|
| 27 |
+
source .venv/bin/activate # activate the virtual environment
|
| 28 |
+
uv sync --all-extras # for all dependencies
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
Note that this project is also compatible with normal `pip install -e .` in case you use a different package manager.
|
| 32 |
+
|
| 33 |
+
## ๐ Quickstart
|
| 34 |
+
|
| 35 |
+
### Download data and checkpoints
|
| 36 |
+
|
| 37 |
+
To download the data and checkpoints from HuggingFace automatically, you can use:
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
python scripts/download_hf.py
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
### Running
|
| 44 |
+
|
| 45 |
+
We recommend exploring [this quickstart notebook](https://github.com/ai4co/routefinder/blob/main/examples/1.quickstart.ipynb) to get started with the `RouteFinder` codebase!
|
| 46 |
+
|
| 47 |
+
The main runner (example here of main baseline) can be called via:
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
python run.py experiment=main/rf/rf-transformer-100
|
| 51 |
+
```
|
| 52 |
+
You may change the experiment by using the `experiment=YOUR_EXP`, with the path under [`configs/experiment`](https://github.com/ai4co/routefinder/tree/main/configs/experiment) directory.
|
| 53 |
+
|
| 54 |
+
### Testing
|
| 55 |
+
|
| 56 |
+
You may use the provided test function to test the model:
|
| 57 |
+
|
| 58 |
+
```bash
|
| 59 |
+
python test.py --checkpoint checkpoints/100/rf-transformer.ckpt
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
or with additional parameters:
|
| 63 |
+
|
| 64 |
+
```
|
| 65 |
+
usage: test.py [-h] --checkpoint CHECKPOINT [--problem PROBLEM] [--size SIZE] [--datasets DATASETS] [--batch_size BATCH_SIZE]
|
| 66 |
+
[--device DEVICE] [--remove-mixed-backhaul | --no-remove-mixed-backhaul]
|
| 67 |
+
|
| 68 |
+
options:
|
| 69 |
+
-h, --help show this help message and exit
|
| 70 |
+
--checkpoint CHECKPOINT
|
| 71 |
+
Path to the model checkpoint
|
| 72 |
+
--problem PROBLEM Problem name: cvrp, vrptw, etc. or all
|
| 73 |
+
--size SIZE Problem size: 50, 100, for automatic loading
|
| 74 |
+
--datasets DATASETS Filename of the dataset(s) to evaluate. Defaults to all under data/{problem}/ dir
|
| 75 |
+
--batch_size BATCH_SIZE
|
| 76 |
+
--device DEVICE
|
| 77 |
+
--remove-mixed-backhaul, --no-remove-mixed-backhaul
|
| 78 |
+
Remove mixed backhaul instances. Use --no-remove-mixed-backhaul to keep them. (default: True)
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
We also have a notebook to automatically download and test models on the CVRPLIB [here](https://github.com/ai4co/routefinder/blob/main/examples/2.eval-cvrplib.ipynb)!
|
| 82 |
+
|
| 83 |
+
## ๐ Available Environments
|
| 84 |
+
|
| 85 |
+
RouteFinder considers 48 VRP variants, which are detailed in the [GitHub repository](https://github.com/ai4co/routefinder) under the "Available Environments" section. These variants combine different features such as Capacity (C), Open Route (O), Backhaul (B), Mixed (M), Duration Limit (L), Time Windows (TW), and Multi-depot (MD).
|
| 86 |
+
|
| 87 |
+
## A tip for you!
|
| 88 |
+
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 ;)
|
| 89 |
+
|
| 90 |
+
<div align="center">
|
| 91 |
+
<img src="https://github.com/ai4co/routefinder/raw/main/assets/rf-te.png" alt="RouteFinder Transformer Structure" style="width: 50%; height: auto;">
|
| 92 |
+
</div>
|
| 93 |
+
|
| 94 |
+
## Known Bugs
|
| 95 |
+
- 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!
|
| 96 |
+
|
| 97 |
+
## ๐ค Acknowledgements
|
| 98 |
+
- https://github.com/FeiLiu36/MTNCO/tree/main
|
| 99 |
+
- https://github.com/RoyalSkye/Routing-MVMoE
|
| 100 |
+
- https://github.com/yd-kwon/POMO
|
| 101 |
+
- https://github.com/ai4co/rl4co
|
| 102 |
+
|
| 103 |
+
## ๐คฉ Citation
|
| 104 |
+
If you find RouteFinder valuable for your research or applied projects:
|
| 105 |
+
|
| 106 |
+
```bibtex
|
| 107 |
+
@article{
|
| 108 |
+
berto2025routefinder,
|
| 109 |
+
title={{RouteFinder: Towards Foundation Models for Vehicle Routing Problems}},
|
| 110 |
+
author={Federico Berto and Chuanbo Hua and Nayeli Gast Zepeda and Andr{\'e} Hottung and Niels Wouda and Leon Lan and Junyoung Park and Kevin Tierney and Jinkyoo Park},
|
| 111 |
+
journal={Transactions on Machine Learning Research},
|
| 112 |
+
issn={2835-8856},
|
| 113 |
+
year={2025},
|
| 114 |
+
url={https://openreview.net/forum?id=QzGLoaOPiY},
|
| 115 |
+
}
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
---
|
| 119 |
+
|
| 120 |
+
<div align="center">
|
| 121 |
+
<a href="https://github.com/ai4co">
|
| 122 |
+
<img src="https://raw.githubusercontent.com/ai4co/assets/main/svg/ai4co_animated_full.svg" alt="AI4CO Logo" style="width: 30%; height: auto;">
|
| 123 |
+
</a>
|
| 124 |
+
</div>
|