Ethical Smart Grid
Ethical Smart Grid: a Gym environment for learning ethical behaviours - Published in JOSS (2023)
Science Score: 100.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 8 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
✓Committers with academic emails
1 of 3 committers (33.3%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Repository
Reinforcement learning environment for learning ethical behaviours in a SmartGrid use-case.
Basic Info
- Host: GitHub
- Owner: ethicsai
- License: other
- Language: Python
- Default Branch: master
- Homepage: https://ethicsai.github.io/ethical-smart-grid/
- Size: 1.13 MB
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 6
Topics
Metadata Files
Readme.md
Ethical Smart Grid Simulator
Authors: Clément Scheirlinck, Rémy Chaput
Description
This is a third-party Gym environment, focusing on learning ethically-aligned behaviours in a Smart Grid use-case.
A Smart Grid contains several prosumer (prosumer-consumer) agents that interact in a shared environment by consuming and exchanging energy. These agents have an energy need, at each time step, that they must satisfy by consuming energy. However, they should respect a set of moral values as they do so, i.e., exhibiting an ethically-aligned behaviour.
Moral values are encoded in the reward functions, which determine the "correctness" of an agent's action, with respect to these moral values. Agents receive rewards as feedback that guide them towards a better behaviour.
Installation
You may install Ethical Smart Grid through:
- PyPi, using
pip install ethical-smart-grid(latest stable version); - pip and GitHub, using
pip install git+https://github.com/ethicsai/ethical-smart-grid.git(you may specify the version at the end of the URL); - GitHub, using
git clone https://github.com/ethicsai/ethical-smart-grid(development version, not stable).
If you also wish to use argumentation-based reward functions, please install
AJAR through pip install git+https://github.com/ethicsai/ajar.git@v1.0.0,
or pip install -r requirements.txt if you cloned this repository.
Quick usage
After installing, open a Python shell (3.7+), and execute the following instructions:
```python from smartgrid import makebasicsmartgrid from algorithms.qsom import QSOM
env = makebasicsmartgrid(max_step=10) model = QSOM(env)
done = False obs = env.reset() while not done: actions = model.forward(obs) obs, rewards, terminated, truncated, _ = env.step(actions) print(rewards) model.backward(obs, rewards) done = all(terminated) or all(truncated)
env.close() ```
This will initialize a SmartGrid environment, learning agents that use the QSOM
algorithm, and run the simulation for 10 steps (configurable through the max_step=10
argument).
To go further, please refer to the documentation; the Custom scenario and Adding a new model pages can be particularly interesting to learn, respectively, how to configure the environment, and how to implement a new learning algorithm. Finally, extending the environment allows creating new components (agents' profiles, reward functions, ...) to further customize the environment.
Versioning
This project follows the Semver: all versions respect
the <major>.<minor>.<patch> format. The patch number is increased when a
bugfix is released. The minor number is increased when new features are added
that do not break the code public API, i.e., it is compatible with the
previous minor version. Finally, the major number is increased when a breaking
change is introduced; an important distinction is that such a change may not
be "important" in terms of lines of code, or number of features modified.
Simply changing a function's return type can be considered a breaking change
in the public API, and thus worthy of a "major" update.
Building and testing locally
This GitHub repository includes actions that automatically test the package and build the documentation on each commit, and publish the package to PyPi on each release.
Instructions to perform these steps locally are given here, for potential new contributors or forks:
- Running the tests
Tests are defined using unittest and run through pytest; please install it
first: pip install pytest.
We must add the current folder to the PYTHONPATH environment variable to
let pytest import the smartgrid module when executing the tests:
export PYTHONPATH=$PWD (from the root of this repository). Then, launch all
tests with pytest tests.
- Building the documentation
The documentation is built with Sphinx and requires additional requirements;
to install them, use pip install -r docs/requirements.txt. Then, to build the
documentation, use cd docs && make html. The built documentation will be in
the docs/build/html folder. It can be cleaned using make clean while in the
docs folder. Additionally, the source/modules folder is automatically
generated from the Python docstrings in the source code; it can be safely
deleted (e.g., with rm -r source/modules) to force re-building all
documentation files.
- Building and publishing releases
This project uses hatch to manage the building and publishing process; please
install it with pip install hatch first.
To build the package, use hatch build at the root of this repository. This
will create the source distribution (sdist) at
dist/ethica_smart_grid_simulator-<version>.tar.gz, and the built distribution
(wheel) at dist/ethical_smart_grid_simulator-<version>-py3-none-any.whl.
To publish these files to PyPi, use hatch publish.
Community
The community guidelines are available in the CONTRIBUTING.md file; you can find a (short) summary below.
Getting support
If you have a question (something that is not clear, how to get a specific result, ...), do not hesitate to create a new Discussion under the Q&A category.
Please do not use the issue tracker for support, to avoid cluttering it.
Report a bug
If you found a bug (an error raised, or something not working as expected), you can report it on the Issue Tracker.
Please try to be as precise as possible.
Contributing
We very much welcome and appreciate contributions!
For fixing bugs, or improving the documentation, you can create a Pull Request.
New features are also welcome, but larger features should be discussed first in a new Discussion under the Ideas category.
All ideas, suggestions, and requests are also welcome for discussion.
License
The source code is licensed under the MIT License. Some included data may be protected by other licenses, please refer to the LICENSE.md file for details.
Citation
If you use this package in your research, please cite the corresponding paper:
Scheirlinck, C., Chaput, R., & Hassas, S. (2023). Ethical Smart Grid: a Gym environment for learning ethical behaviours. Journal of Open Source Software, 8(88), 5410. https://doi.org/10.21105/joss.05410
bibtex
@article{Scheirlinck_Ethical_Smart_Grid_2023,
author = {Scheirlinck, Clément and Chaput, Rémy and Hassas, Salima},
doi = {10.21105/joss.05410},
journal = {Journal of Open Source Software},
month = aug,
number = {88},
pages = {5410},
title = {{Ethical Smart Grid: a Gym environment for learning ethical behaviours}},
url = {https://joss.theoj.org/papers/10.21105/joss.05410},
volume = {8},
year = {2023}
}
Owner
- Name: ETHICS.ai
- Login: ethicsai
- Kind: organization
- Location: France
- Repositories: 1
- Profile: https://github.com/ethicsai
JOSS Publication
Ethical Smart Grid: a Gym environment for learning ethical behaviours
Authors
Univ Lyon, UCBL, CNRS, INSA Lyon, Centrale Lyon, Univ Lyon 2, LIRIS, UMR5205, F-69622 Villeurbanne, France
Univ Lyon, UCBL, CNRS, INSA Lyon, Centrale Lyon, Univ Lyon 2, LIRIS, UMR5205, F-69622 Villeurbanne, France
Univ Lyon, UCBL, CNRS, INSA Lyon, Centrale Lyon, Univ Lyon 2, LIRIS, UMR5205, F-69622 Villeurbanne, France
Tags
Reinforcement Learning Machine Ethics Smart Grid Multi-Agent System OpenAI GymCitation (CITATION.cff)
cff-version: "1.2.0"
authors:
- family-names: Scheirlinck
given-names: Clément
- family-names: Chaput
given-names: Rémy
orcid: "https://orcid.org/0000-0002-2233-7566"
- family-names: Hassas
given-names: Salima
contact:
- family-names: Chaput
given-names: Rémy
orcid: "https://orcid.org/0000-0002-2233-7566"
doi: 10.5281/zenodo.8239411
message: If you use this software, please cite our article in the
Journal of Open Source Software.
preferred-citation:
authors:
- family-names: Scheirlinck
given-names: Clément
- family-names: Chaput
given-names: Rémy
orcid: "https://orcid.org/0000-0002-2233-7566"
- family-names: Hassas
given-names: Salima
date-published: 2023-08-25
doi: 10.21105/joss.05410
issn: 2475-9066
issue: 88
journal: Journal of Open Source Software
publisher:
name: Open Journals
start: 5410
title: "Ethical Smart Grid: a Gym environment for learning ethical
behaviours"
type: article
url: "https://joss.theoj.org/papers/10.21105/joss.05410"
volume: 8
title: "Ethical Smart Grid: a Gym environment for learning ethical
behaviours"
CodeMeta (codemeta.json)
{
"@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld",
"@type": "Code",
"author": [
{
"@id": "0000-0002-2233-7566",
"@type": "Person",
"email": "rchaput.pro@gmail.com",
"name": "Rémy Chaput",
"affiliation": "Univ Lyon, UCBL, CNRS, INSA Lyon, Centrale Lyon, Univ Lyon 2, LIRIS, UMR5205, F-69622 Villeurbanne, France"
},
{
"@id": "",
"@type": "Person",
"email": "",
"name": "Clément Scheirlinck",
"affiliation": "Univ Lyon, UCBL, CNRS, INSA Lyon, Centrale Lyon, Univ Lyon 2, LIRIS, UMR5205, F-69622 Villeurbanne, France"
}
],
"identifier": "",
"codeRepository": "https://github.com/ethicsai/ethical-smart-grid",
"datePublished": "2023-04-04",
"dateModified": "2023-04-04",
"dateCreated": "2023-04-04",
"description": "Reinforcement learning environment for learning ethical behaviours in a SmartGrid use-case. ",
"keywords": "python, reinforcement learning, artificial intelligence, smart grid, gymnasium, machine ethics",
"license": "MIT",
"title": "ethical-smart-grid",
"version": "v1.0.0"
}
GitHub Events
Total
- Watch event: 3
Last Year
- Watch event: 3
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| rchaput | r****o@g****m | 144 |
| Scheirlinck | s****t@g****m | 33 |
| p1923899 | c****k@e****r | 11 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 3
- Total pull requests: 7
- Average time to close issues: 4 months
- Average time to close pull requests: 19 days
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 1.0
- Average comments per pull request: 0.0
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: 10 minutes
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- louiseadennis (3)
Pull Request Authors
- rchaput (10)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 14 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
pypi.org: ethical-smart-grid
A RL environment for learning ethically-aligned behaviours in a Smart Grid simulator.
- Documentation: https://ethicsai.github.io/ethical-smart-grid/
- License: MIT License Copyright (c) 2022 Clément Scheirlinck and Rémy Chaput Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # Datasets ## OpenEI The data in the `data/openei` folder is extracted from an [energy dataset](https://data.openei.org/submissions/153) that was made available by [OpenEI](https://openei.org/wiki/Information) through a Creative Commons Attribution 4.0 license ([CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)).
-
Latest release: 2.0.0
published over 1 year ago