diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9a7c8f806..00d4dc9e6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,8 +1,13 @@ Change Log ============= -[0.5.0] - 2020-01-xx + +[0.5.0] - 2020-01-23 -------------------- -- [FIXED] A bug in the conversion from pair unit to kv in pandapower backend. Adding some tests for that too. +- [BREAKING] Action/Backend has been modified with the implementation of redispatching. If + you used a custom backend, you'll have to implement the "redispatching" part. +- [BREAKING] with the introduction of redispatching, old action space and observation space, + stored as json for example, will not be usable: action size and observation size + have been modified. - [ADDED] A converter class that allows to pre-process observation, and post-process action when given to an `Agent`. This allows for more flexibility in the `action_space` and `observation_space`. @@ -11,27 +16,21 @@ Change Log - [ADDED] Redispatching possibility for the environment - [ADDED] More complete documentation of the representation of the powergrid (see documentation of `Space`) +- [FIXED] A bug in the conversion from pair unit to kv in pandapower backend. Adding some tests for that too. - [UPDATED] More complete documentation of the Action class (with some examples) - [UPDATED] More unit test for observations -- [UPDATED] Remove the TODO's already coded (no more todo then) +- [UPDATED] Remove the TODO's already coded - [UPDATED] GridStateFromFile can now read the starting date and the time interval of the chronics. -- [BREAKING] Action/Backend has been modified with the implementation of redispatching. If - you used a custom backend, you'll have to implement the "redispatching" part. -- [BREAKING] with the introduction of redispatching, old action space and observation space, - stored as json for example, will not be usable: action size and observation size - have been modified. +- [UPDATED] Documentation of Observation: adding the units + (`issue 22 `_) +- [UPDATED] Notebook `getting_started/4_StudyYourAgent.ipynb` to use the converter now (much shorter and clearer) + +[0.4.3] - 2020-01-20 +-------------------- +- [FIXED] Bug in L2RPN2019 settings, that had not been modified after the changes of version 0.4.2. [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. -- [UPDATED] multiple random generator streams for observations -- [UPDATED] Refactoring of the Action and Observation Space. They now both inherit from "Space" - [BREAKING] previous saved Action Spaces and Observation Spaces (as dictionnary) are no more compatible - [BREAKING] renaming of attributes describing the powergrid across classes for better consistency: @@ -62,7 +61,16 @@ 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 +- [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. +- [UPDATED] multiple random generator streams for observations +- [UPDATED] Refactoring of the Action and Observation Space. They now both inherit from "Space" +- [UPDATED] the getting_started notebooks to reflect these changes [0.4.1] - 2019-12-17 -------------------- @@ -72,25 +80,25 @@ GridValue n_lines n_line [0.4.0] - 2019-12-04 -------------------- - [ADDED] Basic tools for plotting with the `PlotPlotly` module -- [UPDATED] handling of the `AmbiguousAction` and `IllegalAction` exceptions (and appropriated tests) - [ADDED] support of maintenance operation as well as hazards in the Observation (and appropriated tests) - [ADDED] support for maintenance operation in the Environment (read from the chronics) +- [ADDED] example of chronics with hazards and maintenance +- [UPDATED] handling of the `AmbiguousAction` and `IllegalAction` exceptions (and appropriated tests) - [UPDATED] various documentation, in particular the class Observation - [UPDATED] information retrievable `Observation.state_of` -- [ADDED] example of chronics with hazards and maintenance [0.3.6] - 2019-12-01 -------------------- -- [UPDATED] Readme with docker - [ADDED] functionality to restrict action based on previous actions (impacts `Environment`, `GameRules` and `Parameters`) - [ADDED] tests for the notebooks in `getting_started` - [UPDATED] readme to properly show the docker capability +- [UPDATED] Readme with docker [0.3.5] - 2019-11-28 -------------------- - [ADDED] serialization of the environment modifications -- [FIXED] error messages in `grid2op.GridValue.check_validity` - [ADDED] the changelog file -- [UPDATED] notebook getting_started/4_StudyYourAgent.ipynb to reflect these changes -- [ADDED] serialization of hazards and maintenance in actions (if any) \ No newline at end of file +- [ADDED] serialization of hazards and maintenance in actions (if any) +- [FIXED] error messages in `grid2op.GridValue.check_validity` +- [UPDATED] notebook `getting_started/4_StudyYourAgent.ipynb` to reflect these changes diff --git a/docs/conf.py b/docs/conf.py index 3eb682d47..9f54e7a6a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,8 +22,8 @@ author = 'Benjamin Donnot' # The full version, including alpha/beta/rc tags -release = '0.4.3' -version = '0.4' +release = '0.5.0' +version = '0.5' # -- General configuration --------------------------------------------------- diff --git a/docs/index.rst b/docs/index.rst index a5ac45cec..58344f8a5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -53,6 +53,7 @@ Technical Documentation :maxdepth: 1 action + converters agent backend backendpp diff --git a/getting_started/0_basic_functionalities.ipynb b/getting_started/0_basic_functionalities.ipynb index e3a024736..f6bdde483 100644 --- a/getting_started/0_basic_functionalities.ipynb +++ b/getting_started/0_basic_functionalities.ipynb @@ -47,7 +47,16 @@ "cell_type": "code", "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "pygame 1.9.6\n", + "Hello from the pygame community. https://www.pygame.org/contribute.html\n" + ] + } + ], "source": [ "import os\n", "import sys\n", @@ -520,7 +529,7 @@ "output_type": "stream", "text": [ "This agent managed to survive 11 timesteps\n", - "It's final cumulated reward is 11.0\n" + "It's final cumulated reward is 219.99783718276583\n" ] } ], @@ -613,7 +622,7 @@ "output_type": "stream", "text": [ "The results are:\n", - "\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/1\n", + "\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/2\n", "\t\t - cumulative reward: 10.00\n", "\t\t - number of time steps completed: 10 / 10\n" ] @@ -645,7 +654,7 @@ "output_type": "stream", "text": [ "The results are:\n", - "\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/1\n", + "\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/2\n", "\t\t - cumulative reward: 10.00\n", "\t\t - number of time steps completed: 10 / 10\n" ] @@ -687,7 +696,7 @@ "output_type": "stream", "text": [ "The results are:\n", - "\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/1\n", + "\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/2\n", "\t\t - cumulative reward: 10.00\n", "\t\t - number of time steps completed: 10 / 10\n" ] diff --git a/getting_started/1_Observation_Agents.ipynb b/getting_started/1_Observation_Agents.ipynb index f884f2f89..ff3377955 100644 --- a/getting_started/1_Observation_Agents.ipynb +++ b/getting_started/1_Observation_Agents.ipynb @@ -54,7 +54,16 @@ "cell_type": "code", "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "pygame 1.9.6\n", + "Hello from the pygame community. https://www.pygame.org/contribute.html\n" + ] + } + ], "source": [ "import os\n", "import sys\n", @@ -389,9 +398,9 @@ "text": [ "Loads active consumption: [18.8 85.1 13.8 44.3 7.1 10.2 27.1 8.2 3.2 5.7 11.8]\n", "Loads reactive consumption: [47.13340788 58.60853089 14.68417071 23.59794742 -0.49975794]\n", - "Loads voltage (voltage magnitude of the bus to which it is connected) : [141.075 0.21788455 0.21533202 0.21830444 0.21692824\n", - " 0.2111932 137.68220138 0.22256 14.72610185 13.08\n", - " 0.21591106]\n" + "Loads voltage (voltage magnitude of the bus to which it is connected) : [141.075 136.35 0.2111932 136.42874991 137.68220138\n", + " 0.22256 0.21591106 0.21533202 0.21788455 0.21830444\n", + " 0.21692824]\n" ] } ], @@ -577,9 +586,9 @@ " 1.31000000e+01, 6.01000000e+01, 9.50000000e+00, 3.15000000e+01,\n", " 4.90000000e+00, 7.10000000e+00, 1.91000000e+01, 5.80000000e+00,\n", " 2.20000000e+00, 4.00000000e+00, 8.40000000e+00, 1.41075000e+02,\n", - " 2.17884546e-01, 2.15332022e-01, 2.18304445e-01, 2.16928244e-01,\n", - " 2.11193196e-01, 1.37682201e+02, 2.22560000e-01, 1.47261019e+01,\n", - " 1.30800000e+01, 2.15911056e-01, 1.08718903e+02, 4.07658248e+01,\n", + " 1.36350000e+02, 2.11193196e-01, 1.36428750e+02, 1.37682201e+02,\n", + " 2.22560000e-01, 2.15911056e-01, 2.15332022e-01, 2.17884546e-01,\n", + " 2.18304445e-01, 2.16928244e-01, 1.08718903e+02, 4.07658248e+01,\n", " -8.32701461e+00, 4.06838088e-01, -1.65603459e+01, 3.00462070e+00,\n", " 1.37826937e+01, 4.38146976e+01, 2.86127910e+01, 1.54475549e+01,\n", " -1.88518005e+01, -5.44944509e+01, 2.03193013e+01, 8.80848061e+00,\n", @@ -1079,7 +1088,7 @@ "output_type": "stream", "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", + "\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/2\n", "\t\t - cumulative reward: 199.998003\n", "\t\t - number of time steps completed: 10 / 10\n" ] @@ -1119,7 +1128,7 @@ "output_type": "stream", "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", + "\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/2\n", "\t\t - cumulative reward: 199.998003\n", "\t\t - number of time steps completed: 10 / 10\n" ] @@ -1163,8 +1172,8 @@ "output_type": "stream", "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: 199.998134\n", + "\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/2\n", + "\t\t - cumulative reward: 199.998150\n", "\t\t - number of time steps completed: 10 / 10\n" ] } diff --git a/getting_started/2_Action_GridManipulation.ipynb b/getting_started/2_Action_GridManipulation.ipynb index 5d13585f1..ba25f04e3 100644 --- a/getting_started/2_Action_GridManipulation.ipynb +++ b/getting_started/2_Action_GridManipulation.ipynb @@ -54,7 +54,16 @@ "cell_type": "code", "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "pygame 1.9.6\n", + "Hello from the pygame community. https://www.pygame.org/contribute.html\n" + ] + } + ], "source": [ "import os\n", "import sys\n", @@ -460,6 +469,7 @@ "text": [ "This action will:\n", "\t - NOT change anything to the injections\n", + "\t - NOT perform any redispatching action\n", "\t - force reconnection of 2 powerlines ([3 4])\n", "\t - force disconnection of 2 powerlines ([5 6])\n", "\t - switch status of 3 powerlines ([0 1 2])\n", @@ -504,6 +514,7 @@ "text": [ "This action will:\n", "\t - NOT change anything to the injections\n", + "\t - NOT perform any redispatching action\n", "\t - force reconnection of 2 powerlines ([3 4])\n", "\t - force disconnection of 2 powerlines ([5 6])\n", "\t - switch status of 3 powerlines ([0 1 2])\n", @@ -579,6 +590,7 @@ "text": [ "This action will:\n", "\t - NOT change anything to the injections\n", + "\t - NOT perform any redispatching action\n", "\t - NOT force any line status\n", "\t - NOT switch any line status\n", "\t - NOT switch anything in the topology\n", @@ -617,6 +629,7 @@ "text": [ "This action will:\n", "\t - NOT change anything to the injections\n", + "\t - NOT perform any redispatching action\n", "\t - NOT force any line status\n", "\t - NOT switch any line status\n", "\t - Change the bus of the following element:\n", @@ -648,6 +661,7 @@ "text": [ "This action will:\n", "\t - NOT change anything to the injections\n", + "\t - NOT perform any redispatching action\n", "\t - NOT force any line status\n", "\t - NOT switch any line status\n", "\t - NOT switch anything in the topology\n", @@ -681,6 +695,7 @@ "text": [ "This action will:\n", "\t - NOT change anything to the injections\n", + "\t - NOT perform any redispatching action\n", "\t - NOT force any line status\n", "\t - NOT switch any line status\n", "\t - NOT switch anything in the topology\n", @@ -710,22 +725,19 @@ "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "This action will:\n", - "\t - NOT change anything to the injections\n", - "\t - force reconnection of 1 powerlines ([1])\n", - "\t - NOT switch any line status\n", - "\t - NOT switch anything in the topology\n", - "\t - Set the bus of the following element:\n", - "\t \t - assign bus 1 to line (origin) 1 [on substation 0]\n", - "\t \t - assign bus 1 to line (extremity) 1 [on substation 4]\n" + "ename": "TypeError", + "evalue": "reconnect_powerline() got an unexpected keyword argument 'l_id'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mreconnecting_line_1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0maction_space\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreconnect_powerline\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ml_id\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mbus_or\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mbus_ex\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreconnecting_line_1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mTypeError\u001b[0m: reconnect_powerline() got an unexpected keyword argument 'l_id'" ] } ], "source": [ - "reconnecting_line_1 = action_space.reconnect_powerline(l_id=1,bus_or=1,bus_ex=1)\n", + "reconnecting_line_1 = action_space.reconnect_powerline(line_id=1,bus_or=1,bus_ex=1)\n", "print(reconnecting_line_1)" ] }, @@ -751,23 +763,9 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "This action will:\n", - "\t - NOT change anything to the injections\n", - "\t - NOT force any line status\n", - "\t - NOT switch any line status\n", - "\t - NOT switch anything in the topology\n", - "\t - Set the bus of the following element:\n", - "\t \t - assign bus 2 to generator 0 [on substation 1]\n" - ] - } - ], + "outputs": [], "source": [ "my_act = action_space.set_bus(\"gen_1_0\", # mandatory name of the element\n", " new_bus=2, # mandatory the new bus to connect it too\n", @@ -779,24 +777,9 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "This action will:\n", - "\t - NOT change anything to the injections\n", - "\t - NOT force any line status\n", - "\t - NOT switch any line status\n", - "\t - NOT switch anything in the topology\n", - "\t - Set the bus of the following element:\n", - "\t \t - assign bus 2 to line (origin) 8 [on substation 1]\n", - "\t \t - assign bus 2 to generator 0 [on substation 1]\n" - ] - } - ], + "outputs": [], "source": [ "action_space.set_bus(\"1_3_8\", # mandatory name of the element\n", " extremity=\"or\", # mandatory, which extrmity to change\n", diff --git a/getting_started/3_TrainingAnAgent.ipynb b/getting_started/3_TrainingAnAgent.ipynb index 1a1ac6f68..b4a6e72ea 100644 --- a/getting_started/3_TrainingAnAgent.ipynb +++ b/getting_started/3_TrainingAnAgent.ipynb @@ -245,7 +245,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -273,7 +273,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -300,7 +300,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -397,7 +397,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -438,7 +438,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -513,7 +513,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -569,7 +569,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -632,7 +632,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -834,7 +834,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -908,7 +908,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -1081,7 +1081,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -1092,41 +1092,51 @@ "Instructions for updating:\n", "Colocations handled automatically by placer.\n", "Successfully constructed networks.\n", - "Lived with maximum time 50\n", - "Earned a total of reward equal to 999.9920304611152\n", "WARNING:tensorflow:From /home/donnotben/.local/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.\n", "Instructions for updating:\n", "Use tf.cast instead.\n", + "Lived with maximum time 56\n", + "Earned a total of reward equal to 1119.9867235500346\n", + "Lived with maximum time 6\n", + "Earned a total of reward equal to 99.99900274529449\n", + "We had a loss equal to 24369.516\n", + "Lived with maximum time 91\n", + "Earned a total of reward equal to 1799.9825665398848\n", + "Lived with maximum time 47\n", + "Earned a total of reward equal to 919.9873536471537\n", + "We had a loss equal to 197397.73\n", + "Lived with maximum time 2\n", + "Earned a total of reward equal to 19.999789920293725\n", "Lived with maximum time 1\n", "Earned a total of reward equal to 0.0\n", - "We had a loss equal to 114670.27\n", - "Lived with maximum time 106\n", - "Earned a total of reward equal to 2099.9715911363296\n", - "Lived with maximum time 20\n", - "Earned a total of reward equal to 379.9963742978001\n", - "Lived with maximum time 13\n", - "Earned a total of reward equal to 239.99723063847432\n", - "Lived with maximum time 8\n", - "Earned a total of reward equal to 139.99848845275488\n", - "We had a loss equal to 266143.47\n", - "Lived with maximum time 7\n", - "Earned a total of reward equal to 119.99834602072825\n", - "Lived with maximum time 28\n", - "Earned a total of reward equal to 539.9935364605712\n", - "Lived with maximum time 34\n", - "Earned a total of reward equal to 659.9824675070619\n", - "We had a loss equal to 375963.38\n", - "Lived with maximum time 61\n", - "Earned a total of reward equal to 1199.9872936275622\n", - "Lived with maximum time 13\n", - "Earned a total of reward equal to 239.9969214564342\n", - "We had a loss equal to 1297703.2\n", - "Lived with maximum time 83\n", - "Earned a total of reward equal to 1639.9812973014007\n", + "Lived with maximum time 1\n", + "Earned a total of reward equal to 0.0\n", + "Lived with maximum time 1\n", + "Earned a total of reward equal to 0.0\n", + "Lived with maximum time 1\n", + "Earned a total of reward equal to 0.0\n", + "Lived with maximum time 1\n", + "Earned a total of reward equal to 0.0\n", + "Lived with maximum time 1\n", + "Earned a total of reward equal to 0.0\n", + "Lived with maximum time 10\n", + "Earned a total of reward equal to 179.9982348312529\n", "Lived with maximum time 13\n", - "Earned a total of reward equal to 239.9969214564342\n", - "Lived with maximum time 27\n", - "Earned a total of reward equal to 519.9888165634795\n", + "Earned a total of reward equal to 239.9975871017263\n", + "Lived with maximum time 17\n", + "Earned a total of reward equal to 319.9963352443193\n", + "We had a loss equal to 415911.16\n", + "Lived with maximum time 89\n", + "Earned a total of reward equal to 1759.9736204339242\n", + "Lived with maximum time 47\n", + "Earned a total of reward equal to 919.9896974762444\n", + "We had a loss equal to 895179.1\n", + "Lived with maximum time 42\n", + "Earned a total of reward equal to 819.9913871544907\n", + "Lived with maximum time 48\n", + "Earned a total of reward equal to 939.9894397616745\n", + "Lived with maximum time 14\n", + "Earned a total of reward equal to 259.99683450592977\n", "Saving Network\n", "Successfully saved network.\n" ] @@ -1182,12 +1192,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "from grid2op.Runner import Runner\n", - "from grid2op.ChronicsHandler import GridStateFromFileWithForecasts, \n", + "from grid2op.ChronicsHandler import GridStateFromFileWithForecasts, Multifolder\n", "scoring_function = L2RPNReward\n", "\n", "# make a runner\n", @@ -1211,9 +1221,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The results for the trained agent are:\n", + "\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/2\n", + "\t\t - cumulative reward: 199.997670\n", + "\t\t - number of time steps completed: 10 / 10\n" + ] + } + ], "source": [ "import shutil\n", "path_save=\"trained_agent_log\"\n", @@ -1285,9 +1306,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\t\t\tdict_env_modification_space.json\r\n", + "dict_action_space.json\tdict_observation_space.json\r\n" + ] + } + ], "source": [ "!ls trained_agent_log" ] @@ -1305,11 +1335,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "actions.npy\t\t\t env_modifications.npy observations.npy\r\n", + "agent_exec_times.npy\t\t episode_meta.json\t _parameters.json\r\n", + "disc_lines_cascading_failure.npy episode_times.json\t rewards.npy\r\n" + ] + } + ], "source": [ - "!ls trained_agent_log/chronics" + "!ls trained_agent_log/1" ] }, { @@ -1323,11 +1363,11 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ - "all_actions = np.load(os.path.join(\"trained_agent_log\", \"chronics\", \"actions.npy\"))\n", + "all_actions = np.load(os.path.join(\"trained_agent_log\", \"1\", \"actions.npy\"))\n", "li_actions = []\n", "for i in range(all_actions.shape[0]):\n", " tmp = runner.env.action_space.from_vect(all_actions[i,:])\n", @@ -1345,9 +1385,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "9" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "line_disc = 0\n", "line_reco = 0\n", @@ -1375,11 +1426,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "all_observations = np.load(os.path.join(\"trained_agent_log\", \"chronics\", \"observations.npy\"))\n", + "all_observations = np.load(os.path.join(\"trained_agent_log\", \"1\", \"observations.npy\"))\n", "li_observations = []\n", "nb_real_disc = 0\n", "for i in range(all_observations.shape[0]):\n", @@ -1398,9 +1460,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Number of different actions played: 2\n" + ] + } + ], "source": [ "actions_count = {}\n", "for act in li_actions:\n", @@ -1444,7 +1514,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -1465,7 +1535,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 23, "metadata": {}, "outputs": [ { @@ -1473,38 +1543,40 @@ "output_type": "stream", "text": [ "Successfully constructed networks.\n", - "Lived with maximum time 26\n", - "Earned a total of reward equal to 519.9942970392262\n", - "Lived with maximum time 3\n", - "Earned a total of reward equal to 39.999468684794714\n", - "Lived with maximum time 40\n", - "Earned a total of reward equal to 779.9902295991952\n", - "We had a loss equal to 1.8025886\n", - "Lived with maximum time 98\n", - "Earned a total of reward equal to 1939.9281935014285\n", - "Lived with maximum time 3\n", - "Earned a total of reward equal to 39.99913207206239\n", - "We had a loss equal to 1.8322923\n", "Lived with maximum time 36\n", - "Earned a total of reward equal to 699.9924635840933\n", - "Lived with maximum time 48\n", - "Earned a total of reward equal to 939.9867702692889\n", + "Earned a total of reward equal to 719.9895521483418\n", "Lived with maximum time 8\n", - "Earned a total of reward equal to 139.9982050774638\n", + "Earned a total of reward equal to 139.99768011521434\n", + "Lived with maximum time 4\n", + "Earned a total of reward equal to 59.99906341223206\n", + "We had a loss equal to 1.8023443\n", + "Lived with maximum time 72\n", + "Earned a total of reward equal to 1419.9760873213631\n", + "Lived with maximum time 2\n", + "Earned a total of reward equal to 19.999660128304583\n", + "Lived with maximum time 46\n", + "Earned a total of reward equal to 899.9869612195764\n", + "Lived with maximum time 17\n", + "Earned a total of reward equal to 319.9950273884641\n", + "We had a loss equal to 1.8021951\n", + "Lived with maximum time 41\n", + "Earned a total of reward equal to 799.987719729006\n", + "Lived with maximum time 17\n", + "Earned a total of reward equal to 319.9949135892812\n", + "Lived with maximum time 21\n", + "Earned a total of reward equal to 399.9938856128067\n", + "We had a loss equal to 1.8023629\n", + "Lived with maximum time 63\n", + "Earned a total of reward equal to 1239.9800818087667\n", + "Lived with maximum time 16\n", + "Earned a total of reward equal to 299.9951132765008\n", "Lived with maximum time 2\n", - "Earned a total of reward equal to 19.999733312160764\n", - "We had a loss equal to 1.8326377\n", - "Lived with maximum time 67\n", - "Earned a total of reward equal to 1319.9818394245372\n", - "Lived with maximum time 34\n", - "Earned a total of reward equal to 659.9915949543215\n", - "Lived with maximum time 5\n", - "Earned a total of reward equal to 79.99894483556265\n", - "We had a loss equal to 1.7758247\n", - "Lived with maximum time 62\n", - "Earned a total of reward equal to 1219.9904937657643\n", - "Lived with maximum time 23\n", - "Earned a total of reward equal to 439.9950118423079\n", + "Earned a total of reward equal to 19.999660128304583\n", + "Lived with maximum time 31\n", + "Earned a total of reward equal to 599.9903531318918\n", + "We had a loss equal to 1.8029592\n", + "Lived with maximum time 106\n", + "Earned a total of reward equal to 2099.9686713192973\n", "Saving Network\n", "Successfully saved network.\n" ] @@ -1517,13 +1589,6 @@ "trainer = TrainAgent(agent=my_agent, env=env)\n", "trainer.train(nb_frame)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/getting_started/4_StudyYourAgent.ipynb b/getting_started/4_StudyYourAgent.ipynb index 79015833f..53a0dbb16 100644 --- a/getting_started/4_StudyYourAgent.ipynb +++ b/getting_started/4_StudyYourAgent.ipynb @@ -106,11 +106,11 @@ "output_type": "stream", "text": [ "The results for the evaluated 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: 199.998134\n", - "\t\t - number of time steps completed: 10 / 10\n", "\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/2\n", - "\t\t - cumulative reward: 199.998134\n", + "\t\t - cumulative reward: 199.998150\n", + "\t\t - number of time steps completed: 10 / 10\n", + "\tFor chronics located at /home/donnotben/.local/lib/python3.6/site-packages/grid2op/data/test_multi_chronics/1\n", + "\t\t - cumulative reward: 199.998150\n", "\t\t - number of time steps completed: 10 / 10\n" ] } @@ -159,8 +159,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "1 dict_action_space.json\t dict_observation_space.json\r\n", - "2 dict_env_modification_space.json\r\n" + "1 chronics\t\t dict_env_modification_space.json\r\n", + "2 dict_action_space.json dict_observation_space.json\r\n" ] } ], @@ -426,9 +426,11 @@ 6, 7, 8, - 9 + 9, + 10 ], "y": [ + 86.5, 85.1, 85.7, 86.1, @@ -1267,20 +1269,20 @@ "
\n", " \n", " \n", - "
\n", + "
\n", "