liveBook · Manning

Gym environment

As explained in Evolutionary Deep Learning: Genetic algorithms and neural networks

A Gym environment is an interactive task specification that exposes states, actions, transitions, rewards, and termination behavior to a reinforcement-learning agent.

A Gym environment turns a reinforcement-learning task into an interactive loop: reset it, inspect the observation, choose an action, receive a reward, and continue until termination. section 11.2

Common environments make different control problems available for experimentation:

  • MountainCar requires rocking a car to build momentum up a hill. section 11.2
  • Pendulum requires applying force to keep a pendulum upright. section 11.2
  • CartPole tests balancing a pole by responding to cart and pole position and velocity. section 11.2
  • LunarLander tests landing safely with sufficiently low velocity. section 11.2

Run a random-agent rollout

Create an environment such as CartPole-v1, reset it, sample actions from its action space, call step repeatedly, accumulate rewards, stop when done, and render frames into a video.

How Evolutionary Deep Learning: Genetic algorithms and neural networks covers it

How deep it goes
Demonstrates environment creation, reset, stepping, reward accumulation, termination checks, rendering, and video playback.
Examples
Uses MountainCar, Pendulum, CartPole, LunarLander, Acrobot, and CubeCrash as concrete environments.
What you can do after
Operate/configure Gym environments, inspect their spaces, run rollouts, collect rewards, and render results as video.
How it connects
Connects reinforcement learning with NEAT, Q-learning, and deep Q-learning through shared Gym experiments.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Evolutionary Deep Learning: Genetic algorithms and neural networks. The section links point to the parts of the book it draws on.