Package: laser-learning-environment
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.Quick startInstallationYou can install the Laser Learning Environment with pip or poetry.pipinstalllaser-learning-environment# Stable release with pippoetryaddlaser-learning-environment# Stable release with poetrypipinstallgit+https://github.com/yamoling/lle# latest push on masterUsageLLE can be used at two levels of abstraction: as anRLEnvfor cooperative multi-agent reinforcement learning or as aWorldfor many other purposes.For cooperative multi-agent reinforcement learningTheLLEclass inherits from theRLEnvclass in therlenvframework. Here is an example with the following map:fromlleimportLLEimportnumpyasnpimportrandomenv=LLE.from_str("S0 G X")# Create an environment from a string# env = LLE.from_file("text_file.txt") # or from a text file# env = LLE.level(6)         # Or use a pre-defined level (1 to 6)done=truncated=Falseobs=env.reset()whilenotdoneortruncated:# env.render() # Uncomment to renderavailable_indices=[np.nonzero(available)[0]foravailableinobs.available_actions]actions=[random.choice(indices)forindicesinavailable_indices]obs,reward,done,truncated,info=env.step(actions)For other purposes or fine grained controlTheWorldclass provides fine grained control on the environment by exposing the state of the world and the events that happen when the agents move.fromlleimportWorld,Action,EventTypeworld=World("S0 G X")# Linear world with start S0, gem G and exit Xworld.reset()available_actions=world.available_actions()[0]# [Action.STAY, Action.EAST]events=world.step([Action.EAST])assertevents[0].event_type==EventType.GEM_COLLECTEDevents=world.step([Action.EAST])assertevents[0].event_type==EventType.AGENT_EXITYou can also access and force the state of the worldstate=world.get_state()...world.set_state(state)You can query the world on the tiles withworld.start_pos,world.exit_pos,world.gem_pos, ...Citing our workThe environment has been presented atEWRL 2023and atBNAIC 2023where 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}
}DevelopmentIf you want to modify the environment, you can clone the repo, install the python dependencies then compile it withmaturin.git clone https://github.com/yamoling/lle
poetry shell # start the virtual environment
poetry install
maturin develop # install lle locallyBuildingThis project has been set up usingPoetry. To build the project, run the following commands:poetryshell
poetryinstall
maturindevelop# For developmentmaturinbuild# For distributionTestsThis projectdoes notrespect Rust unit tests convention and takes inspiration fromthis structure. Unit tests are in thesrc/unit_testsfolder and are explicitely linked to in each file with the#pathdirective.
Integration tests are written on the python side.Run unit tests withcargotestRun integration tests withmaturindevelop
pytest