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 in 'reset_game' #71

Open
Markus28 opened this issue Jun 1, 2021 · 1 comment
Open

Seeding in 'reset_game' #71

Markus28 opened this issue Jun 1, 2021 · 1 comment

Comments

@Markus28
Copy link

Markus28 commented Jun 1, 2021

I have a question regarding the method reset_game in Base_Agent. The first few lines read:

    def reset_game(self):Calling seed
        """Resets the game information so we are ready to play a new episode"""
        self.environment.seed(self.config.seed)
        self.state = self.environment.reset()

I am concerned about the seeding. If I understand correctly, 'reset_game' is called any time an episode is completed.

Assume we implement the seed method in our environment like this:

    def seed(self, seed=None):
        self.np_random, seed = seeding.np_random(seed)
        return [seed]

This is actually the method used in Bit_Flipping_Environment.

If we were to actually use self.np_random for resetting the environment, we would always see the same initial state over and over again. At least that is the behaviour I appear to be experiencing.
The environments implemented in this repository, e.g. Bit_Flipping_Environment, seems to circumvent this issue by not using self.np_random at all. Instead, the random module is used. In fact, I don't quite understand why np_random is a member of Bit_Flipping_Environment at all.
Correct me if I'm wrong, but doesn't this make the use of seeds completely pointless (because random is not seeded)?

I would have expected the environment seed method exactly once per run. Calling it once per episode simply doesn't make sense to me.
Please correct me if I misunderstood anything but this doesn't seem right to me.

Best,
Markus

@p-christ
Copy link
Owner

p-christ commented Jun 1, 2021

Hi, I’d have to check it but it sounds like I made a mistake and you are correct it shouldn’t be there

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

No branches or pull requests

2 participants