Farama-Foundation / Minigrid

Simple and easily configurable grid world environments for reinforcement learning
https://minigrid.farama.org/
Other
2.13k stars 611 forks source link

How to duplicate the current env #153

Closed donamin closed 2 years ago

donamin commented 3 years ago

Hi,

Thanks for the awesome repo. I have a question though: Is there anyway for duplicating the current grid state? I'm trying to implement a MCTS agent that can operate in this environment and for that, I need to be able to forward simulate the environment by duplicating the current env.

Cheers Amin

maximecb commented 3 years ago

Hi Amin!

I think you may be able to just use the copy.deepcopy() method on the env directly: https://docs.python.org/3/library/copy.html

Otherwise env.grid definitely is copyable that way, but you might have to implement your own copy method for the MiniGridEnv class: https://github.com/maximecb/gym-minigrid/blob/master/gym_minigrid/minigrid.py#L369