8

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,)
Schalton
  • 2,867
  • 2
  • 32
  • 44
  • `spaces.Box(low=0, high=np.inf, shape=(1,), dtype=np.int64)` seems to be the prevailing format in examples, I'd still love to have someone explain the differences – Schalton Apr 22 '19 at 20:28

1 Answers1

5

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 ) 
AhmadR
  • 159
  • 2
  • 5
  • It seems like you're recommending `Box(1,)` (the same as my comment on the question), but how is that different from `Box()` -- thanks – Schalton Nov 15 '20 at 20:01