Skip to content

Latest commit

 

History

History
58 lines (41 loc) · 2.34 KB

converter.rst

File metadata and controls

58 lines (41 loc) · 2.34 KB

grid2op.Converter

Converters

This page is organized as follow:

Table of Contents

Objectives

In this module of grid2op, the "converters" are defined.

A converter is a specific class of grid2op.Action.ActionSpace (ie of BaseAction Space) that allows the agent to manipulate this action to have a different representation of it.

For example, suppose we are dealing with grid2op.Action.TopologyAndDispatchAction (only manipulating the graph of the powergrid). This is a discrete "action space". Often, it's custom to deal with such action space by enumerating all actions, and then assign to all valid actions a unique ID.

This can be done easily with the IdToAct class.

More concretely, the diagram of an agent is:

  1. receive an observation (in a form of an object of class grid2op.Observation.BaseObservation)
  2. implement the grid2op.Agent.BaseAgent.act taking as input an grid2op.Observation.BaseObservation and returning an grid2op.Action.BaseAction
  3. this grid2op.Action.BaseAction is then digested by the environment

Introducing some converters lead to the following:

  1. receive an observation (grid2op.Observation.BaseObservation)
  2. the transformer automatically (using Converter.convert_obs) to a transformed observation
  3. implement the function grid2op.Agent.AgentWithConverter.my_act that takes as input a transformed observation and returns an encoded action
  4. the transformer automatically transforms back the encoded action into a proper grid2op.Action.BaseAction
  5. this grid2op.Action.BaseAction is then digested by the environment

This simple mechanism allows people to focus on iii) above (typically implemented with artificial neural networks) without having to worry each time about the complex representations of actions and observations.

More details and a concrete example is given in the documentation of the class grid2op.Agent.AgentWithConverter.

Some examples of converters are given in IdToAct and ToVect.

Detailed Documentation by class

grid2op.Converter