Skip to content

Simple pytorch implmentation of reinforcement learning algorithms

Notifications You must be signed in to change notification settings

zzzxxxttt/pytorch_simple_RL

Repository files navigation

Simple pytorch implmentation of reinforcement learning algorithms

This repository is for those who want to implement the RL algorithms after reading the corresponding papers. All the algorithms are encapsulated in one file as minimum working examples, which let you focus more on the algorithm themselves.

Requirements:

  • python>=3.5
  • pytorch>=0.4.0
  • gym
  • drawnow

1. DQN

Discrete action space: CartPole-v0:

2. REINFORCE

Discrete action space: CartPole-v0:

3. A2C

Discrete action space: CartPole-v0:

Continuous action space: MountainCarContinuous-v0:

4. DDPG

Continuous action space: MountainCarContinuous-v0:

5. DDPG with Prioritized Experience Replay

Continuous action space: MountainCarContinuous-v0:

  • In the original paper, the prioritized experience replay is implemented using binary heap for efficient training. Due to the small buffer size in our toy example, I just use an array to store samples and sort it after every update.

6. TRPO

Continuous action space: MountainCarContinuous-v0:

  • Code mainly adopted from https://github.com/ikostrikov/pytorch-trpo
  • This piece of code is a little bit complicated, I've tried my best to place everything (LBFGS, conjugate gradient, line search, GAE, ...) in one file.
  • ~ 300 lines, not so horrible, right?

7. PPO

Continuous action space: MountainCarContinuous-v0:

8. ACER

Discrete action space: CartPole-v0:

About

Simple pytorch implmentation of reinforcement learning algorithms

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages