Skip to main content

Laser Learning Environment (LLE) for Multi-Agent Reinforcement Learning

Project description

Laser Learning Environment (LLE)

LLE is a fast Multi-Agent Reinforcement Learning environment written in Rust which has proven to be a difficult exploration benchmark so far. The agents start in the start tiles, must collect the gems and finish the game by reaching the exit tiles. There are five actions: North, South, East, West and Stay.

When an agent enters a laser of its own colour, it blocks it. Otherwise, it dies and the game ends.

LLE

Quick start

Installation

You can install the Laser Learning Environment with pip or poetry.

pip install laser-learning-environment # Stable release with pip
pip install git+https://github.com/yamoling/lle # latest push on master

Usage

LLE can be used at two levels of abstraction: as an RLEnv for cooperative multi-agent reinforcement learning or as a World for many other purposes.

For cooperative multi-agent reinforcement learning

The LLE class inherits from the RLEnv class in the rlenv framework. Here is an example with the following map: LLE

from lle import LLE

env = LLE.from_str("S0 G X").single_objective()
done = truncated = False
obs = env.reset()
while not (done or truncated):
    # env.render() # Uncomment to render
    actions = env.action_space.sample(env.available_actions())
    obs, reward, done, truncated, info = env.step(actions)

For other purposes or fine grained control

The World class provides fine grained control on the environment by exposing the state of the world and the events that happen when the agents move.

from lle import World, Action, EventType

world = World("S0 G X")  # Linear world with start S0, gem G and exit X
world.reset()
available_actions = world.available_actions()[0]  # [Action.STAY, Action.EAST]
events = world.step([Action.EAST])
assert events[0].event_type == EventType.GEM_COLLECTED
events = world.step([Action.EAST])
assert events[0].event_type == EventType.AGENT_EXIT

You can also access and force the state of the world

state = world.get_state()
...
events = world.set_state(state)

You can query the world on the tiles with world.start_pos, world.exit_pos, world.gem_pos, ...

Citing our work

The environment has been presented at EWRL 2023 and at BNAIC 2023 where it received the best paper award.

@inproceedings{molinghen2023lle,
  title={Laser Learning Environment: A new environment for coordination-critical multi-agent tasks},
  author={Molinghen, Yannick and Avalos, Raphaël and Van Achter, Mark and Nowé, Ann and Lenaerts, Tom},
  year={2023},
  series={BeNeLux Artificial Intelligence Conference},
  booktitle={BNAIC 2023}
}

Development

If you want to modify the environment, you can clone the repo, install the python dependencies then compile it with maturin. The below example assumes that you are using uv as package manager but it should work with conda, poetry or just pip as well.

git clone https://github.com/yamoling/lle
uv venv         # create a virtual environment
source .venv/bin/activate
uv sync         # install python dependencies
maturin dev     # build and install lle in the venv

You can also re-generate the python bindings in the folder python/lle with

cargo run --bin stub-gen

Tests

This project does not respect Rust unit tests convention and takes inspiration from this structure. Unit tests are in the src/unit_tests folder and are explicitely linked to in each file with the #path directive. Integration tests are written on the python side.

Run unit tests with

cargo test

Run integration tests with

maturin develop
pytest

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

laser_learning_environment-2.0.0.tar.gz (95.6 kB view details)

Uploaded Source

Built Distributions

laser_learning_environment-2.0.0-cp312-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12 Windows x86-64

laser_learning_environment-2.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

laser_learning_environment-2.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

laser_learning_environment-2.0.0-cp312-cp312-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

laser_learning_environment-2.0.0-cp312-cp312-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12 macOS 10.12+ x86-64

laser_learning_environment-2.0.0-cp311-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.11 Windows x86-64

laser_learning_environment-2.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

laser_learning_environment-2.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

laser_learning_environment-2.0.0-cp311-cp311-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

laser_learning_environment-2.0.0-cp311-cp311-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11 macOS 10.12+ x86-64

File details

Details for the file laser_learning_environment-2.0.0.tar.gz.

File metadata

File hashes

Hashes for laser_learning_environment-2.0.0.tar.gz
Algorithm Hash digest
SHA256 0ced5d7a04df0fd2ac7227de7b3369a7590e7b8b47883534c1018cf7014c18b0
MD5 053692e5a66ebcf5ad2d7171795c03d3
BLAKE2b-256 e09492e73a737aa11858efa3d031f1a740bcfc82046d728018b70401c8b39288

See more details on using hashes here.

File details

Details for the file laser_learning_environment-2.0.0-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for laser_learning_environment-2.0.0-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 280a8424cc6882348c474c03daf3c7a98e0f295c2c4a7d4f22f4917f547a12dd
MD5 52f57c9356a5575116f358ffbf1ad46c
BLAKE2b-256 609a6e50a7af7cd41b74177c976945133a3c6010c3397f64fdcbb7769a9caef3

See more details on using hashes here.

File details

Details for the file laser_learning_environment-2.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for laser_learning_environment-2.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c2d89b43b856fd8b2866941730d9b6c292fe799d0a9341833cb55376143d075
MD5 b33850aaa58d6f2654853b83f215198d
BLAKE2b-256 fbc608a4ca0b65b8a435e262a7515ab0b25c35098f27ab2f506f2423e2573494

See more details on using hashes here.

File details

Details for the file laser_learning_environment-2.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for laser_learning_environment-2.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 feea91a52bc645d7131c97a85d96073bfb52efe1f16617b31fdd2b8ef1828ba2
MD5 68895e11403061cd643eacdc005d04a4
BLAKE2b-256 9b02198d2fdb6d9b4cc6a85b71ab183a9d9704a8d828647f016203727c7f4e51

See more details on using hashes here.

File details

Details for the file laser_learning_environment-2.0.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for laser_learning_environment-2.0.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b70447d2184742b5122d998e0ab05694bebd4213aa0494f3b6373ec3f5308913
MD5 32ef2ae2a5e171ea3a2871ced10ac87b
BLAKE2b-256 f84af20d3d22d2b6db46930d5576cc23be286bca0b5991182aa3fe64b8c2de69

See more details on using hashes here.

File details

Details for the file laser_learning_environment-2.0.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for laser_learning_environment-2.0.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2361df85bd6b00936733fdb808c02430609bbcd860fc56fb1b1590a1d114f330
MD5 6f5989d52bf8021f40d90b6f978efbf1
BLAKE2b-256 22b6cc6a76386f05e0a5de9101748ef2d51ec2d4f72807673f1f617d1ee0b906

See more details on using hashes here.

File details

Details for the file laser_learning_environment-2.0.0-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for laser_learning_environment-2.0.0-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 d6fbd06c0dbb43f74e60d7664d2a4ae53ee76b7cb306877946081e860ee688f8
MD5 571f3056df4e5c1d6c98190dc0c9e680
BLAKE2b-256 00a07c641c4b8712433577dda28ea8c07f391538cb86457279c4010918598242

See more details on using hashes here.

File details

Details for the file laser_learning_environment-2.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for laser_learning_environment-2.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0497a0adb171fd1f30ebd2fbc3349bf45c5792ac65422e26782dbfe3e40f69f0
MD5 38ae9727a0ac1515559952c4ac8076d1
BLAKE2b-256 612a8a1abef0bab1857b68ca598cc7642b435900c5bc76b02711ddbd4d727209

See more details on using hashes here.

File details

Details for the file laser_learning_environment-2.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for laser_learning_environment-2.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 20acaf8f2f720d07a789fd5a8cb1481c738d1183a1c541e279d2cc291ca3094e
MD5 6fcc2c906e4884e4d2d7476a215ec138
BLAKE2b-256 c90f9fd1e19a0057cccd3ecb05c313312938ddb44ba61ad734cd0f57d3bac70a

See more details on using hashes here.

File details

Details for the file laser_learning_environment-2.0.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for laser_learning_environment-2.0.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c09492e310f3660bae07cf89e4ae9c069bc61af33003d54e2e75a0f91982666a
MD5 b39fd845a467dc00d16ad0eef564ee74
BLAKE2b-256 673ce703a2c3af30ea97e8110afaf6a4962149b1e2acd514b59c04b8340a2468

See more details on using hashes here.

File details

Details for the file laser_learning_environment-2.0.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for laser_learning_environment-2.0.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7271c933c3f5c61bd244da6e39fcf9dd68b34c581313835d04d6568290862aac
MD5 f7707ee5a4d03ac9d8e5df417b8e4ffc
BLAKE2b-256 96b28b4689301b20904ae8a00d8b7a651f1a6edc13aa0157e1f6b102f5a6adaa

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