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

Removing objects or moving goal #175

Closed raymondchua closed 2 years ago

raymondchua commented 2 years ago

Hi! Is there a way I can remove objects? I would like to move the goal (ie. change the goal position) after some iterations of training.

maximecb commented 2 years ago

Try env.grid.set(i, j, None)

https://github.com/maximecb/gym-minigrid/blob/master/gym_minigrid/minigrid.py#L373

simonsays1980 commented 2 years ago

@maximecb does this also work for the agent? I would like to position the agent on certain tiles in training and on different ones in testing.

Thanks for the active involvment here!

maximecb commented 2 years ago

There's a method place_agent to do this. Would recommend using grep to search through the source code for usage: https://github.com/maximecb/gym-minigrid/blob/master/gym_minigrid/minigrid.py#L959

raymondchua commented 2 years ago

I tried the env.grid function but it did not work for my case. Maybe the none work (for removing an existing goal) but how can I set a new goal in the midst of training?

maximecb commented 2 years ago

Take a look at how objects are placed in the code for the existing environments, and how these functions are defined: https://github.com/maximecb/gym-minigrid/blob/master/gym_minigrid/envs/empty.py