Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set the environment seed #78

Closed
NishanthVAnand opened this issue Dec 3, 2021 · 2 comments
Closed

Unable to set the environment seed #78

NishanthVAnand opened this issue Dec 3, 2021 · 2 comments
Labels

Comments

@NishanthVAnand
Copy link

Describe the bug
I get NotImplementedError when I try to set seed on some of the envrionments.

To Reproduce

env = PuddleWorld()
env.seed(seed)

Expected behavior
I expected seed to be set

System information (please complete the following information):

  • OS: macOS Big Sur 11.6
  • Python version Python3.8.6
  • Mushroom version 1.7.0

Additional context
Error message I get

File  "/python3.8/site-packages/mushroom_rl/core/environment.py", line 137, in seed
     raise NotImplementedError
 NotImplementedError
@boris-il-forte
Copy link
Collaborator

boris-il-forte commented Dec 6, 2021

The seed function was designed to interface with Gym environments that may require setting a seed.
Every mushroom environment uses the default NumPy random seed generator.
Probably, it's a good idea to add a more informative message in the agent class or to set the NumPy seed there.
However, we prefer to set the random seed in the experiment function explicitly, before creating the environment. This is due to the fact that the same seed will affect both the environment and the policy (unless using a torch policy, in which case, also the torch seed must be set).

@boris-il-forte
Copy link
Collaborator

Fixed in the latest commit. Now the method warns you, pointing to the correct solution instead of crashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants