Skip to content

Commit 799150e

Browse files
authored
Merge pull request #270 from ai4co/v0.6.0
Updates for v0.6.0 and KDD publication
2 parents 3ccf183 + f284628 commit 799150e

File tree

9 files changed

+53
-58
lines changed

9 files changed

+53
-58
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,24 @@
33
fail_fast: true
44

55
repos:
6-
76
- repo: https://github.com/psf/black
8-
rev: 24.4.2
7+
rev: 25.1.0
98
hooks:
109
- id: black
1110
args: [--config, pyproject.toml]
1211
types: [python]
1312

14-
1513
- repo: https://github.com/astral-sh/ruff-pre-commit
16-
rev: v0.4.8
14+
rev: v0.11.0
1715
hooks:
1816
- id: ruff
1917
args: [ --fix ]
2018

21-
22-
- repo: https://github.com/pre-commit/pre-commit-hooks
23-
rev: v4.6.0
24-
hooks:
25-
- id: check-toml
26-
id: check-yaml
27-
id: detect-private-key
28-
id: end-of-file-fixer
29-
id: trailing-whitespace
19+
- repo: https://github.com/pre-commit/pre-commit-hooks
20+
rev: v5.0.0
21+
hooks:
22+
- id: check-toml
23+
- id: check-yaml
24+
- id: detect-private-key
25+
- id: end-of-file-fixer
26+
- id: trailing-whitespace

CITATION.cff

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cff-version: 1.2.0
22
message: If you use this software, please cite it as below.
33
title: RL4CO
44
authors:
5-
- family-names: RL4CO Team
5+
- family-names: AI4CO
66
url: https://github.com/ai4co/rl4co
77

88
preferred-citation:
@@ -71,8 +71,8 @@ preferred-citation:
7171
given-names: Jinkyoo
7272

7373

74-
collection-title: arXiv
75-
year: 2024
76-
url: https://arxiv.org/abs/2306.17100
74+
collection-title: KDD
75+
year: 2025
76+
url: https://github.com/ai4co/rl4co
7777

7878

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<a href="https://github.com/pytorch/rl"><img alt="base: TorchRL" src="https://img.shields.io/badge/base-TorchRL-red"></a>
1212
<a href="https://hydra.cc/"><img alt="config: Hydra" src="https://img.shields.io/badge/config-Hydra-89b8cd"></a>
1313
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
14-
<a href="https://join.slack.com/t/rl4co/shared_invite/zt-1ytz2c1v4-0IkQ8NQH4TRXIX8PrRmDhQ"><img alt="Slack" src="https://img.shields.io/badge/slack-chat-611f69.svg?logo=slack"></a>
14+
<a href="https://join.slack.com/t/ai4co-community/shared_invite/zt-1ytz2c1v4-0IkQ8NQH4TRXIX8PrRmDhQ"><img alt="Slack" src="https://img.shields.io/badge/slack-chat-611f69.svg?logo=slack"></a>
1515
<a href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-red.svg"></a>
1616
<a href="https://colab.research.google.com/github/ai4co/rl4co/blob/main/examples/1-quickstart.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
1717
<a href="https://pypi.org/project/rl4co"><img alt="PyPI" src="https://img.shields.io/pypi/v/rl4co?logo=pypi"></a>
@@ -82,16 +82,16 @@ pip install -U git+https://github.com/ai4co/rl4co.git
8282
```
8383

8484
### Local install and development
85-
If you want to develop RL4CO we recommend you to install it locally with `pip` in editable mode:
85+
86+
We recommend local development with the blazing-fast [`uv`](https://docs.astral.sh/uv/) package manager, for instance:
8687

8788
```bash
8889
git clone https://github.com/ai4co/rl4co && cd rl4co
89-
pip install -e .
90+
uv sync --all-extras
91+
source .venv/bin/activate
9092
```
9193

92-
We recommend installing in virtual environments with a package manager such as the blazing-fast [`uv`](https://docs.astral.sh/uv/), [`poetry`](https://python-poetry.org/), or [`conda`](https://docs.conda.io/en/latest/); instruction are available in the [documentation](https://rl4.co/docs/content/start/installation/).
93-
94-
94+
This will create a new virtual environment in `.venv/` and install all dependencies.
9595

9696
## Usage
9797

@@ -181,7 +181,7 @@ You may check out the [issues](https://github.com/ai4co/rl4co/issues) and [discu
181181
Have a suggestion, request, or found a bug? Feel free to [open an issue](https://github.com/ai4co/rl4co/issues) or [submit a pull request](https://github.com/ai4co/rl4co/pulls).
182182
If you would like to contribute, please check out our contribution guidelines [here](.github/CONTRIBUTING.md). We welcome and look forward to all contributions to RL4CO!
183183

184-
We are also on [Slack](https://join.slack.com/t/rl4co/shared_invite/zt-1ytz2c1v4-0IkQ8NQH4TRXIX8PrRmDhQ) if you have any questions or would like to discuss RL4CO with us. We are open to collaborations and would love to hear from you 🚀
184+
We are also on [Slack](https://join.slack.com/t/ai4co-community/shared_invite/zt-1ytz2c1v4-0IkQ8NQH4TRXIX8PrRmDhQ) if you have any questions or would like to discuss RL4CO with us. We are open to collaborations and would love to hear from you 🚀
185185

186186
### Contributors
187187
<a href="https://github.com/ai4co/rl4co/graphs/contributors">
@@ -192,22 +192,22 @@ We are also on [Slack](https://join.slack.com/t/rl4co/shared_invite/zt-1ytz2c1v4
192192
If you find RL4CO valuable for your research or applied projects:
193193

194194
```bibtex
195-
@article{berto2024rl4co,
195+
@inproceedings{berto2025rl4co,
196196
title={{RL4CO: an Extensive Reinforcement Learning for Combinatorial Optimization Benchmark}},
197197
author={Federico Berto and Chuanbo Hua and Junyoung Park and Laurin Luttmann and Yining Ma and Fanchen Bu and Jiarui Wang and Haoran Ye and Minsu Kim and Sanghyeok Choi and Nayeli Gast Zepeda and Andr\'e Hottung and Jianan Zhou and Jieyi Bi and Yu Hu and Fei Liu and Hyeonah Kim and Jiwoo Son and Haeyeon Kim and Davide Angioni and Wouter Kool and Zhiguang Cao and Jie Zhang and Kijung Shin and Cathy Wu and Sungsoo Ahn and Guojie Song and Changhyun Kwon and Lin Xie and Jinkyoo Park},
198-
year={2024},
199-
journal={arXiv preprint arXiv:2306.17100},
200-
note={\url{https://github.com/ai4co/rl4co}}
198+
booktitle={Proceedings of the 31st ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
199+
year={2025},
200+
url={https://github.com/ai4co/rl4co}
201201
}
202202
```
203203

204-
Note that a [previous version of RL4CO](https://openreview.net/forum?id=YXSJxi8dOV) has been accepted as an oral presentation at the [NeurIPS 2023 GLFrontiers Workshop](https://glfrontiers.github.io/). Since then, the library has greatly evolved and improved!
204+
Note that a [previous version of RL4CO](https://openreview.net/forum?id=YXSJxi8dOV) was also accepted as an oral presentation at the [NeurIPS 2023 GLFrontiers Workshop](https://glfrontiers.github.io/). Since then, the library has greatly evolved and improved!
205205

206206
---
207207

208208

209209
## Join us
210-
[![Slack](https://img.shields.io/badge/slack-chat-611f69.svg?logo=slack)](https://join.slack.com/t/rl4co/shared_invite/zt-1ytz2c1v4-0IkQ8NQH4TRXIX8PrRmDhQ)
210+
[![Slack](https://img.shields.io/badge/slack-chat-611f69.svg?logo=slack)](https://join.slack.com/t/ai4co-community/shared_invite/zt-1ytz2c1v4-0IkQ8NQH4TRXIX8PrRmDhQ)
211211

212212
We invite you to join our AI4CO community, an open research group in Artificial Intelligence (AI) for Combinatorial Optimization (CO)!
213213

docs/content/general/contribute.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Contributing to RL4CO
22

3-
[![Slack](https://img.shields.io/badge/slack-chat-611f69.svg?logo=slack)](https://join.slack.com/t/rl4co/shared_invite/zt-1ytz2c1v4-0IkQ8NQH4TRXIX8PrRmDhQ)
3+
[![Slack](https://img.shields.io/badge/slack-chat-611f69.svg?logo=slack)](https://join.slack.com/t/ai4co-community/shared_invite/zt-1ytz2c1v4-0IkQ8NQH4TRXIX8PrRmDhQ)
44

55
Have a suggestion, request, or found a bug? Feel free to [open an issue](https://github.com/ai4co/rl4co/issues) or [submit a pull request](https://github.com/ai4co/rl4co/pulls).
66
If you would like to contribute, please check out our contribution guidelines [here](https://github.com/ai4co/rl4co/blob/main/.github/CONTRIBUTING.md). We welcome and look forward to all contributions to RL4CO!
77

8-
We are also on [Slack](https://join.slack.com/t/rl4co/shared_invite/zt-1ytz2c1v4-0IkQ8NQH4TRXIX8PrRmDhQ) if you have any questions or would like to discuss RL4CO with us. We are open to collaborations and would love to hear from you 🚀
8+
We are also on [Slack](https://join.slack.com/t/ai4co-community/shared_invite/zt-1ytz2c1v4-0IkQ8NQH4TRXIX8PrRmDhQ) if you have any questions or would like to discuss RL4CO with us. We are open to collaborations and would love to hear from you 🚀
99

1010

1111
## Contributors
1212
<a href="https://github.com/ai4co/rl4co/graphs/contributors">
1313
<img src="https://contrib.rocks/image?repo=ai4co/rl4co" />
14-
</a>
14+
</a>

docs/content/general/paper.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ Our paper is available [here](https://arxiv.org/abs/2306.17100) for further deta
55
If you find RL4CO valuable for your research or applied projects, don't forget to cite us! 🚀
66

77
```bibtex
8-
@article{berto2024rl4co,
8+
@inproceedings{berto2025rl4co,
99
title={{RL4CO: an Extensive Reinforcement Learning for Combinatorial Optimization Benchmark}},
1010
author={Federico Berto and Chuanbo Hua and Junyoung Park and Laurin Luttmann and Yining Ma and Fanchen Bu and Jiarui Wang and Haoran Ye and Minsu Kim and Sanghyeok Choi and Nayeli Gast Zepeda and Andr\'e Hottung and Jianan Zhou and Jieyi Bi and Yu Hu and Fei Liu and Hyeonah Kim and Jiwoo Son and Haeyeon Kim and Davide Angioni and Wouter Kool and Zhiguang Cao and Jie Zhang and Kijung Shin and Cathy Wu and Sungsoo Ahn and Guojie Song and Changhyun Kwon and Lin Xie and Jinkyoo Park},
11-
year={2024},
12-
journal={arXiv preprint arXiv:2306.17100},
13-
note={\url{https://github.com/ai4co/rl4co}}
11+
booktitle={Proceedings of the 31st ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
12+
year={2025},
13+
url={https://github.com/ai4co/rl4co}
1414
}
1515
```

docs/content/intro/intro.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ Our paper is available [here](https://arxiv.org/abs/2306.17100) for further deta
3939
If you find RL4CO valuable for your research or applied projects, don't forget to cite us! 🚀
4040

4141
```bibtex
42-
@article{berto2024rl4co,
42+
@inproceedings{berto2025rl4co,
4343
title={{RL4CO: an Extensive Reinforcement Learning for Combinatorial Optimization Benchmark}},
4444
author={Federico Berto and Chuanbo Hua and Junyoung Park and Laurin Luttmann and Yining Ma and Fanchen Bu and Jiarui Wang and Haoran Ye and Minsu Kim and Sanghyeok Choi and Nayeli Gast Zepeda and Andr\'e Hottung and Jianan Zhou and Jieyi Bi and Yu Hu and Fei Liu and Hyeonah Kim and Jiwoo Son and Haeyeon Kim and Davide Angioni and Wouter Kool and Zhiguang Cao and Jie Zhang and Kijung Shin and Cathy Wu and Sungsoo Ahn and Guojie Song and Changhyun Kwon and Lin Xie and Jinkyoo Park},
45-
year={2024},
46-
journal={arXiv preprint arXiv:2306.17100},
47-
note={\url{https://github.com/ai4co/rl4co}}
45+
booktitle={Proceedings of the 31st ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
46+
year={2025},
47+
url={https://github.com/ai4co/rl4co}
4848
}
4949
```

docs/content/start/installation.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ pip install uv
3232
```
3333

3434
Then, you can create a virtual environment locally and activate it:
35+
3536
```bash
36-
uv sync
37+
git clone https://github.com/ai4co/rl4co && cd rl4co
38+
uv sync --all-extras
3739
source .venv/bin/activate
3840
```
3941

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "rl4co"
3-
version = "0.5.2"
3+
version = "0.6.0"
44
description = "RL4CO: an Extensive Reinforcement Learning for Combinatorial Optimization Benchmark"
55
authors = [
66
{ name = "Federico Berto", email = "[email protected]" },
@@ -79,6 +79,7 @@ dev = [
7979
"ruff",
8080
"pytest",
8181
"pytest-cov",
82+
"pytest-xdist>=3.7.0",
8283
]
8384
graph = ["torch_geometric"]
8485
routing = [

rl4co/envs/routing/shpp/env.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
import torch
44

55
from tensordict.tensordict import TensorDict
6-
from torchrl.data import (
7-
BoundedTensorSpec,
8-
CompositeSpec,
9-
UnboundedContinuousTensorSpec,
10-
UnboundedDiscreteTensorSpec,
11-
)
6+
from torchrl.data import Bounded, Composite, UnboundedContinuous, UnboundedDiscrete
127

138
from rl4co.envs.common.base import RL4COEnvBase
149
from rl4co.utils.ops import gather_by_index, get_tour_length
@@ -153,36 +148,36 @@ def render(td: TensorDict, actions: torch.Tensor = None, ax=None):
153148

154149
def _make_spec(self, generator):
155150
"""Make the observation and action specs from the parameters"""
156-
self.observation_spec = CompositeSpec(
157-
locs=BoundedTensorSpec(
151+
self.observation_spec = Composite(
152+
locs=Bounded(
158153
low=generator.min_loc,
159154
high=generator.max_loc,
160155
shape=(generator.num_loc, 2),
161156
dtype=torch.float32,
162157
),
163-
first_node=UnboundedDiscreteTensorSpec(
158+
first_node=UnboundedDiscrete(
164159
shape=(1),
165160
dtype=torch.int64,
166161
),
167-
current_node=UnboundedDiscreteTensorSpec(
162+
current_node=UnboundedDiscrete(
168163
shape=(1),
169164
dtype=torch.int64,
170165
),
171-
i=UnboundedDiscreteTensorSpec(
166+
i=UnboundedDiscrete(
172167
shape=(1),
173168
dtype=torch.int64,
174169
),
175-
action_mask=UnboundedDiscreteTensorSpec(
170+
action_mask=UnboundedDiscrete(
176171
shape=(generator.num_loc),
177172
dtype=torch.bool,
178173
),
179174
shape=(),
180175
)
181-
self.action_spec = BoundedTensorSpec(
176+
self.action_spec = Bounded(
182177
shape=(1,),
183178
dtype=torch.int64,
184179
low=0,
185180
high=generator.num_loc,
186181
)
187-
self.reward_spec = UnboundedContinuousTensorSpec(shape=(1,))
188-
self.done_spec = UnboundedDiscreteTensorSpec(shape=(1,), dtype=torch.bool)
182+
self.reward_spec = UnboundedContinuous(shape=(1,))
183+
self.done_spec = UnboundedDiscrete(shape=(1,), dtype=torch.bool)

0 commit comments

Comments
 (0)