Recent Releases of Ethical Smart Grid
Ethical Smart Grid - v2.0.0 PettingZoo multi-agent API
What's Changed
🆕 In short: starting from v2.0.0 onwards, EthicalSmartGrid now uses the PettingZoo API, which is a multi-agent equivalent to the previous Gymnasium API. This change will ensure most learning algorithms will function with our environment.
⚠️ Breaking changes
Switching to the PettingZoo API breaks the previous API in several ways. Please read the following items to adapt your code. (https://github.com/ethicsai/ethical-smart-grid/pull/10)
env.reset()now returns both observations and infos (instead of only observations).
New code should use:
```python obs, infos = env.reset()
Or, if infos are not used:
obs, _ = env.reset() ```
instead of:
python
obs = env.reset()
actionsmust be a dictionary mapping each agent name to its desired action when callingenv.step(actions).
New code should use the following structure:
python
actions = {
agent_name: (...) # Your action here
for agent_name in env.agents
}
env.step(actions)
instead of:
python
actions = [
(...) # Your action here
for agent_idx in range(env.n_agent)
]
env.step(actions)
obsis now a dictionary, mapping each agent name to its observations (both global and local).
For example, assuming agents ['Household1', 'Household2']:
```python obs, _ = env.reset() print(obs)
{ 'Household1': Observation(personalstorage=0.052, comfort=0.021, payoff=0.5, hour=0.0, availableenergy=0.25, equity=0.84, energyloss=0.0, autonomy=1.0, exclusion=0.23, wellbeing=0.021, overconsumption=0.0), 'Household2': Observation(personalstorage=0.052, comfort=0.021, payoff=0.5, hour=0.0, availableenergy=0.25, equity=0.84, energyloss=0.0, autonomy=1.0, exclusion=0.23, wellbeing=0.021, overconsumption=0.0) } ```
If the learning algorithm requires accessing the global and local observations differently: global observations can still be obtained with obs[agent_name].get_global_observation(); similarly, local observations with obs[agent_name].get_local_observation().
The number of agents is accessed through
env.num_agentsrather thanenv.n_agent. This follows the PettingZoo API.env.agentsallows iterating over the agents' names. Agents themselves can be obtained withenv.get_agent(agent_name). This also follows the PettingZoo API, although poorly named.
New code should use:
python
for agent_name in env.agents:
agent = env.get_agent(agent_name)
print(agent.state)
instead of:
python
for agent in env.agents:
print(agent.state)
infosis a dictionary mapping each agent name to a dictionary containing additional information, such as the original rewardreward(before, e.g., scalarization).
New code should use:
python
_, _, _, _, infos = env.step(actions)
for agent_name in env.agents:
print(infos[agent_name]['reward'])
instead of:
python
_, _, _, _, infos = env.step(actions)
for agent in env.agents:
print(infos['reward'][agent.name]
world.agentsis now a view over the values of theworld.agents_by_namedictionary, instead of a list. Most code should not useworlddirectly anyway, and instead access agents through the env itself. Iterating over agents will still work as previously, but adict_valuesobject cannot be indexed (world.agents[0]does not work any more, butfor agent in world.agentsstill does).
Various improvements
- Improve the
find_profile_datafunction for Python 3.9+. It will no longer raise warnings on these versions. (https://github.com/ethicsai/ethical-smart-grid/pull/9) - Improve some parts of the documentation.
Full Changelog: https://github.com/ethicsai/ethical-smart-grid/compare/v1.2.0...v2.0.0
Scientific Software - Peer-reviewed
- Python
Published by rchaput almost 2 years ago
Ethical Smart Grid - v1.2.0 Argumentation-based reward functions
What's Changed
🆕 New features
- Add argumentation-based reward functions with AJAR library (https://github.com/ethicsai/ethical-smart-grid/pull/7)
🐛 Bugfixes
- Fixed setting the random seed to ensure reproducibility and added tests for random seeds (https://github.com/ethicsai/ethical-smart-grid/pull/4)
Various improvements
- Build multiple versions of the documentation (https://github.com/ethicsai/ethical-smart-grid/pull/6)
- Add support and testing for Python 3.12 (https://github.com/ethicsai/ethical-smart-grid/pull/8)
Full Changelog: https://github.com/ethicsai/ethical-smart-grid/compare/v1.1.0...v1.2.0
Scientific Software - Peer-reviewed
- Python
Published by rchaput over 2 years ago
Ethical Smart Grid - Argumentation-based reward functions
What's Changed
🆕 New features
- Add argumentation-based reward functions with AJAR library (https://github.com/ethicsai/ethical-smart-grid/pull/7)
🐛 Bugfixes
- Fixed setting the random seed to ensure reproducibility and added tests for random seeds (https://github.com/ethicsai/ethical-smart-grid/pull/4)
Various improvements
- Build multiple versions of the documentation (https://github.com/ethicsai/ethical-smart-grid/pull/6)
- Add support and testing for Python 3.12 (https://github.com/ethicsai/ethical-smart-grid/pull/8)
Full Changelog: https://github.com/ethicsai/ethical-smart-grid/compare/v1.1.0...v1.2.0
Scientific Software - Peer-reviewed
- Python
Published by rchaput over 2 years ago
Ethical Smart Grid - Ethical Smart Grid: a Gym environment for learning ethical behaviours
Release for the JOSS publication.
This concerns the reviewed software (by the JOSS reviewers), and includes the source code for the JOSS paper.
This release will be archived on Zenodo.
Scientific Software - Peer-reviewed
- Python
Published by rchaput almost 3 years ago
Ethical Smart Grid - Improved docs and added scenarii
List of new features/elements:
Added several scenarii that can be easily instantiated, similar to the
make_basic_smartgridfunction.Added the
algorithmsmodule to the built package (published to pip).Improved documentation:
- Added a notebook example to show how to visualize rewards, and compare algorithms.
- Added a short description of the pre-existing components in the "API" page, to know what is available and access their documentation faster.
- Added links to observations and rewards that support the moral values, in the "Use case" page.
Added contributing guidelines.
List of fixes:
Fixed the Quick usage instructions, which would not work in a "standard" Python shell (but correctly in an IPython shell).
Fixed broken links in the Readme.
Scientific Software - Peer-reviewed
- Python
Published by rchaput almost 3 years ago
Ethical Smart Grid - v1.0.0: First stable version
Scientific Software - Peer-reviewed
- Python
Published by rchaput about 3 years ago