Python and MATLAB Implementation of Optimal Transport–Based Multi-Agent Control: Time-Averaged Trajectory Matching for Any Given Reference Distributions
State-of-the-Art implementation for Ergodic Control, Time-Averaged Coverage (TAC), and Multi-Agent Coordination.
This repository provides the official Python and MATLAB implementation of
Density-Driven Optimal Control (D2OC) — a novel multi-agent control framework based on Optimal Transport (OT) and Wasserstein distance for non-uniform area coverage, multi-agent/multi-robot coordination, and
fully decentralized multi-agent control.
This code accompanies the following publication:
Paper (IEEE Transactions on Systems, Man, and Cybernetics: Systems)
DOI: https://doi.org/10.1109/TSMC.2025.3622075
arXiv: https://arxiv.org/abs/2511.12756
D2OC solves decentralized multi-agent area coverage by:
- modeling target maps as probability densities,
- guiding agents using Wasserstein-distance–driven OT potentials,
- applying linearized quadrotor-inspired dynamics,
- computing control inputs via a finite-horizon KKT-based MPC,
- enabling decentralization through local weight sharing.
Included in this repository:
- 8-state quadrotor LTI dynamics
- OT-based target computation
- decentralized weight update logic
- Gaussian-mixture density fields
- simulation data and parameters
- live trajectory visualization
Repository Structure The source code is organized into Python and MATLAB implementations:
Located in the /Python folder. Contains the single file for Python-based implementation of the D2OC framework for cross-platform research and integration. Just run D2OC_main.py
Located in the /MATLAB folder. Main_D2OC.m : Main simulation script. environment/DF.mat : Reference density maps. param/param07.mat : Control parameters. update_weight_R2.m : Decentralized weight update rule. hamilton_optimal_control... : OT-based target computation logic.
- Clone or download this repository
- Use MATLAB R2020a or later
- Ensure
sim_data/Sim_rev60.matexists - Open
Main_D2OC.m - Select a test:
cnt_sim = 2; % use 2, 3, or 4- Run the script
- Watch live visualization of UAV trajectories and density evolution
- Optimal Transport control with Wasserstein distance
- Non-uniform density tracking
- Decentralized multi-agent coverage
- Lagrangian-based OT point selection
- Finite-horizon KKT/MPC formulation
- UAV-ready MATLAB implementation
- Scalable to many agents
State vector:
x = [x, x_dot, theta, theta_dot, y, y_dot, phi, phi_dot]'
where:
- x, y = positions
- theta, phi = pitch/roll angles
- derivatives = velocities
- Search & Rescue (SAR)
- Environmental monitoring
- Gas plume / wildfire mapping
- Persistent surveillance
- Agricultural field scanning
- Exploration & inspection
- multi-agent multi-robot coverage control
- ergodic control and ergodicity
- time-averaged coverage (TAC)
- density-driven optimal control
- optimal transport control
- wasserstein distance
- multi-agent systems
- decentralized control
- distributed UAV control
- coverage control
- non-uniform area coverage
- mpc
- optimal control
- uav robotics
- density control
- multi-robot coordination
If you use this code, please cite:
S. Seo and K. Lee, “Density-Driven Optimal Control for Efficient and Collaborative Multiagent Nonuniform Coverage,”
IEEE Transactions on Systems, Man, and Cybernetics: Systems, 2025.
DOI: https://doi.org/10.1109/TSMC.2025.3622075
(arXiv version: https://arxiv.org/abs/2511.12756)
Released under the MIT License.
Maintained by Kooktae Lee, Ph.D.
Associate Professor, Mechanical Engineering, New Mexico Tech
