Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all environment id in openai gym

How to list all currently registered environment IDs (as they are used for creating environments) in openai gym?

A bit context: there are many plugins installed which have customary ids such as atari, super mario, doom etc.

Not to be confused with game names for atari-py.

like image 342
Zuoanqh Avatar asked Feb 26 '18 01:02

Zuoanqh


People also ask

What is OpenAI gym environment?

OpenAI gym is an environment for developing and testing learning agents. It is focused and best suited for reinforcement learning agent but does not restricts one to try other methods such as hard coded game solver / other deep learning approaches.

Does OpenAI use reinforcement learning?

OpenAI Gym is one of the most popular toolkits for implementing reinforcement learning simulation environments.

Does OpenAI gym work on Windows?

Even though it can be installed on Windows using Conda or PIP, it cannot be visualized on Windows. If you run it on a headless server (such as a virtual machine on the cloud), then it needs PyVirtualDisplay, which doesn't work on Windows either. Therefore, playing the OpenAI Gym on Windows is inconvenient.


1 Answers

Use envs.registry.all():

from gym import envs
print(envs.registry.all())

Out:

dict_values([EnvSpec(Copy-v0), EnvSpec(RepeatCopy-v0), EnvSpec(ReversedAddition-v0), EnvSpec(ReversedAddition3-v0), EnvSpec(DuplicatedInput-v0), EnvSpec(Reverse-v0), EnvSpec(CartPole-v0), ...])

This returns a large collection of EnvSpec objects, not specifically of the IDs as you asked. You can get those like this:

from gym import envs
all_envs = envs.registry.all()
env_ids = [env_spec.id for env_spec in all_envs]
print(sorted(env_ids))

Out:

['Acrobot-v1', 'Ant-v2', 'Ant-v3', 'BipedalWalker-v3', 'BipedalWalkerHardcore-v3', 'Blackjack-v1', 'CarRacing-v0', 'CartPole-v0', 'CartPole-v1', ...]

like image 69
Dennis Soemers Avatar answered Oct 02 '22 04:10

Dennis Soemers