## System Overview: Multi-Agent Path Finding (MAPF) Visualization
This document details the visualization of a Multi-Agent Path Finding (MAPF) system. The visualization displays agents navigating a grid-based environment, avoiding collisions and reaching their designated goals.
### 1. Environment Representation
* **Grid:** The environment is represented as a 2D grid. Each cell in the grid can be either:
* **Free Space:** Represents navigable areas.
* **Obstacle:** Represents blocked areas that agents cannot traverse.
* **Dimensions:** The grid dimensions are configurable (e.g., 20x20, 50x50).
* **Visualization:** Free space is typically displayed as white or a light color, while obstacles are displayed as black or a dark color.
### 2. Agent Representation
* **Shape:** Agents are visually represented as circles, squares, or other distinct shapes.
* **Color:** Each agent is assigned a unique color for easy identification.
* **Size:** Agent size is proportional to their radius or dimensions.
* **Goal:** Each agent has a designated goal location, marked on the grid with a distinct symbol (e.g., a star, a flag).
### 3. Path Visualization
* **Path Lines:** The planned path for each agent is visualized as a series of connected lines.
* **Path Color:** Path lines are colored differently from the agent's color to distinguish the planned path from the agent's current position.
* **Path Thickness:** Path line thickness can be adjusted for clarity.
* **Real-time Updates:** The path visualization updates in real-time as agents move and replan their paths.
### 4. Collision Avoidance Visualization
* **Collision Detection:** The system detects potential collisions between agents.
* **Collision Warning:** When a potential collision is detected, a visual warning is displayed (e.g., a flashing border around the agents, a highlighted area).
* **Resolution:** The visualization shows how the system resolves collisions, such as agents slowing down, stopping, or changing their paths.
### 5. Performance Metrics
The visualization can display performance metrics such as:
| Metric | Description |
| ------------------ | ----------------------------------------- |
| **Makespan** | Total time taken for all agents to reach goals |
| **Total Cost** | Sum of the distances traveled by all agents |
| **Number of Collisions** | Total number of collisions that occurred |
| **Computation Time** | Time taken to compute the paths |
### 6. User Interface (UI) Controls
* **Start/Pause/Stop:** Buttons to control the simulation.
* **Grid Size:** Input field to adjust the grid dimensions.
* **Number of Agents:** Input field to adjust the number of agents.
* **Agent Speed:** Slider to control the agent's movement speed.
* **Algorithm Selection:** Dropdown menu to select different MAPF algorithms (e.g., CBS, ECBS).
* **Visualization Options:** Checkboxes or toggles to control the display of paths, collisions, and performance metrics.
### 7. Algorithm Implementations
The visualization supports various MAPF algorithms, including:
* **Conflict-Based Search (CBS):** A two-level search algorithm that finds optimal solutions.
* **Enhanced CBS (ECBS):** An improved version of CBS that reduces search time.
* **Prioritized Planning:** An algorithm that prioritizes agents based on their distance to the goal.
* **Velocity Obstacles:** An approach that uses velocity obstacles to avoid collisions.