This repository provided an UAV target assignment RL environment modelled in Agent-Environment-Cycle (AEC). The environment simulates a scenario where multiple drones can be assigned to various threats, each with different threat levels.
In this task allocation problem:
- There may have a variable number of drones (agents) and threats.
- Each threat has a certain threat level, represented by a probability.
- Drones should be allocated to threats to neutralize them.
- The goal is to optimize the allocation of drones to threats to maximize overall performance.
The environment is designed using the PettingZoo library's AEC paradigm. Key features include:
- Variable number of agents: The number of drones can vary between episodes.
- Threat representation: Threats are represented by their threat levels (probabilities).
- Action space: Each drone can choose which threat to engage.
- Observation space: Agents observe the threat levels, pre-calculated allocations, and current allocations.
- Reward structure: Rewards are based on threat coverage, success rate, and other factors.
TaskAllocationEnv
: The main environment class.reset()
: Initializes the environment for a new episode.step()
: Processes agent actions and updates the environment state.observe()
: Returns the current observation for an agent.render()
: Visualizes the current state of the environment.
The environment includes a detailed visualization system using Pygame. It displays:
- Threat levels (color-coded)
- Actual threats
- Drone allocations
- Eliminated threats
- Various statistics and information
To use this environment:
pip install -r requirements.txt
- Import the environment:
from task_allocation_env import raw_env
env = raw_env()