Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

openai gym box space configuration

I need an observation space ranging from [0,inf)
I'm new to openai gym, and not sure what the format should be

from gym spaces

spaces.Box(np.array(0),np.array(np.inf))
# Box()

spaces.Box(0, np.inf, shape = (1,))
# Box(1,)
like image 444
Schalton Avatar asked Apr 21 '19 22:04

Schalton


People also ask

What is observation space in OpenAI gym?

The basic structure of the environment is described by the observation_space and the action_space attributes of the Gym Env class. The observation_space defines the structure as well as the legitimate values for the observation of the state of the environment.

WHAT IS environment in OpenAI gym?

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.

What is gym Python?

Gym is an open source Python library for developing and comparing reinforcement learning algorithms by providing a standard API to communicate between learning algorithms and environments, as well as a standard set of environments compliant with that API.


Video Answer


1 Answers

from the car_racing environment at line 130 here, this is the description used

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

so I think it is good to stick to this format , which will make your code

spaces.Box(np.array([0]), np.array([inf]),dtype= yourPreferedType ) 
like image 155
AhmadR Avatar answered Oct 19 '22 20:10

AhmadR