- PyTorch 1.x Reinforcement Learning Cookbook
- Yuxi (Hayden) Liu
- 133字
- 2021-06-24 12:34:39
Simulating the CartPole environment
In this recipe, we will work on simulating one more environment in order to get more familiar with Gym. The CartPole environment is a classic one in reinforcement learning research.
CartPole is a traditional reinforcement learning task in which a pole is placed upright on top of a cart. The agent moves the cart either to the left or to the right by 1 unit in a timestep. The goal is to balance the pole and prevent it from falling over. The pole is considered to have fallen if it is more than 12 degrees from the vertical, or the cart moves 2.4 units away from the origin. An episode terminates when any of the following occurs:
- The pole falls over
- The number of timesteps reaches 200