Multi-UAV Assisted Wireless Powered Mobile Edge Computing: A Hybrid Optimization Approach
Objective
The primary objective of this research is to develop a framework for a multi-UAV-assisted collaborative Mobile Edge Computing (MEC) network. We aim to jointly optimize the interdependent components: task offloading decisions, service caching placement, content caching strategies, UAV trajectories and wireless power transfer. The goal is to minimize service latency, system-wide energy consumption, device offline rate while simultaneously maximizing user fairness.
We are aiming to implement a hybrid optimization approach that combines multi-agent deep reinforcement learning with collaborative and adaptive caching policies. We are trying to create a generic framework that can be used with different models for finding the best-suited one for our purpose. We are also exploring incorporating attention mechanisms within the multi-agent reinforcement learning models for scalability and improved performance.
Also trying to incorporate modern Python practices and type annotations (Python 3.12+).
π― What's Included?
MARL algorithms included:
- MADDPG
- MATD3
- MAPPO
- MASAC
- 4 Attention Variants of above algorithms
See marl_models/README.md for further details.
Advanced Features:
- β Offline rate tracking - Monitors device battery health
- β Wireless Power Transfer - UAVs charge devices under critical battery levels
- β Smart caching - Adaptive content placement
- β Multi-agent coordination - Through MARL algorithms enhanced with attention mechanisms
- β 3-stage tuning - Optimize reward weights, agent params, architecture

π Project Structure
.
βββ environment/ # Simulation
β βββ env.py # Main simulation loop
β βββ uavs.py # UAV dynamics
β βββ user_equipments.py # Device battery & requests
β βββ comm_model.py # Communication & WPT
β
βββ marl_models/ # RL algorithms (see marl_models/README.md for detailed structure)
β
βββ utils/ # Utilities
β βββ logger.py # Training logs & metrics
β βββ plot_logs.py # Single run visualization
β βββ plot_snapshots.py # Snapshots of environment and trajectories
β βββ comparative_plots.py # Multi-algorithm comparison
β
βββ config.py # All parameters
βββ train.py # Training script
βββ test.py # Testing script
βββ tune.py # Hyperparameter tuning with Optuna
βββ main.py # Legacy interface
β‘ Setup Instructions
To run this project, you need to install PyTorch specifically for your system's hardware first, followed by the rest of the dependencies.
For Windows users with NVIDIA GPUs (CUDA 12.4), use:
pip install torch --index-url https://download.pytorch.org/whl/cu124
# Clone repository
git clone <repo_url>
cd Multi-UAV-Mobile-Edge-Computing-Hybrid-Optimization
# Create virtual environment (Python 3.12+)
python -m venv .venv
.venv\Scripts\activate # Windows
# or: source .venv/bin/activate # Linux/Mac
# Install dependencies
pip install -r requirements.txt
π How to Use
π Requirements
- Python (3.12.0+)
- PyTorch (version as per your GPU and OS, along with any other dependencies)
- NumPy, Matplotlib, Optuna (and Plotly, Kaleido, Scikit-Learn for Optuna visualisation)
Training
It can be used to start training from scratch or resume training from a previously saved checkpoint.
# Start training from scratch
python main.py train --num_episodes=<total_episodes>
# To resume training from a saved checkpoint, specify no. of additional episodes, path to the saved checkpoint, and path to the saved config file (to load and use the same settings).
python main.py train --num_episodes=<additional_episodes> --resume_path="<path_to_checkpoint_directory>" --config_path="<path_to_saved_config>"
Hyperparameter Tuning
Optimize reward weights and agent parameters with 3-stage tuning:
# Stage 1: Optimize reward weights (ALPHA_1, ALPHA_2, ALPHA_3, ALPHA_4): helps understand reward trade-offs
python tune.py --stage 1 --episodes 500 --trials 50
# Stage 2: Optimize learning rates, batch sizes, network architecture: find best agent hyperparameters
python tune.py --stage 2 --episodes 1000 --trials 50
# Stage 3: Optimize attention architecture (attention models only): tune ATTN_HIDDEN_DIM and ATTN_NUM_HEADS
python tune.py --stage 3 --episodes 500 --trials 30
Testing
It can be used to test a saved model for a specified number of episodes. To test a saved model, you must provide the path to the model's directory and its corresponding configuration file.
# Start testing, with saved model path and config file saved during that model's training run (to load and use the same settings).
python main.py test --num_episodes=<total_episodes> --model_path="<path_to_model_directory>" --config_path="<path_to_saved_config>"
Visualization
# Compare multiple algorithms
python utils/compare_algorithms.py \
--logs train_logs/maddpg_run train_logs/matd3_run train_logs/mappo_run \
--names MADDPG MATD3 MAPPO \
--output comparison_plots \
--smoothing 10
Refer Plotting Module for detailed plotting plan.
π¨βπ» Contributors
- Roopam Taneja
- Vraj Tamakuwala
PS: Currently under rapid development and may be subject to significant changes.