Skip to content

Commit

Permalink
Merge pull request #22 from rte-france/bd-dev
Browse files Browse the repository at this point in the history
Update to version  0.5.0
  • Loading branch information
BDonnot authored Aug 18, 2020
2 parents 5ce95a1 + f0403bf commit 83b0449
Show file tree
Hide file tree
Showing 20 changed files with 62 additions and 1,081 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ Change Log
--------
- stack multiple states in `utils/DeepQAgent`

[0.5.0] - 2020-08-??
[0.5.0] - 2020-08-18
--------------------
- [BREAKING] remove the SAC baseline that was not correct. For backward compatibility, its code
can still be accessed with SACOld
- [FIXED] the counting of the action types frequency in tensorboard (for some baselines)
- [FIXED] a broken Replay buffer `utils.ReplayBuffer` (used in some baselines)
- [FIXED] a bug in using multiple environments for some baselines
Expand Down
44 changes: 0 additions & 44 deletions docs/SAC.rst

This file was deleted.

4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
author = 'Benjamin DONNOT'

# The full version, including alpha/beta/rc tags
release = '0.4.4'
version = '0.4'
release = '0.5.0'
version = '0.5'

# -- General configuration ---------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Baseline already Available
DeepQSimple
DoubleDuelingDQN
DuelQSimple
SAC


More advanced baselines
Expand Down
2 changes: 1 addition & 1 deletion l2rpn_baselines/LeapNetEncoded/LeapNetEncoded_NN.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def predict_movement(self, data, epsilon, batch_size=None, training=False):
if batch_size is None:
batch_size = data.shape[0]
data_nn, true_output_grid = self._make_x_tau(data)
res = super().predict_movement(data_nn, epsilon=epsilon, batch_size=batch_size, training=False)
res = super().predict_movement(data_nn, epsilon=epsilon, batch_size=batch_size, training=training)
return res

def train(self, s_batch, a_batch, r_batch, d_batch, s2_batch, tf_writer=None, batch_size=None):
Expand Down
9 changes: 9 additions & 0 deletions l2rpn_baselines/LeapNetEncoded/LeapNetEncoded_NNParam.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,12 @@ def center_reduce(self, env):
self._center_reduce_vect(env.get_obs(), "tau")
self._center_reduce_vect(env.get_obs(), "gm_out")
self._center_reduce_vect(env.get_obs(), "input_q")

def _get_adds_mults_from_name(self, obs, attr_nm):
add_tmp, mult_tmp = super()._get_adds_mults_from_name(obs, attr_nm)
if attr_nm in ["line_status"]:
# transform time step overflow into (1. - timestep_overflow) [similar to the leap net papers]
# 0 powerline is connected, 1 powerline is NOT connected
add_tmp = -1.0
mult_tmp = -1.0
return add_tmp, mult_tmp
8 changes: 4 additions & 4 deletions l2rpn_baselines/LeapNetEncoded/study.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def study(env,
# Run
# Create agent
agent = LeapNetEncoded(action_space=env.action_space,
name=name,
store_action=nb_process == 1,
nn_archi=nn_archi,
observation_space=env.observation_space)
name=name,
store_action=nb_process == 1,
nn_archi=nn_archi,
observation_space=env.observation_space)

# Load weights from file
agent.load(load_path)
Expand Down
5 changes: 3 additions & 2 deletions l2rpn_baselines/LeapNetEncoded/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ def __call__(self, action, env, has_error, is_done, is_illegal, is_ambiguous):
"day_of_week",
"hour_of_day",
"minute_of_hour",
"rho"]
"rho",
]
li_attr_obs_Tau = ["line_status", "timestep_overflow"]
list_attr_gm_out = ["a_or", "a_ex", "p_or", "p_ex", "q_or", "q_ex", "prod_q", "load_v"] + li_attr_obs_X

Expand All @@ -405,7 +406,7 @@ def __call__(self, action, env, has_error, is_done, is_illegal, is_ambiguous):

'dim_topo': env_init.dim_topo,

"sizes_enc": (50, 50, 50, 50),
"sizes_enc": (50, 50, ),
"sizes_main": (300, 300, 300),
"sizes_out_gm": (100, ),
"sizes_Qnet": (200, 200, 200)
Expand Down
18 changes: 0 additions & 18 deletions l2rpn_baselines/SAC/SAC.py

This file was deleted.

Loading

0 comments on commit 83b0449

Please sign in to comment.