CoolFace
Apppublic

PunitRaveendran/Air_Traffic_Control_System

sourceHugging Faceapache-2.0updated 6mo agoView on Hugging Face
1likes
README.md205 linesDownload Raw Back to root
1---2license: apache-2.03title: ATC Agentic Inference4sdk: docker5emoji: ✈️6colorFrom: blue7colorTo: indigo8pinned: false9tags:10  - openenv11---12 13# ATC Agent Hackathon Submission14This 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 & Motivation16 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 19An 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 Space22 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 Space45 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## Tasks54 55### Task 1: Clear Skies56- **Difficulty**: Easy57- **Aircraft**: 558- **Runways**: 2 (both OPEN)59- **Fuel**: All > 40 min60- **Emergencies**: None61- **Max Steps**: 2062- **Initial Distances**: 10-50 nm spread63 64### Task 2: Fuel Pressure65- **Difficulty**: Medium66- **Aircraft**: 10 initial, 2 arrive at step 567- **Runways**: 1 OPEN, 1 REDUCED68- **Fuel Critical**: 2 aircraft with < 12 min69- **Max Steps**: 3070 71### Task 3: Full Emergency72- **Difficulty**: Hard73- **Aircraft**: 15 initial, 2 every 4 steps74- **Runways**: 2 (one closes at step 3)75- **Emergency**: One aircraft at step 576- **Max Steps**: 4077 78## Scoring79 80### Grader 1 (Task 1)81- **Formula**: landings_completed / total_aircraft - avg_delay_penalty82- **Focus**: Basic landing completion efficiency83 84### Grader 2 (Task 2)85- **Formula**: 40% delay score + 40% fuel-critical handling + 20% separation compliance86- **Focus**: Handling fuel-critical situations87 88### Grader 3 (Task 3)89- **Formula**: 25% landings + 25% emergency + 25% no fuel exhaust + 25% queue < 1290- **Focus**: Multi-objective complex scenario handling91 92## Setup Instructions93 94### Local Setup95 96### Local LLM Inference97 98To run the inference script locally, you **must** supply environment variables pointing to your Language Model:99 100```bash101cd atc-openenv102pip install -r requirements.txt103 104# Linux/macOS105export API_BASE_URL="https://api.openai.com/v1" # Or Hugging Face Router, local vLLM etc.106export MODEL_NAME="gpt-4o"107export HF_TOKEN="your_hugging_face_or_api_key"108 109# Windows (Command Prompt)110set API_BASE_URL=https://router.huggingface.co/v1111set MODEL_NAME=Qwen/Qwen2.5-72B-Instruct112set HF_TOKEN=hf_YourTokenHere113 114# Run validation inference115python inference.py116```117 118### Local API Server119 120```bash121# Run the FastAPI Web API server locally122python -m server.app123```124 125### Docker Setup126 127```bash128cd atc-openenv129docker build -t atc-openenv .130docker run -p 7860:7860 atc-openenv131```132 133## API Endpoints134 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 Interaction151 152```python153from env.atc_env import ATCEnv, Action154 155# Initialize environment156env = ATCEnv()157obs = env.reset(task_id=1)158 159# Observe current state160print(f"Timestep: {obs.timestep}")161print(f"Aircraft: {len(obs.aircraft)}")162print(f"Runways: {len(obs.runways)}")163 164# Submit actions (assign aircraft to runways)165actions = [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 simulation171obs, reward, done, info = env.step(actions)172print(f"Reward: {reward.value}")173print(f"Done: {done}")174 175# Get final state176state = env.state()177print(f"Score so far: {state.score_so_far}")178```179 180## Wake Turbulence Separation Rules181 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 Events191 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 Implementation204 205All 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.