参考:
https://github.com/openai/gym/issues/626
https://github.com/openai/gym/tree/master/gym/envs#how-to-create-new-environments-for-gym
https://github.com/openai/gym/blob/522c2c532293399920743265d9bc761ed18eadb3/gym/envs/__init__.py
The question is how to register your own environment in the registry
Lets say you have your own environment defined in the following structure:
myenv/
__init__.py
myenv.py
myenv.py contains the class for your environment. In init.py you put the following code:
from gym.envs.registration import register
register(
id='MyEnv-v0',
entry_point='myenv.myenv:MyEnv',#第一个myenv是文件夹名字,第二个myenv是文件名字,MyEnv是文件内类的名字
)
To use your own environment