A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

Gym-ANM

Design Reinforcement Learning environments that model Active Network Management tasks in electricity distribution networks.
https://github.com/robinhenry/gym-anm

Category: Energy Systems
Sub Category: Grid Management and Microgrid

Keywords

active-network-management control electricity-networks gym-environments reinforcement-learning

Last synced: about 12 hours ago
JSON representation

Repository metadata

A framework to design Reinforcement Learning environments that model Active Network Management (ANM) tasks in electricity distribution networks.

README.md

Gym-ANM

Downloads
Documentation Status
codecov
Checks
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
Gymnasium 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.

Papers:

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 Gymnasium
    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.10+ and can run on Linux, MaxOS, and Windows. Some rendering features may not work properly
on Windows (not tested).

If you need Python 3.8 or 3.9, you can use gym-anm < 2.0.

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

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 Gymnasium documentation.

import gymnasium as gym
import time

def run():
   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.

   env.close()

if __name__ == '__main__':
    run()

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 pytest tests

Contributing

Contributions are always welcome! Please read the contribution guidelines first.

Citing the project

All publications derived from the use of gym-anm should cite the following two 2021 papers:

@article{HENRY2021100092,
    title = {Gym-ANM: Reinforcement learning environments for active network management tasks in electricity distribution systems},
    journal = {Energy and AI},
    volume = {5},
    pages = {100092},
    year = {2021},
    issn = {2666-5468},
    doi = {https://doi.org/10.1016/j.egyai.2021.100092},
    author = {Robin Henry and Damien Ernst},
}
@article{HENRY2021100092,
    title = {Gym-ANM: Open-source software to leverage reinforcement learning for power system management in research and education},
    journal = {Software Impacts},
    volume = {9},
    pages = {100092},
    year = {2021},
    issn = {2665-9638},
    doi = {https://doi.org/10.1016/j.simpa.2021.100092},
    author = {Robin Henry and Damien Ernst}
}

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.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 6 days ago

Total Commits: 235
Total Committers: 3
Avg Commits per committer: 78.333
Development Distribution Score (DDS): 0.021

Commits in past year: 8
Committers in past year: 1
Avg Commits per committer in past year: 8.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Robin Henry r****2@g****m 230
robin henry r****y@v****e 4
Satya Prakash Dash s****h@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 10
Total pull requests: 11
Average time to close issues: 3 months
Average time to close pull requests: 2 days
Total issue authors: 7
Total pull request authors: 2
Average comments per issue: 1.5
Average comments per pull request: 0.0
Merged pull request: 10
Bot issues: 0
Bot pull requests: 0

Past year issues: 0
Past year pull requests: 2
Past year average time to close issues: N/A
Past year average time to close pull requests: 6 days
Past year issue authors: 0
Past year pull request authors: 1
Past year average comments per issue: 0
Past year average comments per pull request: 0.0
Past year merged pull request: 1
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/robinhenry/gym-anm

Top Issue Authors

  • pablo-ta (2)
  • Kim-369 (2)
  • sifatron (2)
  • sprakashdash (1)
  • robinhenry (1)
  • diegofz (1)
  • lordmuck2020 (1)

Top Pull Request Authors

  • robinhenry (10)
  • sprakashdash (1)

Top Issue Labels

  • stale (2)
  • enhancement (1)
  • bug (1)

Top Pull Request Labels


Package metadata

pypi.org: gym-anm

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

  • Homepage: https://github.com/robinhenry/gym-anm
  • Documentation: https://gym-anm.readthedocs.io/en/latest/
  • Licenses: MIT
  • Latest release: 2.0.1 (published 5 months ago)
  • Last Synced: 2025-04-26T12:32:42.024Z (1 day ago)
  • Versions: 11
  • Dependent Packages: 1
  • Dependent Repositories: 3
  • Downloads: 463 Last month
  • Rankings:
    • Downloads: 3.086%
    • Dependent packages count: 3.244%
    • Average: 5.876%
    • Stargazers count: 6.513%
    • Forks count: 7.395%
    • Dependent repos count: 9.143%
  • Maintainers (1)

Dependencies

.github/workflows/ci_checks.yml actions
  • abatilo/actions-poetry v2 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
.github/workflows/ci_release.yml actions
  • abatilo/actions-poetry v2.0.0 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
poetry.lock pypi
  • attrs 22.1.0 develop
  • black 22.10.0 develop
  • click 8.1.3 develop
  • colorama 0.4.6 develop
  • coverage 6.5.0 develop
  • exceptiongroup 1.0.4 develop
  • iniconfig 1.1.1 develop
  • mypy 0.981 develop
  • mypy-extensions 0.4.3 develop
  • packaging 21.3 develop
  • pathspec 0.10.2 develop
  • platformdirs 2.5.4 develop
  • pluggy 1.0.0 develop
  • pyparsing 3.0.9 develop
  • pytest 7.2.0 develop
  • pytest-cov 3.0.0 develop
  • tomli 2.0.1 develop
  • typing-extensions 4.4.0 develop
  • certifi 2022.9.24
  • charset-normalizer 2.1.1
  • cloudpickle 2.2.0
  • cvxpy 1.2.2
  • ecos 2.0.10
  • gym 0.26.2
  • gym-notices 0.0.8
  • idna 3.4
  • importlib-metadata 5.1.0
  • numpy 1.23.5
  • osqp 0.6.2.post8
  • pandas 1.5.2
  • python-dateutil 2.8.2
  • pytz 2022.6
  • qdldl 0.1.5.post2
  • requests 2.28.1
  • scipy 1.9.3
  • scs 3.2.2
  • six 1.16.0
  • urllib3 1.26.13
  • websocket-client 0.56.0
  • websocket-server 0.4
  • zipp 3.11.0
pyproject.toml pypi
  • cvxpy ^1.2.2
  • gym ^0.26.2
  • numpy ^1.23.5
  • pandas ^1.5.2
  • python ^3.8
  • requests ^2.28.1
  • websocket-client 0.56.0
  • websocket-server 0.4
.github/workflows/stale_issues.yml actions
  • actions/stale v5 composite
docs/requirements.txt pypi
  • gym ==0.26.2

Score: 12.290505701505003