Farama-Foundation / Minigrid

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

[Question] Which randomization method is used for random version of dynamic obstacle minigrid? #289

Closed JustinS6626 closed 1 year ago

JustinS6626 commented 1 year ago

Question

I am a doctoral student hoping to use both the standard and random version of the dynamic obstacle gridword for an experiment, and I would like to be able to describe correctly in my write-up the process by which random obstacle behaviour is implement. I am therefore wondering what approach you are using for that, as I have been unable to locate it in the code. Thank you very much for your help.

pseudo-rnd-thoughts commented 1 year ago

You need to look at the _gen_grid function which is run in __init__.py https://github.com/Farama-Foundation/Minigrid/blob/8cba7942292f7ae2d44bf6130a9c18ed12fbf9c2/minigrid/envs/dynamicobstacles.py#L111

Then the obstacles are updated in the step function https://github.com/Farama-Foundation/Minigrid/blob/8cba7942292f7ae2d44bf6130a9c18ed12fbf9c2/minigrid/envs/dynamicobstacles.py#L145

JustinS6626 commented 1 year ago

Thanks for getting back to me! I looked at those functions earlier as well, but I am only seeing the deterministic obstacle behaviour. At what lines are the randomization function calls occurring?

pseudo-rnd-thoughts commented 1 year ago

The place_obs function https://github.com/Farama-Foundation/Minigrid/blob/8cba7942292f7ae2d44bf6130a9c18ed12fbf9c2/minigrid/minigrid_env.py#L310 In particular, on line 344 of the function

JustinS6626 commented 1 year ago

That makes sense now. Thanks for your help!