This repository provides the graph construction methods introduced in the paper “P3GASUS: Pre-Planned Path Execution Graphs for Multi-Agent Systems at Ultra-Large Scale.”
The core implementations are located in:
discreteUtil.py— for discrete-space scenarioscontinuousUtil.py— for continuous-space scenarios
Example usage is demonstrated in the accompanying Jupyter notebooks:
discrete.ipynbcontinuous.ipynb
The results/ folder contains detailed test outputs generated using:
generateDiscreteResults.pygenerateContResults.py
The discrete implementation relies on lacam3’s Python bindings, generated from the repository:
➡️ https://github.com/Kei18/lacam3/tree/pybind
These bindings work with Python 3.11. For other Python versions, you may need to regenerate the bindings.
All methods implemented in discreteUtil.py — namely OriginalADG, SAGE, MAGE, and FORTED — inherit from the ExecutionGraph class.
Each ExecutionGraph instance contains:
taskListgraph(a NetworkX directed graph)robotList
See the paper for full algorithmic details.
Generates an open, obstacle-free world populated with agents while enforcing the requested amount of free space.
freeSpacePercentranges from 1–100.- Returns:
startPositionsactions(all agents, all timesteps)freeSpaceUsed
All experiments in the paper use ≥ 30% free space to ensure lacam3 can generate paths reliably.
Action encoding:
0: stay still1: move East2: move South3: move West4: move North
Runs the specified graph-construction method.
filename— path to a.datfile for storing the DP matrix if the task list becomes extremely large (typically > 50,000 tasks).
Returns:
graph.edges- computation time
from discreteUtil import *
actions, starts, free = oneTestCase(100, 50)
testTime(OriginalADG, actions, starts)To write a graph to disk:
exGraph = FORTED(actions, starts)
exGraph.fileWrite("Debug/")The constructed execution graph is available as:
exGraph.graphAll methods implemented here — OriginalADG, SAGE, and MAGE — inherit from the common ExecutionGraph class.
Each ExecutionGraph instance contains:
taskListgraph(a NetworkX directed graph)robotList
The folder Continuous Scenario Paths/ contains sample path data in JSON format generated from MetaDrive
Converts path data loaded from JSON format into a NumPy matrix suitable for further processing.
Runs the specified continuous-space graph construction method.
val— the method class (OriginalADG,SAGE, orMAGE)allPos— the positions matrix returned fromjsonToNpy
Returns:
- communication length
- computation time
from continuousUtil import *
listOfMethods = [OriginalADG, SAGE, MAGE]
with open("Continuous Scenario Paths/10Agents_10fps", 'r') as f:
try:
data = json.load(f)
except:
print("Error loading JSON")
allPos = jsonToNpy(data, NUM_AGENTS=10)
for val in listOfMethods:
commsLen, timeTaken = testTime(val, allPos)
print(f"{val.__name__}: Time Taken - {timeTaken}, Comms Length - {commsLen}")To write a graph to disk:
exGraph = SAGE(allPos)
exGraph.fileWrite("Debug/")The constructed execution graph is available as:
exGraph.graph