【问题标题】:Unexpected observation space for CartPole-v0CartPole-v0 的意外观察空间
【发布时间】:2019-05-07 20:56:11
【问题描述】:

我对通过自省 CartPole-v0 获得的观察空间感到惊讶。

根据the official doc,这是我应该得到的:

但我得到的是:

print(env.observation_space.low)
print(env.observation_space.high)
#[-4.8000002e+00 -3.4028235e+38 -4.1887903e-01 -3.4028235e+38]
#[4.8000002e+00 3.4028235e+38 4.1887903e-01 3.4028235e+38]

我正在使用latest version of gym

!pip list|grep gym
gym                 0.12.1   

知道发生了什么吗?

【问题讨论】:

    标签: python reinforcement-learning openai-gym


    【解决方案1】:

    如代码中所述,您似乎获得了预期的行为,这有点令人困惑。一方面,cart position 的观察空间是 [-4.8, 4.8],但实际上,当购物车到达限制 [-2.4, 2.4] 时,情节应该结束。 pole angle 的情况类似。

    class CartPoleEnv(gym.Env):
    """
    Description:
        A pole is attached by an un-actuated joint to a cart, which moves along a frictionless track. The pendulum starts upright, and the goal is to prevent it from falling over by increasing and reducing the cart's velocity.
    
    Source:
        This environment corresponds to the version of the cart-pole problem described by Barto, Sutton, and Anderson
    
    Observation: 
        Type: Box(4)
        Num Observation                 Min         Max
        0   Cart Position             -4.8            4.8
        1   Cart Velocity             -Inf            Inf
        2   Pole Angle                 -24 deg        24 deg
        3   Pole Velocity At Tip      -Inf            Inf
    
    Actions:
        Type: Discrete(2)
        Num Action
        0   Push cart to the left
        1   Push cart to the right
    
        Note: The amount the velocity that is reduced or increased is not fixed; it depends on the angle the pole is pointing. This is because the center of gravity of the pole increases the amount of energy needed to move the cart underneath it
    
    Reward:
        Reward is 1 for every step taken, including the termination step
    
    Starting State:
        All observations are assigned a uniform random value in [-0.05..0.05]
    
    Episode Termination:
        Pole Angle is more than 12 degrees
        Cart Position is more than 2.4 (center of the cart reaches the edge of the display)
        Episode length is greater than 200
        Solved Requirements
        Considered solved when the average reward is greater than or equal to 195.0 over 100 consecutive trials.
    """
    

    this link,您可以阅读相关的 Github 问题。

    *请注意,24 度等于 4.1887903e-01 弧度。

    【讨论】:

      【解决方案2】:

      看起来像过时的文档,已经创建了一个问题:https://github.com/openai/gym/issues/368

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-11-19
        • 2019-08-28
        • 1970-01-01
        • 2014-01-07
        • 2022-01-08
        • 1970-01-01
        • 1970-01-01
        • 2017-09-18
        相关资源
        最近更新 更多