Gym: Random Seed Feature

Created on 19 Jul 2016  Â·  4Comments  Â·  Source: openai/gym

I am just wondering if the user can set a random seed so it could reproduce all game states for testing purpose. Is it possible to support it if there is no such feature? Thanks!

Most helpful comment

Yes, envs in gym expose a seed() function for exactly this purpose e.g.

>>> import gym
>>> env = gym.make('CartPole-v0')
>>> env.seed(0)

This could be documented better.

All 4 comments

Yes, envs in gym expose a seed() function for exactly this purpose e.g.

>>> import gym
>>> env = gym.make('CartPole-v0')
>>> env.seed(0)

This could be documented better.

@jietang Thanks! I also wonder if env.reset() will reset the seed that I previously set. For example,

import gym
env = gym.make('CartPole-v0')
env.seed(0)

# reset the environment.
env.reset()
# Then the random seed is still 0 or not?

In this case, does reset() reset seed as well?

Hopefully not, otherwise the agent would always train on the same scenario.

(Correct, it does not.)

  • gdb

On Sat, Jul 30, 2016 at 3:39 PM, Danijar Hafner [email protected]
wrote:

Hopefully not, otherwise the agent would always train on the same scenario.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/openai/gym/issues/250#issuecomment-236393754, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAM7kSn_8X85UwEEKnVq_EkEQyfrAxeeks5qa9KmgaJpZM4JP_vq
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

richeekawasthi picture richeekawasthi  Â·  4Comments

julian-ramos picture julian-ramos  Â·  4Comments

Ettrig picture Ettrig  Â·  3Comments

tornadomeet picture tornadomeet  Â·  4Comments

RuofanKong picture RuofanKong  Â·  4Comments