baselines icon indicating copy to clipboard operation
baselines copied to clipboard

env: how to pass a own defined environment

Open xiaonanchong opened this issue 6 years ago • 2 comments

how can I define my own environment and use the baseline algorithms, can I get some hint?

xiaonanchong avatar May 10 '19 20:05 xiaonanchong

You can have a look at the wiki page of this repository: https://github.com/openai/gym/wiki/Environments

This post goes through a step by step process of creating an environment in gym: https://medium.com/@apoddar573/making-your-own-custom-environment-in-gym-c3b65ff8cdaa

Santosh-16k avatar May 22 '19 11:05 Santosh-16k

It's a good tutorial.

This post goes through a step by step process of creating an environment in gym: https://medium.com/@apoddar573/making-your-own-custom-environment-in-gym-c3b65ff8cdaa

However, be careful baselines does not support observation spaces that are dictionary.

Also, I had to implement a __call__ method in my environment. Because if you want to vectorize it (for the PPO algo for example) when creating the environment vector it calls the object.

For example -> here

self.envs = [fn() for fn in env_fns]

AdilZouitine avatar May 24 '19 13:05 AdilZouitine