openai gym box space configuration

时间:2024-11-16 16:03:25

题意:在OpenAI Gym环境中配置一个“Box”空间

问题背景:

I need an observation space ranging from [0,inf)

我需要一个观察空间,其范围是从 [0, +∞)(0到正无穷大)


I'm new to openai gym, and not sure what the format should be

我是OpenAI Gym的新手,不确定应该使用什么格式。

  1. from gym spaces
  2. ((0),())
  3. # Box()
  4. (0, , shape = (1,))
  5. # Box(1,)

问题解决:

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

从这里的第130行关于car_racing环境的描述来看,这是该环境所使用的描述:

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

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

所以我认为坚持这种格式是一个好选择,这会让你的代码...

(([0]), ([inf]),dtype= yourPreferedType )