Skip to main content

Partially Observable Grid Environment for Multi-Agent RL

Project description

Pogema logo

Partially-Observable Grid Environment for Multiple Agents

CodeFactor Downloads CI CodeQL

Partially observable multi-agent pathfinding (PO-MAPF) is a challenging problem which fundamentally differs from regular MAPF, in which a central controller is assumed to construct a joint plan for all agents before they start execution. PO-MAPF is intrisically decentralized and decision making (e.g. planning) here is interleaved with the execution. At each time step an agent receives a (local) observation of the environment and decides which action to take. The ultimate goal for the agents is to reach their goals while avoiding collisions with each other and the static obstacles.

POGEMA stands for Partially-Observable Grid Environment for Multiple Agents. This is a grid-based environment that was specifically designed to be flexible, tunable and scalable. It can be tailored to a variety of PO-MAPF settings. Currently the (somewhat) standard setting is supported: agents can move between the cardinally-adjacent cells of the grid, each action (move or wait) takes one time step. No information sharing between the agents is happening.

POGEMA can generate random maps and start/goals locations for the agents. It also can take custom maps as the input.

Installation

Just install from PyPI:

pip install pogema

Using Example

import gym
import pogema

env = gym.make("Pogema-8x8-hard-v0")

obs = env.reset()

done = [False, ...]

while not all(done):
    # Use random policy to make actions
    obs, reward, done, info = env.step([env.action_space.sample() for _ in range(len(obs))])

Open In Colab

Environments

Environment agents density num agents horizon
Pogema-8x8-easy-v0 2.2% 1 64
Pogema-8x8-normal-v0 4.5% 2 64
Pogema-8x8-hard-v0 8.9% 4 64
Pogema-8x8-extra-hard-v0 17.8% 8 64
Pogema-16x16-easy-v0 2.2% 4 128
Pogema-16x16-normal-v0 4.5% 8 128
Pogema-16x16-hard-v0 8.9% 16 128
Pogema-16x16-extra-hard-v0 17.8% 32 128
Pogema-32x32-easy-v0 2.2% 16 256
Pogema-32x32-normal-v0 4.5% 32 256
Pogema-32x32-hard-v0 8.9% 64 256
Pogema-32x32-extra-hard-v0 17.8% 128 256
Pogema-64x64-easy-v0 2.2% 64 512
Pogema-64x64-normal-v0 4.5% 128 512
Pogema-64x64-hard-v0 8.9% 256 512
Pogema-64x64-extra-hard-v0 17.8% 512 512

Interfaces

Pogema provides integrations with a range of MARL frameworks: PettingZoo, PyMARL and SampleFactory.

PettingZoo

import gym
import pogema

# Create Pogema environment with PettingZoo interface
env = gym.make("Pogema-8x8-hard-v0", integration="PettingZoo")

PyMARL

import gym
import pogema

env = gym.make("Pogema-8x8-hard-v0", integration="PyMARL")

SampleFactory

import gym
import pogema

env = gym.make("Pogema-8x8-hard-v0", integration="SampleFactory")

Classic Gym

import gym
import pogema

# This interface is suitable only for 
# single-agent partially observable pathfinding tasks
env = gym.make("Pogema-8x8-easy-v0", integration="SampleFactory")

Customization

Random maps

import gym
from pogema import GridConfig

# Define random configuration
grid_config = GridConfig(num_agents=4,  # number of agents
                         size=8, # size of the grid
                         density=0.4,  # obstacle density
                         seed=1,  # set to None for random 
                                  # obstacles, agents and targets 
                                  # positions at each reset
                         max_episode_steps=128,  # horizon
                         obs_radius=3,  # defines field of view
                         )

env = gym.make('Pogema-v0', grid_config=grid_config)
env.reset()
env.render()

Custom maps

import gym
from pogema import GridConfig

grid = """
.....#.....
.....#.....
...........
.....#.....
.....#.....
#.####.....
.....###.##
.....#.....
.....#.....
...........
.....#.....
"""

# Define new configuration with 8 randomly placed agents
grid_config = GridConfig(map=grid, num_agents=8)

# Create custom Pogema environment
env = gym.make('Pogema-v0', grid_config=grid_config)

Citation

If you use this repository in your research or wish to cite it, please make a reference to our paper:

@misc{https://doi.org/10.48550/arxiv.2206.10944,
  doi = {10.48550/ARXIV.2206.10944},  
  url = {https://arxiv.org/abs/2206.10944},
  author = {Skrynnik, Alexey and Andreychuk, Anton and Yakovlev, Konstantin and Panov, Aleksandr I.},
  keywords = {Machine Learning (cs.LG), Artificial Intelligence (cs.AI), Multiagent Systems (cs.MA), FOS: Computer and information sciences, FOS: Computer and information sciences},
  title = {POGEMA: Partially Observable Grid Environment for Multiple Agents},
  publisher = {arXiv},
  year = {2022},
  copyright = {arXiv.org perpetual, non-exclusive license}
}

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pogema-1.0.3.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

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

pogema-1.0.3-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file pogema-1.0.3.tar.gz.

File metadata

  • Download URL: pogema-1.0.3.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9

File hashes

Hashes for pogema-1.0.3.tar.gz
Algorithm Hash digest
SHA256 a4b4a15babe9884425b16669989dab070c8c831785dd2c3d80506416207388e4
MD5 0ccfbe04b0e0ce2df71ad8a8eeed7f18
BLAKE2b-256 f12511192fc64734257206a2bf5a349c86bcefa20cf3f4897452fba6c194fcb6

See more details on using hashes here.

File details

Details for the file pogema-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: pogema-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9

File hashes

Hashes for pogema-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a217f9e59467eff2acd3765a4ff1af0e71e0e389d85240361ba87b9ebee6e996
MD5 0fbe98133578649e2b3259c9c32a9d0e
BLAKE2b-256 43d229159c8bba3bf7af585060ff8b38a328d078aedc8bef8fee520c3b63cde7

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