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

Seeding RandomMDPEnv #24

Open
wessle opened this issue Nov 9, 2020 · 3 comments
Open

Seeding RandomMDPEnv #24

wessle opened this issue Nov 9, 2020 · 3 comments
Labels
question Further information is requested sanity check Review is requested

Comments

@wessle
Copy link
Owner

wessle commented Nov 9, 2020

Issue

We need to be able to seed RandomMDPEnv so that, whenever identical seeds are provided, identical MDPEnvs are produced.

Question

Is this already possible with the current class definition?

@wessle wessle added the question Further information is requested label Nov 9, 2020
@wessle
Copy link
Owner Author

wessle commented Nov 9, 2020

Doing

from itertools import product
envs = (RandomMDPEnv(10, 10, 'r1', 'c1', transition_seed=1066) for _ in range(10))
Ps = (env.transition_probabilities for env in envs)
P_pairs = product(Ps, Ps)
pairs = product(envs[0].states, envs[0].actions)
all(all(P[0](*pair) == P[1](*pair)) for pair in pairs for P in P_pairs)

returns True, so I think setting transition_seed suffices to guarantee that RandomMDPEnv will always return the same environment.

New Issue

The keyword argument training_seed in RandomMDPEnv appears to be superfluous, since an agent responsible for training should be making the appropriate call to np.seed anyway.

@DavidNKraemer Can we remove training_seed?

@wessle wessle added the sanity check Review is requested label Nov 9, 2020
@DavidNKraemer
Copy link
Collaborator

I would be happy to get rid of the training_seed. I think setting the seed in one place is the best option by far, and have all the downstream consequences flow from that.

@wessle
Copy link
Owner Author

wessle commented Nov 10, 2020

Great, and agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested sanity check Review is requested
Projects
None yet
Development

No branches or pull requests

2 participants