google-deepmind / meltingpot

A suite of test scenarios for multi-agent reinforcement learning.
Apache License 2.0
577 stars 116 forks source link

Modifying the 'commons_harvest' Scenario During Training Episodes #173

Closed yesfon closed 11 months ago

yesfon commented 11 months ago

Hello, I'm working with Melting Pot, specifically with the commons_harvest scenario. I'd like to know if there's a way to modify the scenario during the training stage? I mean, is there a way for the agent to see a different map than the initial one in each training episode?

jzleibo commented 11 months ago

Sure, you can modify the substrate during training. The changes won't be there at test time when you use the 'scenario' though.

If all you want to do is change the substrate during training then it should be fine. You can change anything you like in the substrate config between episodes, this includes the map.

yesfon commented 11 months ago

Thank you for the response @jzleibo. I'd like to know if there's an example in the repository's documentation on how to carry out this procedure. Is there already something implemented where the agent sees different maps during training?

jzleibo commented 11 months ago

Somewhere in your experiment you'll be calling the 'build' function in one of these files: https://github.com/google-deepmind/meltingpot/blob/main/meltingpot/configs/substrates/commons_harvest__open.py (that's the one for commons_harvest__open). Most likely you'll be calling it on every episode.

You can take the dict d returned from that function and override d['simulation']['map'] with your map.