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
The window_size alarm parameter is properly set to the desired value when creating an env.
But this value is apparently not the one used by the runner then, which is always window_size=1
How to reproduce
Command line
# command line used if any
Code snippet
importgrid2opprint(grid2op.__version__)
# Backend class to usetry:
fromlightsim2grid.LightSimBackendimportLightSimBackendBACKEND=LightSimBackendexceptModuleNotFoundError:
fromgrid2op.BackendimportPandaPowerBackendBACKEND=PandaPowerBackendfromgrid2op.ExceptionsimportGrid2OpExceptionfromgrid2op.Reward.BaseRewardimportBaseRewardfromgrid2op.dtypesimportdt_floatfromgrid2op.RunnerimportRunnerfromgrid2op.ParametersimportParametersclassAlarmReward_test(BaseReward):
def__init__(self):
BaseReward.__init__(self)
# required if you want to design a custom reward taking into account the# alarm featureself.reward_no_game_over=dt_float(0.)
self.window_size=Noneself.best_time=Nonedefinitialize(self, env):
ifnotenv._has_attention_budget:
raiseGrid2OpException("Impossible to use the \"AlarmReward\" with an environment for which this feature ""is disabled. Please make sure \"env._has_attention_budget\" is set to ``True`` or ""change the reward class with `grid2op.make(..., reward_class=AnyOtherReward)`")
self.reset(env)
defreset(self, env):
self.window_size=env.parameters.ALARM_WINDOW_SIZE#ALARM_BEST_TIMEself.best_time=env.parameters.ALARM_BEST_TIMEprint("window value")
print(self.window_size)
print("best_time value")
print(self.best_time)
def__call__(self, action, env, has_error, is_done, is_illegal, is_ambiguous):
ifis_done:
return1else:
res=self.reward_no_game_overreturnres####Input environment path hereenv_path='YourPath/l2rpn_neurips_2020_track1_with_alert'######param=Parameters()
#param.init_from_dict({'ALARM_BEST_TIME':6,'ALARM_WINDOW_SIZE':6})env=grid2op.make(env_path,backend=BACKEND()
,param=param,reward_class=AlarmReward_test)
runner=Runner(**env.get_params_for_runner()
)
nb_episode=1res=runner.run(nb_episode=nb_episode,max_iter=1,
nb_process=1)
Current output
window_size=1 once running the runner whatever env.parameters.ALARM_WINDOW_SIZE is
marota
changed the title
Issue getting the best_time alarm parameter right when using the runner
Issue getting the ALARM_WINDOW_SIZE parameter right when using the runner
Jun 8, 2021
Issue is fixed, new changes can be obtained by intalling the dev version of grid2op: pip install git+git://github.com/rte-france/grid2op.git@dev_1.6.0
Environment
1.6.0.rc1
osx
Bug description
The window_size alarm parameter is properly set to the desired value when creating an env.
But this value is apparently not the one used by the runner then, which is always window_size=1
How to reproduce
Command line
# command line used if any
Code snippet
Current output
Expected output
The text was updated successfully, but these errors were encountered: