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.
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.
OpenAI Gym is one of the most popular toolkits for implementing reinforcement learning simulation environments.
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.
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', ...]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With