You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to use the BxGymActSpace on environment where not all actions are possible it raises an error (all actions
are illegal)
How to reproduce
Just run the code below:
importunittestimportwarningsimportgrid2opfromgrid2op.Rules.AlwaysLegalimportAlwaysLegalfromgrid2op.gym_compatimportGymEnvfromgrid2op.gym_compatimportBoxGymActSpaceclassIssue283Tester(unittest.TestCase):
defsetUp(self):
withwarnings.catch_warnings():
warnings.filterwarnings("ignore")
self.env=grid2op.make("educ_case14_storage", test=True, gamerules_class=AlwaysLegal)
self.env_gym=GymEnv(self.env)
self.env_gym.action_space.close()
self.env_gym.action_space=BoxGymActSpace(self.env.action_space)
self.env_gym.seed(0)
deftearDown(self):
self.env.close()
self.env_gym.close()
deftest_can_make(self):
"""test that the opponent state is correctly copied"""gym_act=self.env_gym.action_space.sample()
gym_act[:self.env.n_line] =0.# do not change line status ! (otherwise it diverges)act=self.env_gym.action_space.from_gym(gym_act)
obs, reward, done, info=self.env.step(act)
assertlen(info["exception"]) ==0, f"{info['exception'] =}"
Current output
grid2op.Exceptions.IllegalActionExceptions.IllegalAction: Grid2OpException IllegalAction "Impossible to perform curtailment action with this action type."
----------------------------------------------------------------------
Ran 1 test in 7.780s
FAILED (errors=1)
Expected output
.
----------------------------------------------------------------------
Ran 1 test in 5.254s
OK
The text was updated successfully, but these errors were encountered:
Environment
1.6.5
all
Bug description
When trying to use the BxGymActSpace on environment where not all actions are possible it raises an error (all actions
are illegal)
How to reproduce
Just run the code below:
Current output
Expected output
The text was updated successfully, but these errors were encountered: