Open DEUCE1957 opened 2 weeks ago
Hello,
I will fix it ASAP.
In the mean time (the grid2op release with this fix will wait for some other modifications) I suggest you use:
class WeirdReward(BaseReward):
def __init__(self, logger: Logger = None):
super().__init__(logger)
def __call__(self, action: BaseAction, env:BaseEnv, has_error: bool, is_done: bool, is_illegal: bool, is_ambiguous: bool) -> float:
if self.is_simulated_env(env):
return 0. # the data for the simulation does not mean anything, better not use it
# now you can use env.chronics_handler.get_name()
return super().__call__(action, env, has_error, is_done, is_illegal, is_ambiguous)
Oh and by the way, the "True" chronics will never be fed to "obs.simulate" this is a design choice to ensure that a user cannot access the "future" data, in the same way that accessing a real simulator will not provide you any data about the future.
Environment
1.11.0.dev0
ArchLinux
Bug description
A normal, fully initialized, Environment has a chronics_handler - from which you can get the name / ID of the current episode:
The call to the Reward Function has the following signature (from BaseReward):
Hence it should be possible to use
env.chronics_handler.get_name()
inside a custom reward function, since BaseEnv includes the chronics handler. This is useful for, for instance, fetching the load profiles.However, this will throw an error if we use obs.simulate():
Since the _ObsEnv class is used in place of the normal BaseEnv, the normal chronics handler does not exist.
My current workaround is to use:
Minimal Example