import gym
env = gym.make('CartPole-v0')
print(env.action_space)
#> Discrete(2)
print(env.observation_space)
#> Box(4,)
The Discrete space allows a fixed range of non-negative numbers, so in this case valid actions are either 0 or 1. The Box space represents an n-dimensional box, so valid observations will be an array of 4 numbers. We can also check the Box’s bounds:
离散空间允许固定范围的非负数,因此在这种情况下(上面例子),有效动作为0或1. Box空间表示n维框,因此有效观察将是4个数字的数组。 我们还可以查看Box的界限:
gym文档:http://gym.openai.com/docs/、
gym环境:http://gym.openai.com/envs/#classic_control