CoolFace
Apppublic

PilluBHAI/wildfire-containment-v0

sourceHugging Faceupdated 6mo agoView on Hugging Face
1likes
App README

WildfireContainment-v0

Overview

WildfireContainment-v0 is a comprehensive, real-world OpenEnv environment where an AI agent controls suppression resources to minimize fire spread and protect critical structures.

Designed for the India's First OpenEnv AI Hackathon (Meta x Hugging Face x PyTorch), it balances complex environmental dynamics (wind, spot fires, fuel consumption) with strategic resource management.


๐Ÿ—๏ธ Environment Logic

  • โ€”Grid Size: 20x20
  • โ€”Channels:
  • โ€”fuel: Available combustible material (0.0-1.0).
  • โ€”fire_intensity: Current combustion level (0.0-1.0).
  • โ€”moisture: Applied suppression or natural wetness (0.0-1.0).
  • โ€”structures: Binary grid of high-value assets requiring protection.
  • โ€”Dynamics:
  • โ€”Spread: Fire moves to adjacent 8 cells based on ignition probability, biased by Wind Direction and Speed.
  • โ€”Spot Fires: High-intensity fires have a chance to throw sparks downwind, starting new fires several cells away.
  • โ€”Agents:
  • โ€”1 Air Tanker: High mobility, drops 3x3 water (moisture +0.5). Limited water capacity, must refill at grid edges.
  • โ€”2 Ground Crews: Low mobility, suppresses current 1x1 cell fire (intensity -0.2). Consumes stamina, must rest at grid edges.

๐ŸŽฎ Action & Observation Spaces

๐Ÿ•น๏ธ Action Space

A WildfireAction object containing a list of 3 unit actions:

  • โ€”move: 0-7 directions, 8=stay.
  • โ€”act: Binary flag to drop water (Tanker) or suppress fire (Crew).

๐Ÿ” Observation Space

A WildfireObservation object containing:

  • โ€”20x20 fuel, fire, moisture, and structure grids.
  • โ€”Unit locations and resource levels.
  • โ€”Current wind vector.

๐Ÿ“ˆ Reward System

  • โ€”(+) Fire intensity reduction (Fire extinguished).
  • โ€”(+) Structure survival bonus (per step).
  • โ€”(-) Fire spread (New cells ignited).
  • โ€”(-) Structure loss (Large penalty).
  • โ€”(+) Full containment bonus (Completion).

๐Ÿš€ Setup & Execution

1. Start the Agent Backend

The API server must be running to process environment dynamics.

bash
pip install -r requirements.txt
python -m uvicorn server.app:app --host 0.0.0.0 --port 7860

2. Start the Custom Visual Dashboard

Open a second terminal and run the following to serve the beautiful graphical UI:

bash
cd frontend
python -m http.server 3000

Then, open http://localhost:3000 in your web browser. Click Reset and Auto-Play Agent to watch the simulation!

Docker / Online Deployment

bash
docker build -t wildfire-env .
docker run -p 7860:7860 wildfire-env

Endpoints

  • โ€”GET /tasks: Lists Easy/Medium/Hard scenarios.
  • โ€”GET /grader: Returns current session score (0.0-1.0).
  • โ€”POST /baseline: Run greedy heuristic baseline.