Skip to main content

A standard API for MORL and a diverse set of reference environments.

Project description

Python PyPI tests pre-commit Code style: black

MO-Gymnasium is an open source Python library for developing and comparing multi-objective 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 Gymnasium API, but return vectorized rewards as numpy arrays.

The documentation website is at mo-gymnasium.farama.org, 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

MO-Gymnasium includes environments taken from the MORL literature, as well as multi-objective version of classical environments, such as MuJoco. The full list of environments is available here.

Installation

To install MO-Gymnasium, use:

pip install mo-gymnasium

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 "mo-gymnasium[mujoco]" or use pip install "mo-gymnasium[all]" to install all dependencies.

API

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

import gymnasium as gym
import mo_gymnasium as mo_gym
import numpy as np

# It follows the original Gymnasium API ...
env = mo_gym.make('minecart-v0')

obs, info = env.reset()
# but vector_reward is a numpy array!
next_obs, vector_reward, terminated, truncated, info = env.step(your_agent.act(obs))

# Optionally, you can scalarize the reward function with the LinearReward wrapper
env = mo_gym.wrappers.LinearReward(env, weight=np.array([0.8, 0.2, 0.2]))

For details on multi-objective MDP's (MOMDP's) and other MORL definitions, see A practical guide to multi-objective reinforcement learning and planning.

You can also check more examples in this colab notebook! MO-Gym Demo in Colab

Notable related libraries

MORL-Baselines is a repository containing various implementations of MORL algorithms by the same authors as MO-Gymnasium. It relies on the MO-Gymnasium API and shows various examples of the usage of wrappers and environments.

Environment Versioning

MO-Gymnasium 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: https://github.com/Farama-Foundation/MO-Gymnasium/issues/66.

Project Maintainers

Project Managers: Lucas Alegre and Florian Felten.

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{felten_toolkit_2023,
	author = {Felten, Florian and Alegre, Lucas N. and Now{\'e}, Ann and Bazzan, Ana L. C. and Talbi, El Ghazali and Danoy, Gr{\'e}goire and Silva, Bruno C. {\relax da}},
	title = {A Toolkit for Reliable Benchmarking and Research in Multi-Objective Reinforcement Learning},
	booktitle = {Proceedings of the 37th Conference on Neural Information Processing Systems ({NeurIPS} 2023)},
	year = {2023}
}

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

mo_gymnasium-1.3.2.tar.gz (468.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mo_gymnasium-1.3.2-py3-none-any.whl (481.8 kB view details)

Uploaded Python 3

File details

Details for the file mo_gymnasium-1.3.2.tar.gz.

File metadata

  • Download URL: mo_gymnasium-1.3.2.tar.gz
  • Upload date:
  • Size: 468.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mo_gymnasium-1.3.2.tar.gz
Algorithm Hash digest
SHA256 cd19c58f030fa32d3ca7a61210bc099921867c024b3e6ea12f97908ec11c8f7f
MD5 8fdfaf6794cf2fd63ba572856e29d9cf
BLAKE2b-256 a32b9b38d06a0827aa393710d07016cc4b9dd5b23607dbe80163f7e99c4c6649

See more details on using hashes here.

File details

Details for the file mo_gymnasium-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: mo_gymnasium-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 481.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mo_gymnasium-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8728698efc1257b5893f69e1a7b41cca6b1f5c3e0dd3c5b6f4dce2337fd36765
MD5 87f42c1e2275810979728a93a31c905e
BLAKE2b-256 a298f187e8b5e96b241d58afb550e8425eafda867870cef568e5046f03ee6d76

See more details on using hashes here.

Supported by

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