Пример #1
0
 def test_2_busswitch(self):
     agent = TopologyGreedy(self.env.helper_action_player)
     i, cum_reward = self._aux_test_agent(agent, i_max=10)
     assert i == 11, "The powerflow diverged before step 10 for greedy agent"
     assert np.abs(
         cum_reward - 12075.38800
     ) <= self.tol_one, "The reward has not been properly computed"
Пример #2
0
 def test_2_busswitch(self):
     agent = TopologyGreedy(self.env.helper_action_player)
     with warnings.catch_warnings():
         warnings.filterwarnings("error")
         i, cum_reward = self._aux_test_agent(agent, i_max=10)
     assert i == 11, "The powerflow diverged before step 10 for greedy agent"
     expected_reward = dt_float(12075.389)
     assert np.abs(cum_reward - expected_reward) <= self.tol_one, "The reward has not been properly computed"
Пример #3
0
def main(max_ts, name):
    backend = LightSimBackend()
    param = Parameters()
    param.init_from_dict({"NO_OVERFLOW_DISCONNECTION": True})

    env_klu = make(name,
                   backend=backend,
                   param=param,
                   gamerules_class=AlwaysLegal,
                   test=True)
    agent = TopologyGreedy(action_space=env_klu.action_space)
    nb_ts_klu, time_klu, aor_klu, gen_p_klu, gen_q_klu = run_env(
        env_klu, max_ts, agent)

    env_pp = make(name, param=param, gamerules_class=AlwaysLegal, test=True)
    agent = TopologyGreedy(action_space=env_pp.action_space)
    nb_ts_pp, time_pp, aor_pp, gen_p_pp, gen_q_pp = run_env(
        env_pp, max_ts, agent)

    print_res(env_klu, env_pp, nb_ts_klu, nb_ts_pp, time_klu, time_pp, aor_klu,
              aor_pp, gen_p_klu, gen_p_pp, gen_q_klu, gen_q_pp)
Пример #4
0
 def test_2_busswitch(self):
     agent = TopologyGreedy(self.env.action_space)
     with warnings.catch_warnings():
         warnings.filterwarnings("error")
         i, cum_reward, all_acts = self._aux_test_agent(agent, i_max=10)
     assert i == 11, "The powerflow diverged before step 10 for greedy agent"
     expected_reward = dt_float(12075.389)  # i have more actions now, so this is not correct (though it should be..
     # yet a proof that https://github.com/rte-france/Grid2Op/issues/86 is grounded
     expected_reward = dt_float(12277.632)
     # 12076.356
     # 12076.191
     expected_reward = dt_float(12076.356)
     assert np.abs(cum_reward - expected_reward) <= self.tol_one, "The reward has not been properly computed"
Пример #5
0
print("do-nothing")
with make(dataset, param=params, backend=backend) as env:
    agent = DoNothingAgent(env.action_space)
    runner = Runner(**env.get_params_for_runner(),
                    agentClass=None,
                    agentInstance=agent)
    runner.run(
        nb_episode=2,
        path_save="grid2viz/data/agents/do-nothing-baseline",
        nb_process=1,
        max_iter=2000,
        pbar=True,
    )
    env.close()

print("greedy")
with make(dataset, param=params, backend=backend) as env:
    agent = TopologyGreedy(env.action_space)
    runner = Runner(**env.get_params_for_runner(),
                    agentClass=None,
                    agentInstance=agent)
    runner.run(
        nb_episode=2,
        path_save="grid2viz/data/agents/greedy-baseline",
        nb_process=1,
        max_iter=2000,
        pbar=True,
    )
    env.close()