/
DoNothing.py
47 lines (37 loc) · 1.79 KB
/
DoNothing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Copyright (c) 2019-2020, RTE (https://www.rte-france.com)
# See AUTHORS.txt
# This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0.
# If a copy of the Mozilla Public License, version 2.0 was not distributed with this file,
# you can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
# This file is part of Grid2Op, Grid2Op a testbed platform to model sequential decision making in power systems.
from grid2op.Agent.BaseAgent import BaseAgent
class DoNothingAgent(BaseAgent):
"""
This is the most basic BaseAgent. It is purely passive, and does absolutely nothing.
"""
def __init__(self, action_space):
BaseAgent.__init__(self, action_space)
def act(self, observation, reward, done=False):
"""
As better explained in the document of :func:`grid2op.BaseAction.update` or
:func:`grid2op.BaseAction.ActionSpace.__call__`.
The preferred way to make an object of type action is to call :func:`grid2op.BaseAction.ActionSpace.__call__` with
the
dictionnary representing the action. In this case, the action is "do nothing" and it is represented by the
empty dictionnary.
Parameters
----------
observation: :class:`grid2op.Observation.Observation`
The current observation of the :class:`grid2op.Environment.Environment`
reward: ``float``
The current reward. This is the reward obtained by the previous action
done: ``bool``
Whether the episode has ended or not. Used to maintain gym compatibility
Returns
-------
res: :class:`grid2op.Action.Action`
The action chosen by the bot / controller / agent.
"""
res = self.action_space({})
return res