Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenAI Gym: Understanding `action_space` notation (spaces.Box)

I want to setup an RL agent on the OpenAI CarRacing-v0 environment, but before that I want to understand the action space. In the code on github line 119 says:

self.action_space = spaces.Box( np.array([-1,0,0]), np.array([+1,+1,+1]))  # steer, gas, brake 

How do I read this line? Although my problem is concrete wrt CarRacing-v0 I would like to understand the spaces.Box() notation in general

like image 806
Toke Faurby Avatar asked Jun 07 '17 05:06

Toke Faurby


People also ask

What is the box in open AI gym?

Both Box and Discrete are types of data structures called "Spaces" provided by Gym to describe the legitimate values for the observations and actions for the environments. All of these data structures are derived from the gym. Space base class. Box(n,) corresponds to the n -dimensional continuous space.

What is gym wrapper?

Wrapper that override how the environment processes observations, rewards, and action. The following three classes provide this functionality: gym. ObservationWrapper : Used to modify the observations returned by the environment. To do this, override the observation method of the environment.

How does OpenAI gym work?

OpenAI gym is an environment for developing and testing learning agents. It is focused and best suited for reinforcement learning agent but does not restricts one to try other methods such as hard coded game solver / other deep learning approaches.


1 Answers

Box means that you are dealing with real valued quantities.

The first array np.array([-1,0,0] are the lowest accepted values, and the second np.array([+1,+1,+1]) are the highest accepted values. In this case (using the comment) we see that we have 3 available actions:

  1. Steering: Real valued in [-1, 1]
  2. Gas: Real valued in [0, 1]
  3. Brake: Real valued in [0, 1]
like image 157
Toke Faurby Avatar answered Sep 20 '22 14:09

Toke Faurby