The goal of this repository is to implement different RL algorithms from scratch and compare them on the same tasks for educational purposes.
Below is the path the robot decides to take using Q-Learning (after enough iterations) when the environment is stochastic (random action chance = 10%).
- red is mud (gives very bad negative rewards)
- grey are obstacles
- yellow is the path taken
- blue cells indicate that it stepped there more than once (not shown in the example, but will show up in suboptimal paths).
In this example, it avoids the path close to the red cells and decides to follow the slightly longer 'safer' path,
PDM: https://github.com/pdm-project/pdm/tree/main
For Linux/macOS:
curl -sSL https://pdm-project.org/install-pdm.py | python3 -
Alternatively, using Homebrew on macOS:
brew install pdm
From project directory:
pdm run src/rl_experiments/main.py --epochs 5000
Or:
pdm run src/rl_experiments/main.py --epochs 5000 --filename <file-path>
--epochs: number of episodes
--filename: you can create your own map by providing your own csv file and
feeding to the script using this argument. You can look into the enum cell_type.py to know how
to encode the cells (obstacles etc...)
--dyna: number of iterations for dyna, by default = 0 (disabled)
--verbose: to show some logs while running (work in progress)
