Schalton
Schalton

Reputation: 3104

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,)

Upvotes: 9

Views: 6542

Answers (1)

AhmadR
AhmadR

Reputation: 159

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 ) 

Upvotes: 5

Related Questions