openai / gym

A toolkit for developing and comparing reinforcement learning algorithms.
https://www.gymlibrary.dev
Other
34.82k stars 8.61k forks source link

confusion regarding AtariEnv action_space #1045

Closed Androbin closed 5 years ago

Androbin commented 6 years ago

AtariEnv takes care of reducing _action_set to action_space, which should contain no more than the actions that are relevant to the game. However, it seems that (sometimes) action_space is larger than required. For example, Breakout has 4 actions and Pong has 6. Despite both only needing 3.

Calling gym.make("Pong-v4").unwrapped.get_action_meanings() yields: ['NOOP', 'FIRE', 'RIGHT', 'LEFT', 'RIGHTFIRE', 'LEFTFIRE'] which doesn't even contain 'UP' and 'DOWN'.

I assume 'RIGHT' and 'LEFT' are 'UP' and 'DOWN' and '*FIRE' is 'NOOP'.

But there is basically no documentation on action_space other than:

action = env.action_space.sample() # your agent here (this takes random actions)

In the examples above, we’ve been sampling random actions from the environment’s action space. But what actually are those actions? Every environment comes with an action_space and an observation_space. These attributes are of type Space, and they describe the format of valid actions and observations.

Have I misunderstood something? Is AtariEnv supposed to "offer" these actions? And how does it handle outlier values?

christopherhesse commented 5 years ago

I believe these actions are from https://github.com/mgbellemare/Arcade-Learning-Environment so if there's an issue with the minimal action set, you may wish to file it on that repo.

If you provide outlier values, it will likely crash when trying to figure out which action meaning you meant: https://github.com/openai/gym/blob/master/gym/envs/atari/atari_env.py#L70