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

Modifying observation object may lead to exception in the environment #151

Closed
AlexTo opened this issue Oct 4, 2020 · 1 comment · Fixed by #159
Closed

Modifying observation object may lead to exception in the environment #151

AlexTo opened this issue Oct 4, 2020 · 1 comment · Fixed by #159
Labels
bug Something isn't working

Comments

@AlexTo
Copy link

AlexTo commented Oct 4, 2020

In some rare cases, modifying the observation object may cause exception the next time we do env.step(act)

For example, the code below reproduces such "bug"

import grid2op
if __name__ == '__main__':
    env = grid2op.make("l2rpn_case14_sandbox")
    do_nothing = env.action_space({})
    s, r, done, info = env.step(do_nothing)
    setattr(s, "line_status", getattr(s, "line_status") / 1)  # do some weird things to the vector "line_status"
    _, _, _, _ = env.step(do_nothing)
    print("Exception above")
@AlexTo AlexTo added the bug Something isn't working label Oct 4, 2020
@BDonnot
Copy link
Collaborator

BDonnot commented Oct 4, 2020

Hello :-)

Thanks for letting us know, we'll do our best. This is probably due to a shallow copy vs deep copy of a numpy array when the observation is created.

I'll try to fix it in next release :-)

Benjamin

BDonnot referenced this issue in BDonnot/Grid2Op Oct 21, 2020
@BDonnot BDonnot linked a pull request Nov 2, 2020 that will close this issue
BDonnot added a commit that referenced this issue Mar 30, 2022
Adding l2rpn_utils module for l2rpn envs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants