A solution for mountain car problem via Q-learning with algorithmic and deep approaches.
- PyTorch (instructions)
- NumPy (instructions)
- gym (instructions)
- seaborn (instructions)
- Clone this repo to your local computer
- Install all required dependencies
- ???
- Type in console:
-
python deep_Q_learning.py
if you want to run deep-approach version
-
python Q_learning.py
if you want to run algorithmic-approach version
- You're good now
Results with deep approach with following parameters:
- step_amount = 100001
- learning_rate = 0.001
- discount_rate = 0.99
- hidden_size_1 = 64
- hidden_size_2 = 64
- max_eps = 0.5
- min_eps = 0.1
- batch_size = 256
- sync_models = 1000
- best_step = 69000
- activation = prelu
Avg reward:
Policy, 0 - move left, 1 - do nothing, 2 - move right:
Corresponding values:
Results with algorithmic approach with following parameters:
- episode_amount = 40001
- learning_rate = 0.2
- discount_rate = 0.9
- max_eps = 0.5
- min_eps = 0.1
- grid_size = 80 * 60
Avg reward:
Policy, 0 - move left, 1 - do nothing, 2 - move right:
Corresponding values: