Update README.md
Browse files
README.md
CHANGED
|
@@ -11,4 +11,195 @@ tags:
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# ATC Agent Hackathon Submission
|
| 14 |
-
This Space runs the inference script for the ATC environment. Production-ready OpenEnv-compliant environment for AI agents to act as ATC sequencing controller.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# ATC Agent Hackathon Submission
|
| 14 |
+
This Space runs the inference script for the ATC environment. Production-ready OpenEnv-compliant environment for AI agents to act as ATC sequencing controller.
|
| 15 |
+
## Overview & Motivation
|
| 16 |
+
|
| 17 |
+
**ATC OpenEnv** is an Air Traffic Control sequencing environment simulator explicitly designed for AI agents. The primary motivation is to evaluate reinforcement learning and LLM-based agents in an operational safety-critical setting where delays cause compounding penalties and physical errors (like fuel starvation) lead to episode-terminating crashes.
|
| 18 |
+
|
| 19 |
+
An AI agent acts as the primary ATC sequencing controller, observing inbound flights and making continuous decisions on runway assignments, landing order, and flow expediting. This is a physics-grounded workflow simulation, capturing real ATC operational pressure.
|
| 20 |
+
|
| 21 |
+
## Observation Space
|
| 22 |
+
|
| 23 |
+
| Field | Type | Description |
|
| 24 |
+
|-------|------|-------------|
|
| 25 |
+
| aircraft | List[dict] | All aircraft in the sector |
|
| 26 |
+
| aircraft[].id | str | Unique aircraft identifier |
|
| 27 |
+
| aircraft[].aircraft_type | str | HEAVY, MEDIUM, or LIGHT |
|
| 28 |
+
| aircraft[].priority | str | NORMAL, FUEL_CRITICAL, or EMERGENCY |
|
| 29 |
+
| aircraft[].status | str | INBOUND, HOLDING, ASSIGNED, LANDING, LANDED |
|
| 30 |
+
| aircraft[].distance_nm | float | Distance to runway in nautical miles |
|
| 31 |
+
| aircraft[].speed_knots | float | Current speed in knots |
|
| 32 |
+
| aircraft[].fuel_remaining_min | float | Fuel remaining in minutes |
|
| 33 |
+
| aircraft[].assigned_runway | str | Assigned runway ID (if any) |
|
| 34 |
+
| aircraft[].sequence_position | int | Position in landing sequence |
|
| 35 |
+
| runways | List[dict] | All runways at the airport |
|
| 36 |
+
| runways[].id | str | Runway identifier |
|
| 37 |
+
| runways[].status | str | OPEN, REDUCED, or CLOSED |
|
| 38 |
+
| runways[].next_available_step | int | Step when runway is next available |
|
| 39 |
+
| runways[].current_occupant | str | Aircraft ID currently on runway |
|
| 40 |
+
| timestep | int | Current simulation step |
|
| 41 |
+
| new_arrivals_count | int | Number of new arrivals this episode |
|
| 42 |
+
| episode_done | bool | Whether episode has ended |
|
| 43 |
+
|
| 44 |
+
## Action Space
|
| 45 |
+
|
| 46 |
+
| Field | Type | Description |
|
| 47 |
+
|-------|------|-------------|
|
| 48 |
+
| aircraft_id | str | Target aircraft identifier |
|
| 49 |
+
| action_type | str | assign, hold, or expedite |
|
| 50 |
+
| runway_id | str | Runway to assign (for assign action) |
|
| 51 |
+
| sequence_position | int | Landing sequence position |
|
| 52 |
+
|
| 53 |
+
## Tasks
|
| 54 |
+
|
| 55 |
+
### Task 1: Clear Skies
|
| 56 |
+
- **Difficulty**: Easy
|
| 57 |
+
- **Aircraft**: 5
|
| 58 |
+
- **Runways**: 2 (both OPEN)
|
| 59 |
+
- **Fuel**: All > 40 min
|
| 60 |
+
- **Emergencies**: None
|
| 61 |
+
- **Max Steps**: 20
|
| 62 |
+
- **Initial Distances**: 10-50 nm spread
|
| 63 |
+
|
| 64 |
+
### Task 2: Fuel Pressure
|
| 65 |
+
- **Difficulty**: Medium
|
| 66 |
+
- **Aircraft**: 10 initial, 2 arrive at step 5
|
| 67 |
+
- **Runways**: 1 OPEN, 1 REDUCED
|
| 68 |
+
- **Fuel Critical**: 2 aircraft with < 12 min
|
| 69 |
+
- **Max Steps**: 30
|
| 70 |
+
|
| 71 |
+
### Task 3: Full Emergency
|
| 72 |
+
- **Difficulty**: Hard
|
| 73 |
+
- **Aircraft**: 15 initial, 2 every 4 steps
|
| 74 |
+
- **Runways**: 2 (one closes at step 3)
|
| 75 |
+
- **Emergency**: One aircraft at step 5
|
| 76 |
+
- **Max Steps**: 40
|
| 77 |
+
|
| 78 |
+
## Scoring
|
| 79 |
+
|
| 80 |
+
### Grader 1 (Task 1)
|
| 81 |
+
- **Formula**: landings_completed / total_aircraft - avg_delay_penalty
|
| 82 |
+
- **Focus**: Basic landing completion efficiency
|
| 83 |
+
|
| 84 |
+
### Grader 2 (Task 2)
|
| 85 |
+
- **Formula**: 40% delay score + 40% fuel-critical handling + 20% separation compliance
|
| 86 |
+
- **Focus**: Handling fuel-critical situations
|
| 87 |
+
|
| 88 |
+
### Grader 3 (Task 3)
|
| 89 |
+
- **Formula**: 25% landings + 25% emergency + 25% no fuel exhaust + 25% queue < 12
|
| 90 |
+
- **Focus**: Multi-objective complex scenario handling
|
| 91 |
+
|
| 92 |
+
## Setup Instructions
|
| 93 |
+
|
| 94 |
+
### Local Setup
|
| 95 |
+
|
| 96 |
+
### Local LLM Inference
|
| 97 |
+
|
| 98 |
+
To run the inference script locally, you **must** supply environment variables pointing to your Language Model:
|
| 99 |
+
|
| 100 |
+
```bash
|
| 101 |
+
cd atc-openenv
|
| 102 |
+
pip install -r requirements.txt
|
| 103 |
+
|
| 104 |
+
# Linux/macOS
|
| 105 |
+
export API_BASE_URL="https://api.openai.com/v1" # Or Hugging Face Router, local vLLM etc.
|
| 106 |
+
export MODEL_NAME="gpt-4o"
|
| 107 |
+
export HF_TOKEN="your_hugging_face_or_api_key"
|
| 108 |
+
|
| 109 |
+
# Windows (Command Prompt)
|
| 110 |
+
set API_BASE_URL=https://router.huggingface.co/v1
|
| 111 |
+
set MODEL_NAME=Qwen/Qwen2.5-72B-Instruct
|
| 112 |
+
set HF_TOKEN=hf_YourTokenHere
|
| 113 |
+
|
| 114 |
+
# Run validation inference
|
| 115 |
+
python inference.py
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
### Local API Server
|
| 119 |
+
|
| 120 |
+
```bash
|
| 121 |
+
# Run the FastAPI Web API server locally
|
| 122 |
+
python app.py
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
### Docker Setup
|
| 126 |
+
|
| 127 |
+
```bash
|
| 128 |
+
cd atc-openenv
|
| 129 |
+
docker build -t atc-openenv .
|
| 130 |
+
docker run -p 7860:7860 atc-openenv
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
## API Endpoints
|
| 134 |
+
|
| 135 |
+
| Endpoint | Method | Description |
|
| 136 |
+
|----------|--------|-------------|
|
| 137 |
+
| `/health` | GET | Health check |
|
| 138 |
+
| `/reset?task_id={1,2,3}` | POST | Reset environment |
|
| 139 |
+
| `/step` | POST | Execute actions |
|
| 140 |
+
| `/state` | GET | Get full state |
|
| 141 |
+
|
| 142 |
+
## Baseline Scores (from inference.py)
|
| 143 |
+
|
| 144 |
+
| Task | Score | Total Reward |
|
| 145 |
+
|------|-------|--------------|
|
| 146 |
+
| 1 - Clear Skies | 1.000 | 4.35 |
|
| 147 |
+
| 2 - Fuel Pressure | 1.000 | 5.35 |
|
| 148 |
+
| 3 - Full Emergency | 0.967 | -2.00 |
|
| 149 |
+
|
| 150 |
+
## Example Interaction
|
| 151 |
+
|
| 152 |
+
```python
|
| 153 |
+
from env.atc_env import ATCEnv, Action
|
| 154 |
+
|
| 155 |
+
# Initialize environment
|
| 156 |
+
env = ATCEnv()
|
| 157 |
+
obs = env.reset(task_id=1)
|
| 158 |
+
|
| 159 |
+
# Observe current state
|
| 160 |
+
print(f"Timestep: {obs.timestep}")
|
| 161 |
+
print(f"Aircraft: {len(obs.aircraft)}")
|
| 162 |
+
print(f"Runways: {len(obs.runways)}")
|
| 163 |
+
|
| 164 |
+
# Submit actions (assign aircraft to runways)
|
| 165 |
+
actions = [
|
| 166 |
+
Action(aircraft_id="AC1", action_type="assign", runway_id="RW01", sequence_position=1),
|
| 167 |
+
Action(aircraft_id="AC2", action_type="assign", runway_id="RW02", sequence_position=1),
|
| 168 |
+
]
|
| 169 |
+
|
| 170 |
+
# Step simulation
|
| 171 |
+
obs, reward, done, info = env.step(actions)
|
| 172 |
+
print(f"Reward: {reward.value}")
|
| 173 |
+
print(f"Done: {done}")
|
| 174 |
+
|
| 175 |
+
# Get final state
|
| 176 |
+
state = env.state()
|
| 177 |
+
print(f"Score so far: {state.score_so_far}")
|
| 178 |
+
```
|
| 179 |
+
|
| 180 |
+
## Wake Turbulence Separation Rules
|
| 181 |
+
|
| 182 |
+
| Lead Type | Trail Type | Separation (nm) |
|
| 183 |
+
|-----------|------------|-----------------|
|
| 184 |
+
| HEAVY | HEAVY | 4 |
|
| 185 |
+
| HEAVY | MEDIUM | 5 |
|
| 186 |
+
| HEAVY | LIGHT | 6 |
|
| 187 |
+
| MEDIUM | LIGHT | 3 |
|
| 188 |
+
| OTHER | OTHER | 2 |
|
| 189 |
+
|
| 190 |
+
## Reward Events
|
| 191 |
+
|
| 192 |
+
| Event | Value |
|
| 193 |
+
|-------|-------|
|
| 194 |
+
| LANDING_SUCCESS | +1.0 |
|
| 195 |
+
| DELAY_PER_STEP | -0.05 per waiting aircraft |
|
| 196 |
+
| FUEL_CRITICAL_LATE | -2.0 per step after threshold |
|
| 197 |
+
| FUEL_EXHAUSTED | -10.0 |
|
| 198 |
+
| EMERGENCY_NOT_PRIORITIZED | -10.0 |
|
| 199 |
+
| SEPARATION_VIOLATION | -5.0 |
|
| 200 |
+
| RUNWAY_CONFLICT | -20.0 |
|
| 201 |
+
| HOLDING_PENALTY | -0.1 per step per holding aircraft |
|
| 202 |
+
|
| 203 |
+
## Environment Implementation
|
| 204 |
+
|
| 205 |
+
All models use Pydantic v2 for data validation. The environment is fully deterministic given a random seed. Graders are stateless and accept episode_log as input.
|