Converters

This page is organized as follow:

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

If you still can’t find what you’re looking for, try in one of the following pages:

Still trouble finding the information ? Do not hesitate to send a github issue about the documentation at this link: Documentation issue template

Copyright © Grid2Op a Series of LF Projects, LLC For website terms of use, trademark policy and other project policies please see https://lfprojects.org.