Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check out actions available in OpenAI gym environment?

It seems like the list of actions for Open AI Gym environments are not available to check out even in the documentation. For example, let's say you want to play Atari Breakout. The available actions will be right, left, up, and down.

print(env.action_space.n) If I print the number of actions available in action space, it prints 4 as I have expected. However, what I want to see is the list of actions such as right, up, punch(maybe, boxing-v1), jump etc... you name it.

Is there any way to check out?

like image 661
Ji Hwan Park Avatar asked Sep 15 '25 06:09

Ji Hwan Park


2 Answers

This does not work for all environments in gym but it does work for the ALE environments:

import gym
env = gym.make("Breakout-v0")
env.unwrapped.get_action_meanings()
like image 76
BenedictWilkins Avatar answered Sep 18 '25 10:09

BenedictWilkins


It is possible by game where Artati environment had Descrete 18 numbers that you may read from

print(env.env.get_action_meanings())
print(env.action_space.n)

Result:

A.L.E: Arcade Learning Environment (version +978d2ce)
[Powered by Stella]
['NOOP', 'FIRE', 'UP', 'RIGHT', 'LEFT', 'DOWN', 'UPRIGHT', 'UPLEFT', 'DOWNRIGHT', 'DOWNLEFT', 'UPFIRE', 'RIGHTFIRE', 'LEFTFIRE', 'DOWNFIRE', 'UPRIGHTFIRE', 'UPLEFTFIRE', 'DOWNRIGHTFIRE', 'DOWNLEFTFIRE']
Discrete(18)
like image 34
Jirayu Kaewprateep Avatar answered Sep 18 '25 10:09

Jirayu Kaewprateep