Skip to main content

A framework to build Reinforcement Learning environments for Active Network Management tasks in electricity networks.

Project description

gym-anm

Documentation Status codecov CI (pip) CI (conda) License: MIT

gym-anm is a framework for designing reinforcement learning (RL) environments that model Active Network Management (ANM) tasks in electricity distribution networks. It is built on top of the OpenAI Gym toolkit.

The gym-anm framework was designed with one goal in mind: bridge the gap between research in RL and in the management of power systems. We attempt to do this by providing RL researchers with an easy-to-work-with library of environments that model decision-making tasks in power grids.

Key features

  • Very little background in electricity systems modelling it required. This makes gym-anm an ideal starting point for RL students and researchers looking to enter the field.
  • The environments (tasks) generated by gym-anm follow the OpenAI Gym framework, with which a large part of the RL community is already familiar.
  • The flexibility of gym-anm, with its different customizable components, makes it a suitable framework to model a wide range of ANM tasks, from simple ones that can be used for educational purposes, to complex ones designed to conduct advanced research.

Documentation

Documentation is provided online at https://gym-anm.readthedocs.io/en/latest/.

Installation

Requirements

gym-anm requires Python 3.7+ and can run on Linux, MaxOS, and Windows.

We recommend installing gym-anm in a Python environment (e.g., virtualenv or conda).

Using pip

Using pip (preferably after activating your virtual environment):

pip install gym-anm

Using conda

If you would like to run gym-anm inside a conda environment, you can:

  1. Install conda (or simply miniconda).
  2. Create a new environment my_env:
conda create --name my_env 
conda activate my_env
  1. Install gym-anm:
conda install gym-anm

Building from source

Alternatively, you can build gym-anm directly from source:

git clone https://github.com/robinhenry/gym-anm.git
cd gym-anm
pip install -e .

Example

The following code snippet illustrates how gym-anm environments can be used. In this example, actions are randomly sampled from the action space of the environment ANM6Easy-v0. For more information about the agent-environment interface, see the official OpenAI Gym documentation.

import gym
import time

env = gym.make('gym_anm:ANM6Easy-v0')
o = env.reset()

for i in range(100):
    a = env.action_space.sample()
    o, r, done, info = env.step(a)
    env.render()
    time.sleep(0.5)  # otherwise the rendering is too fast for the human eye.

The above code would render the environment in your default web browser as shown in the image below: alt text

Additional example scripts can be found in examples/.

Testing the installation

All unit tests in gym-anm can be ran from the project root directory with:

python -m tests

Citing the project

To cite this project in publications, cite the original paper:

ADD BIBTEX

Maintainers

gym-anm is currently maintained by Robin Henry.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gym-anm-1.0.0.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

gym_anm-1.0.0-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page