Skip to content

Commit

Permalink
MultiMixEnv: Document iterable feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Tezirg committed Jun 18, 2020
1 parent 2a4a19c commit 576af52
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions grid2op/Environment/MultiMixEnv.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ def __len__(self):
return len(self.mix_envs)

def __iter__(self):
"""
Operator __iter__ overload to make a ``MultiMixEnvironment`` iterable
.. code-block:: python
import grid2op
from grid2op.Environment import MultiMixEnvironment
from grid2op.Runner import Runner
mm_env = MultiMixEnvironment("/path/to/multi/dataset/folder")
for env in mm_env:
run_p = env.get_params_for_runner()
runner = Runner(**run_p)
runner.run(nb_episode=1, max_iter=-1)
"""
self.env_index = 0
return self

Expand Down

0 comments on commit 576af52

Please sign in to comment.