[Python] When the action is to move right in CartPole, it moves to the left side. Why it is...

Discussão em 'Python' iniciado por Stack, Fevereiro 22, 2025.

  1. Stack

    Stack Membro Participativo

    In my experiments, I'm using OpenAI's CartPole-v1 environment. I need to set a state and then perform an action on that state. When I perform a specific action, it does not behave as expected. For example, when the action "Go Right" is used, it moves to the left.

    I have a state s=[ 0.048 0.151 -0.037 -0.265] and an action: Go Right which is 1 according to document.

    When I applied the action 1 to the s, I am getting the new state [-0.016 0.206 -0.029 -0.326]

    It is supposed to move the right side.

    Here is the code I tried:

    env.reset()
    state=[ 0.048 0.151 -0.037 -0.265]
    env.state = env.unwrapped.state = state
    s, reward, done, _ = env.step(action)
    print(state,s)

    Continue reading...

Compartilhe esta Página