[Proposal] Space.seed should be reproducible for Space.seed
pseudo-rnd-thoughts opened this issue · comments
Proposal
Space.seed
will return a list of seeds, i.e., Discrete(3).seed(None) -> [1234]
However, we can't do Discrete(3).seed([1234])
to generate the same RNG
My proposal is the work code should work for all gymnasium spaces
seeding_values = space.seed(None)
samples = [space.sample() for _ in range(3)]
space.seed(seeding_values)
new_samples = [space.sample() for _ in range(3)]
assert samples == new_samples
Motivation
One of the aims of Gymnasium is reproducibility, for space seed, a user must have a known seed for this to be possible currently as space.seed(None)
does not guarantee that you get back all the information to recreate the space (particularly subspaces)
Pitch
Modify the necessary space.seed
functions to enable this feature
Alternatives
This has worked in the past and no-one has asked for it yet
Additional context
No response
Checklist
- I have checked that there is no similar issue in the repo
In private conversations with @RedTachyon, they clarified that they understood the Space.seed
returns values to have this purpose and were surprised that this didn't work already.
Likewise, I don't understand how the current Space.seed
return values are currently used, therefore, I think this is very reasonable API change to make
Implemented within #1033