Skip to content

Commit

Permalink
Merge pull request #1 from julia-bel/dev
Browse files Browse the repository at this point in the history
Partially implemented pipelines and tests
  • Loading branch information
julia-bel authored May 26, 2024
2 parents fea1231 + 68308e9 commit 744cdda
Show file tree
Hide file tree
Showing 18 changed files with 1,517 additions and 0 deletions.
161 changes: 161 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
*.pt
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "pogema"]
path = pogema
url = https://github.com/AIRI-Institute/pogema.git
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Multi-Agent Pathfinding in POGEMA with G2RL
Implementation of the [G2RL](https://ieeexplore.ieee.org/abstract/document/9205217) [1] approach in the [POGEMA](https://github.com/AIRI-Institute/pogema) environment.

## Basic Concepts
**Problem**: MAPF
**Environment**: 2D grid with static obstacles and dynamic agents
**Agent actions**: wait, up, down, left, right
**Local observations**: free cells, static obstacles, dynamic agents
**Global guidance**: the shortest traversable path considering all static obstacles
**Objective**: minimize the overall number of steps and avoid conflicts

## Code Implementation
Partially based on the [repo](https://github.com/Tushar-ml/G2RL-Path-Planning.git).
Installation:

```
pip install -r requirements.txt
pip install .
```

## Train & Test
[Notebook](notebooks/train&test.ipynb) with simple examples of training and testing implementations.

## Demonstration
![Demo](renders/test.svg)

## References
[1] B. Wang, Z. Liu, Q. Li, and A. Prorok, "Mobile robot path planning in
dynamic environments through globally guided reinforcement learning,"
IEEE Robot. Autom. Lett., vol. 5, no. 4, pp. 6932–6939, Oct. 2020.
19 changes: 19 additions & 0 deletions data/default_statistics.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
map,num_agents,max_steps,density,size,start,final,done,detour_percentage,moving_cost
random,3,60,,48,"[[25, 22], [17, 13], [22, 39]]","[[28, 26], [32, 16], [46, 32]]",2,0.0,1.1200716845878138
random,3,120,,48,"[[25, 22], [17, 13], [22, 39]]","[[28, 26], [32, 16], [46, 32]]",2,0.0,1.1200716845878138
random,3,180,,48,"[[25, 22], [17, 13], [22, 39]]","[[28, 26], [32, 16], [46, 32]]",2,0.0,1.1200716845878138
random,6,60,,48,"[[25, 22], [17, 13], [22, 39], [32, 36], [38, 29], [3, 19]]","[[28, 26], [32, 16], [46, 32], [28, 19], [33, 30], [46, 21]]",5,0.0,1.1419969278033792
random,6,120,,48,"[[25, 22], [17, 13], [22, 39], [32, 36], [38, 29], [3, 19]]","[[28, 26], [32, 16], [46, 32], [28, 19], [33, 30], [46, 21]]",5,0.0,1.1419969278033792
random,6,180,,48,"[[25, 22], [17, 13], [22, 39], [32, 36], [38, 29], [3, 19]]","[[28, 26], [32, 16], [46, 32], [28, 19], [33, 30], [46, 21]]",5,0.0,1.1419969278033792
random,12,60,,48,"[[25, 22], [17, 13], [22, 39], [32, 36], [38, 29], [3, 19], [38, 39], [15, 2], [6, 42], [11, 41], [39, 47], [35, 35]]","[[28, 26], [32, 16], [46, 32], [28, 19], [33, 30], [46, 21], [39, 41], [29, 22], [45, 44], [1, 0], [8, 7], [6, 6]]",9,1.9157088122605366,1.137862533771267
random,12,120,,48,"[[25, 22], [17, 13], [22, 39], [32, 36], [38, 29], [3, 19], [38, 39], [15, 2], [6, 42], [11, 41], [39, 47], [35, 35]]","[[28, 26], [32, 16], [46, 32], [28, 19], [33, 30], [46, 21], [39, 41], [29, 22], [45, 44], [1, 0], [8, 7], [6, 6]]",9,1.9157088122605366,1.137862533771267
random,12,180,,48,"[[25, 22], [17, 13], [22, 39], [32, 36], [38, 29], [3, 19], [38, 39], [15, 2], [6, 42], [11, 41], [39, 47], [35, 35]]","[[28, 26], [32, 16], [46, 32], [28, 19], [33, 30], [46, 21], [39, 41], [29, 22], [45, 44], [1, 0], [8, 7], [6, 6]]",9,1.9157088122605366,1.137862533771267
even,3,60,,48,"[[32, 25], [46, 10], [12, 4]]","[[6, 41], [45, 11], [28, 32]]",2,0.0,1.0
even,3,120,,48,"[[32, 25], [46, 10], [12, 4]]","[[6, 41], [45, 11], [28, 32]]",2,0.0,1.0
even,3,180,,48,"[[32, 25], [46, 10], [12, 4]]","[[6, 41], [45, 11], [28, 32]]",2,0.0,1.0
even,6,60,,48,"[[32, 25], [46, 10], [12, 4], [0, 1], [32, 9], [39, 11]]","[[6, 41], [45, 11], [28, 32], [33, 24], [23, 38], [28, 26]]",5,0.0,1.0210526315789474
even,6,120,,48,"[[32, 25], [46, 10], [12, 4], [0, 1], [32, 9], [39, 11]]","[[6, 41], [45, 11], [28, 32], [33, 24], [23, 38], [28, 26]]",5,0.0,1.0210526315789474
even,6,180,,48,"[[32, 25], [46, 10], [12, 4], [0, 1], [32, 9], [39, 11]]","[[6, 41], [45, 11], [28, 32], [33, 24], [23, 38], [28, 26]]",5,0.0,1.0210526315789474
even,12,60,,48,"[[32, 25], [46, 10], [12, 4], [0, 1], [32, 9], [39, 11], [42, 4], [24, 11], [39, 10], [8, 0], [8, 24], [27, 1]]","[[6, 41], [45, 11], [28, 32], [33, 24], [23, 38], [28, 26], [18, 0], [34, 27], [39, 43], [16, 8], [34, 18], [26, 43]]",10,3.5812104562104556,1.0468396734844103
even,12,120,,48,"[[32, 25], [46, 10], [12, 4], [0, 1], [32, 9], [39, 11], [42, 4], [24, 11], [39, 10], [8, 0], [8, 24], [27, 1]]","[[6, 41], [45, 11], [28, 32], [33, 24], [23, 38], [28, 26], [18, 0], [34, 27], [39, 43], [16, 8], [34, 18], [26, 43]]",10,3.5812104562104556,1.0468396734844103
even,12,180,,48,"[[32, 25], [46, 10], [12, 4], [0, 1], [32, 9], [39, 11], [42, 4], [24, 11], [39, 10], [8, 0], [8, 24], [27, 1]]","[[6, 41], [45, 11], [28, 32], [33, 24], [23, 38], [28, 26], [18, 0], [34, 27], [39, 43], [16, 8], [34, 18], [26, 43]]",10,3.5812104562104556,1.0468396734844103
Binary file added data/empty-48-48-even-10_60_agents.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/empty-48-48-random-10_60_agents.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions g2rl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from g2rl.environment import G2RLEnv
from g2rl.agent import G2RLAgent, DDQNAgent
from g2rl.network import CRNNModel
from g2rl.metrics import moving_cost, detour_percentage
from g2rl.train import train
Loading

0 comments on commit 744cdda

Please sign in to comment.