rl4co 0.0.3.dev1__tar.gz → 0.0.3.dev3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/PKG-INFO +12 -10
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/README.md +11 -9
- rl4co-0.0.3.dev3/rl4co/__init__.py +1 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/tsp.py +12 -44
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co.egg-info/PKG-INFO +12 -10
- rl4co-0.0.3.dev1/rl4co/__init__.py +0 -1
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/LICENSE +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/pyproject.toml +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/data/__init__.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/data/dataset.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/data/generate_data.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/data/utils.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/__init__.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/atsp.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/base.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/cvrp.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/dpp.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/ffsp.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/mdpp.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/mtsp.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/op.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/pctsp.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/pdp.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/sdvrp.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/envs/utils.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/__init__.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/nn/attention.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/nn/env_context.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/nn/env_embedding.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/nn/flash_attention.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/nn/graph/gat.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/nn/graph/gcn.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/nn/graph/mpnn.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/nn/mlp.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/nn/ops.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/nn/utils.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/rl/ppo/model.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/rl/ppo/task.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/rl/reinforce/base.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/rl/reinforce/baselines.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/rl/reinforce/critic.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/am/__init__.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/am/decoder.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/am/model.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/am/policy.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/amppo/decoder.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/amppo/model.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/amppo/policy.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/ham/__init__.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/ham/attention.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/ham/encoder.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/ham/model.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/ham/policy.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/mdam/__init__.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/mdam/decoder.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/mdam/encoder.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/mdam/model.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/mdam/policy.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/pomo/__init__.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/pomo/augmentations.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/pomo/decoder.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/pomo/model.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/pomo/policy.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/ptrnet/__init__.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/ptrnet/critic.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/ptrnet/decoder.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/ptrnet/encoder.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/ptrnet/model.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/ptrnet/policy.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/symnco/__init__.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/symnco/augmentations.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/symnco/decoder.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/symnco/losses.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/symnco/model.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/models/zoo/symnco/policy.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/tasks/eval.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/tasks/rl4co.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/__init__.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/callbacks/speed_monitor.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/download/constants.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/download/downloader.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/download/gdrive.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/download/s3.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/helpers.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/instantiators.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/lightning.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/logging_utils.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/ops.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/param_grouping.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/pylogger.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/rich_utils.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/test_utils.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/transfer.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co/utils/utils.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co.egg-info/SOURCES.txt +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co.egg-info/dependency_links.txt +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co.egg-info/requires.txt +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/rl4co.egg-info/top_level.txt +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/setup.cfg +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/tests/test_envs.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/tests/test_models.py +0 -0
- {rl4co-0.0.3.dev1 → rl4co-0.0.3.dev3}/tests/test_ops.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rl4co
|
|
3
|
-
Version: 0.0.3.
|
|
3
|
+
Version: 0.0.3.dev3
|
|
4
4
|
Summary: RL4CO: an Extensive Reinforcement Learning for Combinatorial Optimization Benchmark
|
|
5
5
|
Author-email: Federico Berto <berto.federico2@gmail.com>, Chuanbo Hua <cbhua@kaist.ac.kr>, Junyoung Park <junyoungpark.ml@gmail.com>
|
|
6
6
|
License: Apache License
|
|
@@ -224,14 +224,15 @@ License-File: LICENSE
|
|
|
224
224
|
<div align="center">
|
|
225
225
|
|
|
226
226
|
# RL4CO
|
|
227
|
-
|
|
228
|
-
An extensive Reinforcement Learning (RL) for Combinatorial Optimization (CO) benchmark. Our goal is to provide a unified framework for RL-based CO algorithms, and to facilitate reproducible research in this field, decoupling the science from the engineering.
|
|
229
|
-
|
|
227
|
+
|
|
228
|
+
An extensive Reinforcement Learning (RL) for Combinatorial Optimization (CO) benchmark. Our goal is to provide a unified framework for RL-based CO algorithms, and to facilitate reproducible research in this field, decoupling the science from the engineering.
|
|
229
|
+
|
|
230
230
|
<a href="https://pytorch.org/get-started/locally/"><img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-ee4c2c?logo=pytorch&logoColor=white"></a>
|
|
231
231
|
<a href="https://pytorchlightning.ai/"><img alt="Lightning" src="https://img.shields.io/badge/-Lightning-792ee5?logo=pytorchlightning&logoColor=white"></a>
|
|
232
232
|
<a href="https://github.com/pytorch/rl"><img alt="base: TorchRL" src="https://img.shields.io/badge/base-TorchRL-red">
|
|
233
233
|
<a href="https://hydra.cc/"><img alt="config: Hydra" src="https://img.shields.io/badge/config-Hydra-89b8cd"></a> [](https://github.com/psf/black)
|
|
234
|
-

|
|
234
|
+
[](https://pypi.org/project/rl4co)
|
|
235
|
+
[](https://github.com/kaist-silab/rl4co/actions/workflows/tests.yml)
|
|
235
236
|
<!--  -->
|
|
236
237
|
|
|
237
238
|
</div>
|
|
@@ -247,6 +248,7 @@ RL4CO is built upon:
|
|
|
247
248
|
|
|
248
249
|
|
|
249
250
|
## Getting started
|
|
251
|
+
<a href="https://colab.research.google.com/github/kaist-silab/rl4co/blob/main/notebooks/1-quickstart.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
|
|
250
252
|
|
|
251
253
|
RL4CO is now available for installation on `pip`!
|
|
252
254
|
```bash
|
|
@@ -283,7 +285,7 @@ To get started, we recommend checking out our [quickstart notebook](notebooks/1-
|
|
|
283
285
|
|
|
284
286
|
Train model with default configuration (AM on TSP environment):
|
|
285
287
|
```bash
|
|
286
|
-
python run.py
|
|
288
|
+
python run.py
|
|
287
289
|
```
|
|
288
290
|
|
|
289
291
|
|
|
@@ -293,14 +295,14 @@ python run.py
|
|
|
293
295
|
|
|
294
296
|
Train model with chosen experiment configuration from [configs/experiment/](configs/experiment/) (e.g. tsp/am, and environment with 42 cities)
|
|
295
297
|
```bash
|
|
296
|
-
python run.py experiment=tsp/am env.num_loc=42
|
|
298
|
+
python run.py experiment=tsp/am env.num_loc=42
|
|
297
299
|
```
|
|
298
300
|
</details>
|
|
299
301
|
|
|
300
302
|
|
|
301
303
|
<details>
|
|
302
304
|
<summary>Disable logging</summary>
|
|
303
|
-
|
|
305
|
+
|
|
304
306
|
```bash
|
|
305
307
|
python run.py experiment=test/am logger=none '~callbacks.learning_rate_monitor'
|
|
306
308
|
```
|
|
@@ -333,7 +335,7 @@ from rl4co.tasks.rl4co import RL4COLitModule
|
|
|
333
335
|
config = DictConfig(
|
|
334
336
|
{"data": {
|
|
335
337
|
"train_size": 100000,
|
|
336
|
-
"val_size": 10000,
|
|
338
|
+
"val_size": 10000,
|
|
337
339
|
"batch_size": 512,
|
|
338
340
|
},
|
|
339
341
|
"optimizer": {"lr": 1e-4}}
|
|
@@ -368,7 +370,7 @@ pytest tests
|
|
|
368
370
|
```
|
|
369
371
|
|
|
370
372
|
## Contributing
|
|
371
|
-
Have a suggestion, request, or found a bug? Feel free to [open an issue](https://github.com/kaist-silab/rl4co/issues) or [submit a pull request](https://github.com/kaist-silab/rl4co/pulls). We welcome contributions to RL4CO!
|
|
373
|
+
Have a suggestion, request, or found a bug? Feel free to [open an issue](https://github.com/kaist-silab/rl4co/issues) or [submit a pull request](https://github.com/kaist-silab/rl4co/pulls). We welcome contributions to RL4CO!
|
|
372
374
|
|
|
373
375
|
### Contributors
|
|
374
376
|
<a href="https://github.com/kaist-silab/rl4co/graphs/contributors">
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
3
|
# RL4CO
|
|
4
|
-
|
|
5
|
-
An extensive Reinforcement Learning (RL) for Combinatorial Optimization (CO) benchmark. Our goal is to provide a unified framework for RL-based CO algorithms, and to facilitate reproducible research in this field, decoupling the science from the engineering.
|
|
6
|
-
|
|
4
|
+
|
|
5
|
+
An extensive Reinforcement Learning (RL) for Combinatorial Optimization (CO) benchmark. Our goal is to provide a unified framework for RL-based CO algorithms, and to facilitate reproducible research in this field, decoupling the science from the engineering.
|
|
6
|
+
|
|
7
7
|
<a href="https://pytorch.org/get-started/locally/"><img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-ee4c2c?logo=pytorch&logoColor=white"></a>
|
|
8
8
|
<a href="https://pytorchlightning.ai/"><img alt="Lightning" src="https://img.shields.io/badge/-Lightning-792ee5?logo=pytorchlightning&logoColor=white"></a>
|
|
9
9
|
<a href="https://github.com/pytorch/rl"><img alt="base: TorchRL" src="https://img.shields.io/badge/base-TorchRL-red">
|
|
10
10
|
<a href="https://hydra.cc/"><img alt="config: Hydra" src="https://img.shields.io/badge/config-Hydra-89b8cd"></a> [](https://github.com/psf/black)
|
|
11
|
-

|
|
11
|
+
[](https://pypi.org/project/rl4co)
|
|
12
|
+
[](https://github.com/kaist-silab/rl4co/actions/workflows/tests.yml)
|
|
12
13
|
<!--  -->
|
|
13
14
|
|
|
14
15
|
</div>
|
|
@@ -24,6 +25,7 @@ RL4CO is built upon:
|
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
## Getting started
|
|
28
|
+
<a href="https://colab.research.google.com/github/kaist-silab/rl4co/blob/main/notebooks/1-quickstart.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
|
|
27
29
|
|
|
28
30
|
RL4CO is now available for installation on `pip`!
|
|
29
31
|
```bash
|
|
@@ -60,7 +62,7 @@ To get started, we recommend checking out our [quickstart notebook](notebooks/1-
|
|
|
60
62
|
|
|
61
63
|
Train model with default configuration (AM on TSP environment):
|
|
62
64
|
```bash
|
|
63
|
-
python run.py
|
|
65
|
+
python run.py
|
|
64
66
|
```
|
|
65
67
|
|
|
66
68
|
|
|
@@ -70,14 +72,14 @@ python run.py
|
|
|
70
72
|
|
|
71
73
|
Train model with chosen experiment configuration from [configs/experiment/](configs/experiment/) (e.g. tsp/am, and environment with 42 cities)
|
|
72
74
|
```bash
|
|
73
|
-
python run.py experiment=tsp/am env.num_loc=42
|
|
75
|
+
python run.py experiment=tsp/am env.num_loc=42
|
|
74
76
|
```
|
|
75
77
|
</details>
|
|
76
78
|
|
|
77
79
|
|
|
78
80
|
<details>
|
|
79
81
|
<summary>Disable logging</summary>
|
|
80
|
-
|
|
82
|
+
|
|
81
83
|
```bash
|
|
82
84
|
python run.py experiment=test/am logger=none '~callbacks.learning_rate_monitor'
|
|
83
85
|
```
|
|
@@ -110,7 +112,7 @@ from rl4co.tasks.rl4co import RL4COLitModule
|
|
|
110
112
|
config = DictConfig(
|
|
111
113
|
{"data": {
|
|
112
114
|
"train_size": 100000,
|
|
113
|
-
"val_size": 10000,
|
|
115
|
+
"val_size": 10000,
|
|
114
116
|
"batch_size": 512,
|
|
115
117
|
},
|
|
116
118
|
"optimizer": {"lr": 1e-4}}
|
|
@@ -145,7 +147,7 @@ pytest tests
|
|
|
145
147
|
```
|
|
146
148
|
|
|
147
149
|
## Contributing
|
|
148
|
-
Have a suggestion, request, or found a bug? Feel free to [open an issue](https://github.com/kaist-silab/rl4co/issues) or [submit a pull request](https://github.com/kaist-silab/rl4co/pulls). We welcome contributions to RL4CO!
|
|
150
|
+
Have a suggestion, request, or found a bug? Feel free to [open an issue](https://github.com/kaist-silab/rl4co/issues) or [submit a pull request](https://github.com/kaist-silab/rl4co/pulls). We welcome contributions to RL4CO!
|
|
149
151
|
|
|
150
152
|
### Contributors
|
|
151
153
|
<a href="https://github.com/kaist-silab/rl4co/graphs/contributors">
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.3.dev3"
|
|
@@ -173,8 +173,7 @@ class TSPEnv(RL4COEnvBase):
|
|
|
173
173
|
@staticmethod
|
|
174
174
|
def render(td, actions=None, ax=None):
|
|
175
175
|
import matplotlib.pyplot as plt
|
|
176
|
-
|
|
177
|
-
from matplotlib import cm
|
|
176
|
+
import numpy as np
|
|
178
177
|
|
|
179
178
|
if ax is None:
|
|
180
179
|
# Create a plot of the nodes
|
|
@@ -197,51 +196,20 @@ class TSPEnv(RL4COEnvBase):
|
|
|
197
196
|
locs = gather_by_index(locs, actions, dim=0)
|
|
198
197
|
|
|
199
198
|
# Cat the first node to the end to complete the tour
|
|
199
|
+
locs = torch.cat((locs, locs[0:1]))
|
|
200
200
|
x, y = locs[:, 0], locs[:, 1]
|
|
201
201
|
|
|
202
|
-
#
|
|
203
|
-
|
|
204
|
-
ax.scatter(
|
|
205
|
-
x,
|
|
206
|
-
y,
|
|
207
|
-
edgecolors=cm.Set2(0),
|
|
208
|
-
facecolors="none",
|
|
209
|
-
s=100,
|
|
210
|
-
linewidths=2,
|
|
211
|
-
marker="o",
|
|
212
|
-
alpha=1,
|
|
213
|
-
)
|
|
202
|
+
# Plot the visited nodes
|
|
203
|
+
ax.scatter(x, y, color="tab:blue")
|
|
214
204
|
|
|
215
|
-
# plot
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
[from_loc[0], to_loc[0]],
|
|
221
|
-
[from_loc[1], to_loc[1]],
|
|
222
|
-
color=cm.tab20c(5),
|
|
223
|
-
)
|
|
224
|
-
ax.annotate(
|
|
225
|
-
"",
|
|
226
|
-
xy=(to_loc[0], to_loc[1]),
|
|
227
|
-
xytext=(from_loc[0], from_loc[1]),
|
|
228
|
-
arrowprops=dict(arrowstyle="->", color=cm.tab20c(5)),
|
|
229
|
-
annotation_clip=False,
|
|
230
|
-
)
|
|
231
|
-
|
|
232
|
-
# setup
|
|
233
|
-
ax.set_xlim(-0.05, 1.05)
|
|
234
|
-
ax.set_ylim(-0.05, 1.05)
|
|
235
|
-
ax.grid(axis="both", color="black", ls="--", alpha=0.1)
|
|
236
|
-
|
|
237
|
-
# plt.tick_params(axis='both', which='both', bottom=False, top=False, labelbottom=False, right=False, left=False, labelleft=False)
|
|
205
|
+
# Add arrows between visited nodes as a quiver plot
|
|
206
|
+
dx, dy = np.diff(x), np.diff(y)
|
|
207
|
+
ax.quiver(
|
|
208
|
+
x[:-1], y[:-1], dx, dy, scale_units="xy", angles="xy", scale=1, color="k"
|
|
209
|
+
)
|
|
238
210
|
|
|
239
211
|
# Set plot title and axis labels
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
ax.
|
|
243
|
-
ax.set_xlabel("X Coordinate", fontdict=label_font)
|
|
244
|
-
ax.set_ylabel("Y Coordinate", fontdict=label_font)
|
|
245
|
-
|
|
246
|
-
# plt.tight_layout()
|
|
212
|
+
ax.set_title("TSP Solution")
|
|
213
|
+
ax.set_xlabel("x-coordinate")
|
|
214
|
+
ax.set_ylabel("y-coordinate")
|
|
247
215
|
plt.show()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rl4co
|
|
3
|
-
Version: 0.0.3.
|
|
3
|
+
Version: 0.0.3.dev3
|
|
4
4
|
Summary: RL4CO: an Extensive Reinforcement Learning for Combinatorial Optimization Benchmark
|
|
5
5
|
Author-email: Federico Berto <berto.federico2@gmail.com>, Chuanbo Hua <cbhua@kaist.ac.kr>, Junyoung Park <junyoungpark.ml@gmail.com>
|
|
6
6
|
License: Apache License
|
|
@@ -224,14 +224,15 @@ License-File: LICENSE
|
|
|
224
224
|
<div align="center">
|
|
225
225
|
|
|
226
226
|
# RL4CO
|
|
227
|
-
|
|
228
|
-
An extensive Reinforcement Learning (RL) for Combinatorial Optimization (CO) benchmark. Our goal is to provide a unified framework for RL-based CO algorithms, and to facilitate reproducible research in this field, decoupling the science from the engineering.
|
|
229
|
-
|
|
227
|
+
|
|
228
|
+
An extensive Reinforcement Learning (RL) for Combinatorial Optimization (CO) benchmark. Our goal is to provide a unified framework for RL-based CO algorithms, and to facilitate reproducible research in this field, decoupling the science from the engineering.
|
|
229
|
+
|
|
230
230
|
<a href="https://pytorch.org/get-started/locally/"><img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-ee4c2c?logo=pytorch&logoColor=white"></a>
|
|
231
231
|
<a href="https://pytorchlightning.ai/"><img alt="Lightning" src="https://img.shields.io/badge/-Lightning-792ee5?logo=pytorchlightning&logoColor=white"></a>
|
|
232
232
|
<a href="https://github.com/pytorch/rl"><img alt="base: TorchRL" src="https://img.shields.io/badge/base-TorchRL-red">
|
|
233
233
|
<a href="https://hydra.cc/"><img alt="config: Hydra" src="https://img.shields.io/badge/config-Hydra-89b8cd"></a> [](https://github.com/psf/black)
|
|
234
|
-

|
|
234
|
+
[](https://pypi.org/project/rl4co)
|
|
235
|
+
[](https://github.com/kaist-silab/rl4co/actions/workflows/tests.yml)
|
|
235
236
|
<!--  -->
|
|
236
237
|
|
|
237
238
|
</div>
|
|
@@ -247,6 +248,7 @@ RL4CO is built upon:
|
|
|
247
248
|
|
|
248
249
|
|
|
249
250
|
## Getting started
|
|
251
|
+
<a href="https://colab.research.google.com/github/kaist-silab/rl4co/blob/main/notebooks/1-quickstart.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
|
|
250
252
|
|
|
251
253
|
RL4CO is now available for installation on `pip`!
|
|
252
254
|
```bash
|
|
@@ -283,7 +285,7 @@ To get started, we recommend checking out our [quickstart notebook](notebooks/1-
|
|
|
283
285
|
|
|
284
286
|
Train model with default configuration (AM on TSP environment):
|
|
285
287
|
```bash
|
|
286
|
-
python run.py
|
|
288
|
+
python run.py
|
|
287
289
|
```
|
|
288
290
|
|
|
289
291
|
|
|
@@ -293,14 +295,14 @@ python run.py
|
|
|
293
295
|
|
|
294
296
|
Train model with chosen experiment configuration from [configs/experiment/](configs/experiment/) (e.g. tsp/am, and environment with 42 cities)
|
|
295
297
|
```bash
|
|
296
|
-
python run.py experiment=tsp/am env.num_loc=42
|
|
298
|
+
python run.py experiment=tsp/am env.num_loc=42
|
|
297
299
|
```
|
|
298
300
|
</details>
|
|
299
301
|
|
|
300
302
|
|
|
301
303
|
<details>
|
|
302
304
|
<summary>Disable logging</summary>
|
|
303
|
-
|
|
305
|
+
|
|
304
306
|
```bash
|
|
305
307
|
python run.py experiment=test/am logger=none '~callbacks.learning_rate_monitor'
|
|
306
308
|
```
|
|
@@ -333,7 +335,7 @@ from rl4co.tasks.rl4co import RL4COLitModule
|
|
|
333
335
|
config = DictConfig(
|
|
334
336
|
{"data": {
|
|
335
337
|
"train_size": 100000,
|
|
336
|
-
"val_size": 10000,
|
|
338
|
+
"val_size": 10000,
|
|
337
339
|
"batch_size": 512,
|
|
338
340
|
},
|
|
339
341
|
"optimizer": {"lr": 1e-4}}
|
|
@@ -368,7 +370,7 @@ pytest tests
|
|
|
368
370
|
```
|
|
369
371
|
|
|
370
372
|
## Contributing
|
|
371
|
-
Have a suggestion, request, or found a bug? Feel free to [open an issue](https://github.com/kaist-silab/rl4co/issues) or [submit a pull request](https://github.com/kaist-silab/rl4co/pulls). We welcome contributions to RL4CO!
|
|
373
|
+
Have a suggestion, request, or found a bug? Feel free to [open an issue](https://github.com/kaist-silab/rl4co/issues) or [submit a pull request](https://github.com/kaist-silab/rl4co/pulls). We welcome contributions to RL4CO!
|
|
372
374
|
|
|
373
375
|
### Contributors
|
|
374
376
|
<a href="https://github.com/kaist-silab/rl4co/graphs/contributors">
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.0.3.dev1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|