@@ -31,6 +31,7 @@ class N1ContingencyReward(BaseReward):
3131 .. code-block:: python
3232
3333 import grid2op
34+
3435 from lightsim2grid.rewards import N1ContingencyReward
3536 l_ids = [0, 1, 7]
3637 env = grid2op.make("l2rpn_case14_sandbox",
@@ -117,8 +118,6 @@ def initialize(self, env: "grid2op.Environment.Environment"):
117118 "without any contingencies !" )
118119 self .reward_min = 0.
119120 self .reward_max = len (self ._l_ids ) if not self ._normalize else 1.
120- # self._contingecy_analyzer = ContingencyAnalysis(self._backend)
121- # self._contingecy_analyzer.add_multiple_contingencies(self._l_ids)
122121
123122 def __call__ (self , action , env , has_error , is_done , is_illegal , is_ambiguous ):
124123 if is_done :
@@ -175,31 +174,6 @@ def __call__(self, action, env, has_error, is_done, is_illegal, is_ambiguous):
175174 now_3 = time .perf_counter ()
176175 self ._timer_post_proc += now_3 - now_2
177176 self ._timer_call += time .perf_counter () - beg
178- # print()
179- # print("sanity check")
180- # print("a_or")
181- # print(f"obs.a_or:\n{env.get_obs().a_or}")
182- # print(f"backend updated state:\n{self._backend.lines_or_info()[3]}")
183- # print("gen_p")
184- # print(f"obs.gen_p:\n{env.get_obs().gen_p}")
185- # print(f"backend updated state:\n{self._backend.generators_info()[0]}")
186- # print("shunt_bus")
187- # print(f"obs._shunt_bus:\n{env.get_obs()._shunt_bus}")
188- # print(f"backend updated state:\n{self._backend.shunt_info()[-1]}")
189- # print(f"env backend shunt bus {env.backend._grid.get_shunts()[0].bus_id}")
190- # print(f"self backend shunt bus {self._backend._grid.get_shunts()[0].bus_id}")
191- # print("shunt_q")
192- # print(f"obs._shunt_q:\n{env.get_obs()._shunt_q}")
193- # print(f"backend updated state:\n{self._backend.shunt_info()[1]}")
194- # print("load_p")
195- # print(f"obs.load_p:\n{env.get_obs().load_p}")
196- # print(f"backend updated state:\n{self._backend.loads_info()[0]}")
197- # print("")
198- # print("reward for 0: ")
199- # print(tmp_res[0])
200- # print("reward for 3: ")
201- # print(tmp_res[3])
202- # print("")
203177 return res
204178
205179 def reset (self , env : "grid2op.Environment.BaseEnv" ) -> None :
0 commit comments