Skip to main content

A standard API for Multi-Objective Multi-Agent Decision making and a diverse set of reference environments.

Project description

tests pre-commit Code style: black

MOMAland is an open source Python library for developing and comparing multi-objective multi-agent reinforcement learning algorithms by providing a standard API to communicate between learning algorithms and environments, as well as a standard set of environments compliant with that API. Essentially, the environments follow the standard PettingZoo APIs, but return vectorized rewards as numpy arrays instead of scalar values.

The documentation website is at TODO, and we have a public discord server (which we also use to coordinate development work) that you can join here: https://discord.gg/bnJ6kubTg6.

Environments

MOMAland includes environments taken from the MOMARL literature, as well as multi-objective version of classical environments, such as SISL or Butterfly. The full list of environments is available at TODO.

Installation

To install MOMAland, use:

pip install momaland

This does not include dependencies for all families of environments (some can be problematic to install on certain systems). You can install these dependencies for one family like pip install "momaland" or use pip install "momaland[all]" to install all dependencies.

API

As for PettingZoo, the MOMAland API models environments as simple Python env classes. Creating environment instances and interacting with them is very simple - here's an example using the "mosurround_v0" environment:

import momaland
import numpy as np

# It follows the original PettingZoo APIs ...
env = momaland.envs.crazyrl.surround.surround_v0.parallel_env()

obs, info = env.reset()
# but vector_reward is a numpy array!
actions = {agent: env.action_spaces[agent].sample() for agent in env.agents}
next_obs, vector_rewards, terminated, truncated, info = env.step(actions)

# Optionally, you can scalarize the reward function with the LinearReward wrapper to fall back to the original PZ API
env = momaland.LinearReward(env, weight=np.array([0.8, 0.2, 0.2]))

For details on multi-objective multi-agent RL definitions, see Multi-Objective Multi-Agent Decision Making: A Utility-based Analysis and Survey.

You can also check more examples in this colab notebook! TODO

Environment Versioning

MOMAland keeps strict versioning for reproducibility reasons. All environments end in a suffix like "-v0". When changes are made to environments that might impact learning results, the number is increased by one to prevent potential confusion.

Development Roadmap

We have a roadmap for future development available here: TODO.

Project Maintainers

Project Managers: TODO

Maintenance for this project is also contributed by the broader Farama team: farama.org/team.

Citing

If you use this repository in your research, please cite:

@inproceedings{TODO}

Development

Setup pre-commit

Clone the repo and run pre-commit install to setup the pre-commit hooks.

New environment steps

  1. Create a new environment package in momaland/envs/
  2. Create a new environment class in momaland/envs/<env_name>/<env_name>.py, this class should extend MOParallelEnv or MOAECEnv. Override the PettingZoo methods (see their documentation). Additionally, you should define a member self.reward_spaces that is a dictionary of space specifying the shape of the reward vector of each agent, as well as a method reward_space(self, agent) -> Space that returns the reward space of a given agent.
  3. Define the factory functions to create your class: parallel_env returns a parallel version of the env, env returns an AEC version, and raw_env that is the pure class constructor (it is not used in practice). (!) use the conversions that are defined inside our repository, e.g. mo_parallel_to_aec instead of parallel_to_aec from PZ.
  4. (!) do not use OrderEnforcingWrapper, it prevents from accessing the reward_space of the env :-(;
  5. Add a versioned constructor of your env in the directory which exports the factory functions (see mobeach_v0.py for an example).
  6. Add your environment to the tests in utils/all_modules.py
  7. Run pytest to check that everything works

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

momaland-0.0.2.tar.gz (55.7 kB view details)

Uploaded Source

Built Distribution

momaland-0.0.2-py3-none-any.whl (69.4 kB view details)

Uploaded Python 3

File details

Details for the file momaland-0.0.2.tar.gz.

File metadata

  • Download URL: momaland-0.0.2.tar.gz
  • Upload date:
  • Size: 55.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for momaland-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d7f038cf693fc9f861b68c2a9b448d559d8df6b565cdfd18a8553f34d92f3c5a
MD5 d944f513013aac9ff0c1c116d812add8
BLAKE2b-256 e49a2940a6403810f351413739e9104c57ca80d040a30f839712766cc77d5da7

See more details on using hashes here.

File details

Details for the file momaland-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: momaland-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 69.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for momaland-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4deaee662be5f7b079878187b5421bbc400b2630c3f27d5b0c95c17b1d42dcf0
MD5 cf73bf11b6246b2c1d180d2e042e67a1
BLAKE2b-256 975b9b5a1a7b4c11d127fcb87e49dd628895c869684bf68ae05bdc557d3fe6d7

See more details on using hashes here.

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