Skip to content
Snippets Groups Projects
Commit b106448c authored by gmollard's avatar gmollard
Browse files

Merge branch 'master' of gitlab.aicrowd.com:flatland/baselines

parents 788ac51b ac637c33
No related branches found
No related tags found
No related merge requests found
...@@ -3,9 +3,10 @@ This repository allows to run Rail Environment multi agent training with the RLL ...@@ -3,9 +3,10 @@ This repository allows to run Rail Environment multi agent training with the RLL
It should be clone inside the main flatland repository. It should be clone inside the main flatland repository.
## Installation: ## Installation:
`pip install ray` ```sh
pip install ray
`pip install gin-config` pip install gin-config
```
To start a grid search on some parameters, you can create a folder containing a config.gin file (see example in `grid_search_configs/n_agents_grid_search/config.gin`. To start a grid search on some parameters, you can create a folder containing a config.gin file (see example in `grid_search_configs/n_agents_grid_search/config.gin`.
...@@ -14,31 +15,39 @@ Then, you can modify the config.gin file path at the end of the `grid_search_tra ...@@ -14,31 +15,39 @@ Then, you can modify the config.gin file path at the end of the `grid_search_tra
The results will be stored inside the folder, and the learning curves can be visualized in The results will be stored inside the folder, and the learning curves can be visualized in
tensorboard: tensorboard:
`tensorboard --logdir=/path/to/foler_containing_config_gin_file`. ```
tensorboard --logdir=/path/to/foler_containing_config_gin_file
```
## Gin config files ## Gin config files
In each config.gin files, all the parameters, except `local_dir` of the `run_experiment` functions have to be specified. In each config.gin files, all the parameters, except `local_dir` of the `run_experiment` functions have to be specified.
For example, to indicate the number of agents that have to be initialized at the beginning of each simulation, the following line should be added: For example, to indicate the number of agents that have to be initialized at the beginning of each simulation, the following line should be added:
`run_experiment.n_agents = 2` ```
run_experiment.n_agents = 2
```
If several number of agents have to be explored during the experiment, one can pass the following value to the `n_agents` parameter: If several number of agents have to be explored during the experiment, one can pass the following value to the `n_agents` parameter:
`run_experiment.n_agents = {"grid_search": [2,5]}` ```
run_experiment.n_agents = {"grid_search": [2,5]}
```
which is the way to indicate to the tune library to experiment several values for a parameter. which is the way to indicate to the tune library to experiment several values for a parameter.
To reference a class or an object within gin, you should first register it from the `train_experiment.py` script adding the following line: To reference a class or an object within gin, you should first register it from the `train_experiment.py` script adding the following line:
`gin.external_configurable(TreeObsForRailEnv)` ```
gin.external_configurable(TreeObsForRailEnv)
```
and then a `TreeObsForRailEnv` object can be referenced in the `config.gin` file: and then a `TreeObsForRailEnv` object can be referenced in the `config.gin` file:
` ```
run_experiment.obs_builder = {"grid_search": [@TreeObsForRailEnv(), @GlobalObsForRailEnv()]} run_experiment.obs_builder = {"grid_search": [@TreeObsForRailEnv(), @GlobalObsForRailEnv()]}
TreeObsForRailEnv.max_depth = 2 TreeObsForRailEnv.max_depth = 2
` ```
Note that `@TreeObsForRailEnv` references the class, while `@TreeObsForRailEnv()` references instantiates an object of this class. Note that `@TreeObsForRailEnv` references the class, while `@TreeObsForRailEnv()` references instantiates an object of this class.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment