Skip to content

Commit

Permalink
Merge pull request #18 from BDonnot/gym_integration
Browse files Browse the repository at this point in the history
fix bugs introduced in 0.4.2 previously
  • Loading branch information
BDonnot committed Jan 9, 2020
2 parents f7996ee + b1117e1 commit a2c19cc
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 2,632 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,4 @@ grid2op/data/*/*.csv
**token.json
getting_started/study_agent_getting_started/
**Untitled.ipynb
grid2op/tests/test_agent/
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Change Log

[0.4.2] - 2020-01-08
--------------------
- [FIXED] Runner cannot save properly action and observation (sizes are not computed properly)
**now fixed and unit test added**
- [FIXED] Plot utility has a bug in extracting grid information.
**now fixed**
- [FIXED] gym compatibility issue for environment
- [FIXED] checking key-word arguments in "make" function: if an invalid argument is provided,
it now raises an error.
Expand Down Expand Up @@ -38,6 +42,8 @@ Action / Observation _lines_ex_pos_topo_vect lines_ex_pos_topo_vect
GridValue n_lines n_line
==================== ======================= =======================

- [UPDATE] the getting_started notebooks to reflect these changes

[0.4.1] - 2019-12-17
--------------------
- [FIXED] Bug#14 : Nan in the observation space after switching one powerline [PandaPowerBackend]
Expand Down
56 changes: 42 additions & 14 deletions getting_started/1_Observation_Agents.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@
"source": [
"print(\"Number of generators of the powergrid: {}\".format(obs.n_gen))\n",
"print(\"Number of loads of the powergrid: {}\".format(obs.n_load))\n",
"print(\"Number of powerline of the powergrid: {}\".format(obs.n_lines))\n",
"print(\"Number of elements connected to each substations in the powergrid: {}\".format(obs.subs_info))\n",
"print(\"Number of powerline of the powergrid: {}\".format(obs.n_line))\n",
"print(\"Number of elements connected to each substations in the powergrid: {}\".format(obs.sub_info))\n",
"print(\"Total number of elements: {}\".format(obs.dim_topo))"
]
},
Expand Down Expand Up @@ -566,8 +566,8 @@
{
"data": {
"text/plain": [
"array([ 2.01900000e+03, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,\n",
" 0.00000000e+00, 1.00000000e+01, 0.00000000e+00, 2.33000000e+01,\n",
"array([ 2.01900000e+03, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00,\n",
" 1.00000000e+01, 1.00000000e+00, 0.00000000e+00, 2.33000000e+01,\n",
" 6.91000000e+01, 0.00000000e+00, 1.49484728e+02, 4.71334079e+01,\n",
" 5.86085309e+01, 1.46841707e+01, 2.35979474e+01, -4.99757939e-01,\n",
" 1.41075000e+02, 1.36350000e+02, 2.22560000e-01, 1.30800000e+01,\n",
Expand Down Expand Up @@ -648,7 +648,35 @@
" 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,\n",
" 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,\n",
" 1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,\n",
" 1.00000000e+00, 1.00000000e+00])"
" 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,\n",
" -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,\n",
" -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,\n",
" -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,\n",
" -1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n",
" 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00])"
]
},
"execution_count": 12,
Expand Down Expand Up @@ -693,7 +721,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"None\n"
"[nan nan nan nan nan]\n"
]
}
],
Expand Down Expand Up @@ -1049,8 +1077,8 @@
"text": [
"The results for DoNothing agent are:\n",
"\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/1\n",
"\t\t - cumulative reward: 999.991933\n",
"\t\t - number of time steps completed: 50 / 50\n"
"\t\t - cumulative reward: 199.998003\n",
"\t\t - number of time steps completed: 10 / 10\n"
]
}
],
Expand Down Expand Up @@ -1089,8 +1117,8 @@
"text": [
"The results for the custom agent are:\n",
"\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/1\n",
"\t\t - cumulative reward: 999.991933\n",
"\t\t - number of time steps completed: 50 / 50\n"
"\t\t - cumulative reward: 199.998003\n",
"\t\t - number of time steps completed: 10 / 10\n"
]
}
],
Expand All @@ -1115,7 +1143,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"As we can see, there is a slight degradation of the performance (cumulative reward) for the second (custom) Agent. The cumulative reward in this case is 5739.95***1012*** the baseline (do nothing) was 5739.95***1023***.\n",
"As we can see, there is no change in the performance for both agent (there would be if we didn't limit the episode length to 10 time steps)\n",
"\n",
"This agent is NOT recommended.\n",
"\n",
Expand All @@ -1133,8 +1161,8 @@
"text": [
"The results for the PowerLineSwitch agent are:\n",
"\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/1\n",
"\t\t - cumulative reward: 999.992511\n",
"\t\t - number of time steps completed: 50 / 50\n"
"\t\t - cumulative reward: 199.998134\n",
"\t\t - number of time steps completed: 10 / 10\n"
]
}
],
Expand All @@ -1160,7 +1188,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We want however to emphasize that do nothing is NOT the best solution, even in this simple case. For example, an agent choosing at each time step to disconnect / reconnect as to greedily maximize the anticipated reward will have a cumulative reward of 5739.95***2376*** in this situation.\n",
"We want however to emphasize that do nothing is NOT the best solution, even in this simple case. For example, an agent choosing at each time step to disconnect / reconnect as to greedily maximize the anticipated reward will have a cumulative reward of 199.998***134*** in this situation.\n",
"\n",
"**NB** For these simulations, the score is completely irrealistic. Indeed, no special care has been taken to set the thermal limits to plausible values. This explain the very little different observed between the three agents above.\n",
"\n",
Expand Down

0 comments on commit a2c19cc

Please sign in to comment.