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

Problem when deep copying a grid2op environment with lightsim2grid backend #36

Open
BDonnot opened this issue Oct 13, 2021 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@BDonnot
Copy link
Collaborator

BDonnot commented Oct 13, 2021

Environment

  • Grid2op version: 1.6.2 (eg 1.4.0)
  • lightsim version: 0.5.4 (eg 0.5.0)
  • System: `ubuntu 20.04

Bug description

The powerflow diverge when the environment is deep copied.

How to reproduce

It can be reproduced by executing:

import copy
from lightsim2grid import LightSimBackend
import grid2op
env = grid2op.make("l2rpn_case14_sandbox", test=True, backend=LightSimBackend())
obs = env.reset()
env_cpy = copy.deepcopy(env)
new_obs, reward, done, info = env.step(env.action_space())
assert not done
new_obs_2, reward_2, done_2, info_2 = env_cpy.step(env.action_space())
assert not done_2, f'powerflow diverge, error was: \n{info_2["exception"]}'

Current output

/home/benjamin/Documents/grid2op_dev/grid2op/MakeEnv/Make.py:317: UserWarning: You are using a development environment. This environment is not intended for training agents. It might not be up to date and its primary use if for tests (hence the "test=True" you passed as argument). Use at your own risk.
  warnings.warn(_MAKE_DEV_ENV_WARN)
Traceback (most recent call last):
  File "test_deepcopy_env.py", line 11, in <module>
    assert not done_2, f'powerflow diverge, error was: \n{info_2["exception"]}'
AssertionError: powerflow diverge, error was: 
[RuntimeError('The slack bus is disconnected.')]

Expected output

Nothing shoud be raised and the environment should work correctly

@BDonnot BDonnot added bug Something isn't working good first issue Good for newcomers labels Oct 13, 2021
@BDonnot
Copy link
Collaborator Author

BDonnot commented Nov 10, 2021

The complete implementation of "deepcopy" is not really implemented at the moment, in the mean time, please use env.copy() which is working as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant