Skip to main content

UrbanMARL: Vectorized Urban Multi-Agent Reinforcement Learning

Faculty of Computer and Information Technology Sana'a University Python 3.10+ PyTorch 2.12+ TorchRL 0.13.3 BenchMARL 1.5.2+ License: MIT

UrbanMARL is a high-performance, GPU-vectorized, data-driven multi-agent reinforcement learning (MARL) framework and digital twin simulator tailored for 6G geospatial radio environments, Unmanned Aerial Vehicles (UAVs), Mobile Edge Computing (MEC) networks, and other emerging applications.

UrbanMARL is built natively on TorchRL, PyTorch, TensorDict, and BenchMARL, vectorizes 3D spatial ray-casting of Line-of-Sight (LoS) paths, ITU-R P.1410 urban map procedural generation, mmWave radio propagation, and M/M/c queuing dynamics across hundreds of concurrent environments.

UrbanMARL is developed to extend the PhD research project titled "Three-Dimensional Mobility for Multi-UAV Assisted Multi-Access Edge Computing" conducted by Dr. Basheer Raddwan under the supervision of Prof. Ibrahim Al-Baltah, at the Department of Information Technology, Faculty of Computer and Information Technology, Sana’a University, Yemen, by refactoring the Panda5gSim project into a fully vectorized, data-driven, GPU-accelerated, and TorchRL-compatible MARL framework.


🎥 Video Overview

Rendering example of 3D and 2D geospatial and building heatmap during training of 6 MARL algorithms with 3 task scenarios; using 3 UAV-BS and 10 UE. Orange lines show UAV trajectories, green and red lines show LoS/NLoS conditions.

Watch the video

Example of analysis and result evaluation images rendered in a single video.

Watch the video


💡 Key Features

  • 100% Vectorized PyTorch Core: Batched 3D spatial movement, line-of-sight (LoS) calculations, building collision detection, radio propagation, and queuing systems run natively on GPU/CPU without python-loop bottlenecks.
  • 🏢 ITU-R P.1410 3D Procedural Urban Maps: Realistic 3D urban environments parameterized by building coverage ($\alpha$), building density ($\beta$), height distribution ($\gamma$), street width, and building dimensions using Poisson Point Processes.
  • 📡 Vectorized mmWave Radio Channel Model: Computes Friis path loss, LoS/NLoS attenuation exponent shifts, Signal-to-Interference-plus-Noise Ratio (SINR), and Shannon channel capacity for 29 GHz / 6G networks.
  • 🖥️ Vectorized M/M/c MEC Queue Model: Pure PyTorch tensor implementation of M/M/c queuing theory calculating server utilization, average queue lengths, waiting times, and total response delay.
  • 🤖 BenchMARL & TorchRL Native: Fully compatible with BenchMARL task APIs (UrbanEnvTask). Supports SOTA MARL algorithms (MAPPO, MADDPG, MASAC, IPPO, IDDPG, ISAC, QMIX).
  • 🎬 3D Rendering & Analytics Suite: Includes interactive Matplotlib/MP4 3D trajectory rendering, CSV/TensorBoard logging, and evaluation plotters.

🎮 Scenarios Overview

Scenario Name Description Agent Action Space Observation Space
uav_navigation Multi-UAV assest 5G+/6G wireless network independently/cooperatively learn to improve the coverage by navigating the simulation volume to find the best positions. Continuous velocity $(v_h, \phi, v_z)$ UAV Position $(x,y,z)$ & Battery level
uav_ue_los Multi-UAV assest 5G+/6G wireless network independently/cooperatively learn to maximize the Line-of-sight status with ground IoTs/users for high-altitude platform stations and UAV relays. Continuous velocity $(v_h, \phi, v_z)$ UAV Position $(x,y,z)$ & Battery level
coverage Multi-UAV assest 5G+/6G wireless network independently/cooperatively learn to maximize the spatial coverage. Continuous velocity $(v_h, \phi, v_z)$ UAV Position $(x,y,z)$ & Battery level

⚙️ Installation

Prerequisites

  • Python: $\ge 3.10$ tested on 3.12
  • PyTorch: $\ge 2.12.0$ (CUDA recommended for large batch sizes)

Setup Steps

  1. Clone the repository:

    git clone https://github.com/yemenlinux/vUrbanMARL.git
    cd vUrbanMARL
    
  2. Create a virtual environment (optional but recommended):

    Using conda:

        conda create -n vurbanmarl python=3.12
        conda activate vurbanmarl
    

    Using standard Python venv:

    python3 -m venv venv
    source venv/bin/activate
    
  3. Install dependencies and the package:

    For CPU-only installation:

    pip install -r requirements/cpu.txt
    

    For GPU installation (CUDA 12.6 - recommended for old GPUs):

    pip install -r requirements/cuda126.txt
    

    For GPU installation (CUDA 13.0 - recommended for new GPUs):

    pip install -r requirements/cuda130.txt
    

🚀 Quick Start

1. Direct PyTorch / TorchRL Usage

You can instantiate and step through UrbanEnv directly using TorchRL semantics:

import torch
from urbanmarl.envs.base_env import UrbanEnv

# Initialize environment with 64 parallel batched environments on GPU/CPU
env = UrbanEnv(
    num_envs=64,
    scenario="uav_navigation",
    num_uavs=3,
    num_ues=50,
    device="cuda" if torch.cuda.is_available() else "cpu",
)

# Reset environment
tensordict = env.reset()
print("Initial Observation:", tensordict["agents", "observation"].shape)

# Sample action and step
actions = env.action_spec.sample()
tensordict.update(actions)
next_tensordict = env.step(tensordict)

print("Reward:", next_tensordict["next", "agents", "reward"].shape)
print("Done:", next_tensordict["next", "done"].shape)

2. Running MARL Benchmarks via BenchMARL

Run comparative benchmark training across multiple MARL algorithms (e.g., MAPPO, MADDPG):

python scripts/run_benchmark.py

Or execute full benchmark experiments with automated result collection and plotting:

python scripts/full_experiment.py

📊 Evaluation & Visualization

  • Interactive Notebooks: Explore evaluate.ipynb and test_renderer.ipynb for plotting scalar metrics and rendering 3D UAV trajectories over procedurally generated building maps.
  • Result Processing: Utilities in urbanmarl/eval_results.py format CSV/TensorBoard outputs into publication-ready figures.

📄 License

This project is released under the MIT License.


Affiliation and Sponsors

Department of Information Technology, Faculty of Computer and Information Technology, Sana’a University, Yemen.


✍️ Authors & Citation

Created by: Dr. Basheer Raddwan

Supervised by: Prof. Ibrahim Al-Baltah

If you use UrbanMARL in your research, please cite:

@inproceedings{raddwan_urbanmarl_2026,
	title = {{UrbanMARL}: {A} {Vectorized} {Urban} {Simulator} for {Multi}-{Agent} {Reinforcement} {Learning}},
	url = {https://www.researchgate.net/doi/10.13140/RG.2.2.17864.69122},
	doi = {10.13140/RG.2.2.17864.69122},
	urldate = {2026-07-31},
	author = {Raddwan, Basheer and Al-Baltah, Ibrahim and Zahary, Ammar and Alshamery, Anwar},
	year = {2026},
}

Related work

@article{RADDWAN2025104019,
title = {Quantify the joint effect of mobility and urban environment on computation offloading to multi-UAV MEC network: Sojourn time},
journal = {Ad Hoc Networks},
volume = {179},
pages = {104019},
year = {2025},
issn = {1570-8705},
doi = {https://doi.org/10.1016/j.adhoc.2025.104019},
url = {https://www.sciencedirect.com/science/article/pii/S1570870525002677},
author = {Raddwan, Basheer and Al-Baltah, Ibrahim}
}

@ARTICLE{11050367,
  author={Raddwan, Basheer and Al-Baltah, Ibrahim},
  journal={IEEE Access}, 
  title={Mobility-Aware Bivariate Line-of-Sight Probability for Air-to-Ground Communications Using Millimeter and Terahertz Waves}, 
  year={2025},
  volume={13},
  number={},
  pages={123913-123930},
  keywords={Air to ground communication;Atmospheric modeling;Layout;Geometry;Line-of-sight propagation;Directional antennas;Ray tracing;Communication channels;Buildings;ITU;Line-of-sight probability;mobility;air-to-ground communication;multi-access edge computing;ray-tracing;unmanned aerial vehicles;service time;sojourn time;urban;simulation},
  doi={10.1109/ACCESS.2025.3582890}}

@INPROCEEDINGS{10777167,
  author={Raddwan, Basheer and Al-Baltah, Ibrahim and Ghaleb, Mukhtar},
  booktitle={2024 1st International Conference on Emerging Technologies for Dependable Internet of Things (ICETI)}, 
  title={Environment-Aware 3D Mobility Simulation for the 5G and 6G Wireless Networks}, 
  year={2024},
  volume={},
  number={},
  pages={1-8},
  keywords={Three-dimensional displays;Mobility models;Biological system modeling;Wireless networks;Urban areas;Interference;Ray tracing;Throughput;3GPP;Signal to noise ratio;urban;5G;6G;mobility;ray-tracing;simulation;open-source;handover rate;framework;multi-access edge computing;unmanned aerial vehicle;3D mobility;3D environment},
  doi={10.1109/ICETI63946.2024.10777167}}

Contributors:

  • Dr. Basheer Raddwan
  • Prof. Ibrahim Al-Baltah

Download files

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

Source Distribution

urbanmarl-0.2.0.tar.gz (994.9 kB view details)

Uploaded Source

Built Distribution

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

urbanmarl-0.2.0-py3-none-any.whl (50.7 kB view details)

Uploaded Python 3

File details

Details for the file urbanmarl-0.2.0.tar.gz.

File metadata

  • Download URL: urbanmarl-0.2.0.tar.gz
  • Upload date:
  • Size: 994.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.14

File hashes

Hashes for urbanmarl-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c1ac5f76d86d1b0e29ae545837d570c4e0728b7b3c1ada4bd6142d62dfbb390d
MD5 077f541e3676a3db4948defd1aeb1fc7
BLAKE2b-256 7bcc23b2f62e4524befa39feca54a300f60c0b2c6a5fe33a89d50cd9463e5f6d

See more details on using hashes here.

File details

Details for the file urbanmarl-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: urbanmarl-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 50.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.14

File hashes

Hashes for urbanmarl-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5f1eecb242f6408eb79dca576dbb6ff1b97c5a564e660474c638d0b06bd551b
MD5 5493ad96d18ca26369f8deb7ec825050
BLAKE2b-256 8eca46f290b5979fb19d88bac99c1e91b7d5bb9cb1cd3bd1362a312faa791b12

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page