Skip to content

Latest commit

 

History

History
479 lines (381 loc) · 16 KB

File metadata and controls

479 lines (381 loc) · 16 KB

Building Evacuation System - Complete Project Summary

🏢 Project Overview

This project implements a Building Evacuation System using Optimized Path Planning with two distinct prototypes demonstrating different approaches to 3D visualization and real-time pathfinding algorithms.

Core Concept

The system simulates emergency evacuation scenarios in multi-floor buildings with dynamic fire spread, implementing advanced pathfinding algorithms (A*, Dijkstra's, RRT*) to find optimal evacuation routes and automatically re-route when fire blocks existing paths.


📁 Project Structure

daa_see/
├── 📚 docs/
│   └── prototype_comparison.md          # Detailed comparison analysis
├── 🐍 matplotlib_prototype/             # Python-based 3D visualization
│   ├── src/
│   │   ├── algorithms/pathfinding.py    # A*, Dijkstra, RRT* implementations
│   │   ├── simulation/building.py       # Building, fire, person simulation
│   │   ├── visualization/plotter.py     # 3D matplotlib visualization
│   │   └── main.py                      # Main application entry point
│   ├── requirements.txt                 # Python dependencies
│   └── README.md                        # Detailed setup and usage guide
├── 🌐 web_prototype/                    # Angular + Three.js web application
│   ├── src/app/
│   │   ├── components/
│   │   │   ├── simulation/              # Main simulation interface
│   │   │   └── analysis/                # Algorithm performance analysis
│   │   ├── services/
│   │   │   ├── building.service.ts      # Building and fire simulation
│   │   │   ├── pathfinding.service.ts   # Pathfinding algorithms
│   │   │   └── three-visualization.service.ts # 3D rendering
│   │   └── app.component.ts             # Root component
│   ├── package.json                     # Node.js dependencies
│   └── README.md                        # Web prototype documentation
├── 🚀 setup_and_demo.sh                 # Automated setup and demo script
├── 📖 README.md                         # Main project documentation
└── 🐍 venv/                             # Python virtual environment

🎯 Key Features

🏗️ Building Simulation

  • Multi-floor buildings with realistic layouts (rooms, corridors, stairs)
  • Dynamic fire spread simulation with configurable spread rates
  • Interactive fire placement via mouse clicks or coordinates
  • Multiple exit points for realistic evacuation scenarios
  • Procedural building generation with customizable dimensions

🤖 Pathfinding Algorithms

  • A Algorithm*: Heuristic-based optimal pathfinding with 3D Euclidean distance
  • Dijkstra's Algorithm: Guaranteed shortest path without heuristic bias
  • RRT Algorithm*: Continuous space exploration (basic implementation)
  • Real-time re-routing: Automatic path recalculation when fire blocks routes
  • Multi-path support: Primary and alternate route visualization

📊 Performance Analysis

  • Algorithm comparison: Side-by-side performance metrics
  • Multiple test scenarios: Predefined and custom test cases
  • Statistical reports: Execution time, path length, success rates
  • Visual charts: Interactive performance visualizations
  • Export capabilities: Save simulation states and results

🎮 Interactive Features

  • 3D navigation: Rotate, zoom, and pan around building
  • Real-time controls: Adjust simulation parameters on the fly
  • Touch support: Mobile-friendly interface for web prototype
  • Keyboard shortcuts: Quick controls for matplotlib prototype
  • Responsive design: Works on desktop, tablet, and mobile

🐍 Matplotlib Prototype

Technology Stack

  • Language: Python 3.7+
  • Visualization: Matplotlib with 3D plotting
  • Dependencies: NumPy, SciPy, NetworkX, Matplotlib
  • Architecture: Modular Python classes
  • Performance: CPU-based rendering (30-60 FPS)

Key Components

src/main.py - Main Application

class EvacuationApp:
    """Main application class for the evacuation simulation."""
    
    def run_interactive_mode(self):
        """Run the application in interactive mode."""
        
    def run_demo_scenario(self):
        """Run a predefined demo scenario."""
        
    def run_static_analysis(self):
        """Run static analysis of different pathfinding algorithms."""

src/algorithms/pathfinding.py - Pathfinding Algorithms

  • A Implementation*: 3D heuristic with floor penalties
  • Dijkstra Implementation: Uniform cost search
  • Dynamic Re-routing: Continuous path validation

src/simulation/building.py - Building Simulation

  • Building Generation: Procedural layout creation
  • Fire Simulation: Dynamic spread with configurable parameters
  • Person Management: Add, remove, and track evacuation candidates

src/visualization/plotter.py - 3D Visualization

  • Real-time Animation: 60 FPS capability
  • Interactive Controls: Mouse and keyboard input
  • Path Visualization: Primary and alternate routes

Interactive Controls

Control Action
Left Click Place fire at clicked position
Spacebar Start/Stop simulation
R Reset simulation
C Calculate evacuation paths
H Show help
Mouse Drag Rotate view
Mouse Wheel Zoom

Performance Characteristics

  • Rendering: 30-60 FPS (CPU dependent)
  • Memory Usage: 100-200MB typical
  • Scalability: Up to 30×30×5 buildings
  • Algorithm Speed: 1-10ms per path

🌐 Web Prototype

Technology Stack

  • Framework: Angular 17 with standalone components
  • Visualization: Three.js with WebGL acceleration
  • Language: TypeScript/JavaScript
  • Architecture: Service-based Angular architecture
  • Performance: GPU-accelerated rendering (60+ FPS)

Key Components

src/app/app.component.ts - Root Component

@Component({
  selector: 'app-root',
  standalone: true,
  template: `
    <div class="container">
      <header class="header">
        <h1>🏢 Building Evacuation System</h1>
        <nav>
          <a routerLink="/">🎮 Simulation</a>
          <a routerLink="/analysis">📊 Analysis</a>
        </nav>
      </header>
      <main class="main-content">
        <router-outlet></router-outlet>
      </main>
    </div>
  `
})

src/app/services/building.service.ts - Building Simulation

  • Reactive State Management: RxJS observables for real-time updates
  • Building Generation: Procedural layout creation
  • Fire Simulation: Dynamic spread with visual effects
  • Person Management: Add, remove, and track evacuation candidates

src/app/services/pathfinding.service.ts - Pathfinding Algorithms

  • Algorithm Implementations: A* and Dijkstra with optimizations
  • Path Validation: Check for fire blockages and recalculate
  • Performance Metrics: Detailed statistics for analysis
  • Multi-path Support: Primary and alternate route calculation

src/app/services/three-visualization.service.ts - 3D Rendering

  • 3D Rendering: Hardware-accelerated graphics with Three.js
  • Real-time Updates: Efficient scene graph management
  • Interactive Controls: Mouse/touch navigation
  • Visual Effects: Lighting, shadows, and animations

Features

  • Modern Web Interface: Responsive design with professional UI
  • Hardware Acceleration: GPU-accelerated 3D graphics
  • Real-time Analytics: Comprehensive performance dashboard
  • Mobile Support: Touch-friendly interface
  • Export Capabilities: Save simulation states and results

Performance Characteristics

  • Rendering: 60+ FPS (GPU accelerated)
  • Memory Usage: 50-150MB typical
  • Scalability: Up to 50×50×10 buildings
  • Algorithm Speed: 1-5ms per path

🔬 Algorithm Implementation Details

A* Algorithm

// Heuristic function for 3D pathfinding
calculateHeuristic(pos1: Position, pos2: Position): number {
  const dx = pos2.x - pos1.x;
  const dy = pos2.y - pos1.y;
  const dz = (pos2.floor - pos1.floor) * 10; // Floor penalty
  return Math.sqrt(dx * dx + dy * dy + dz * dz);
}

Features:

  • 3D Euclidean distance heuristic
  • Floor change penalties (10x cost)
  • 8-directional movement
  • Stair traversal support
  • Time Complexity: O((V + E) log V)
  • Space Complexity: O(V)

Dijkstra's Algorithm

// Guaranteed shortest path without heuristic
findPathDijkstra(start: Position, goal: Position, buildingMap: number[][][])

Features:

  • Uniform cost search
  • Optimal path guarantee
  • No heuristic bias
  • Complete graph exploration
  • Time Complexity: O((V + E) log V)
  • Space Complexity: O(V)

Dynamic Re-routing

  • Continuous Monitoring: Check paths against fire spread
  • Automatic Recalculation: When fire blocks existing routes
  • Alternate Paths: Multiple route visualization
  • Real-time Updates: Continuous path validation

📊 Performance Comparison

Algorithm Performance

Algorithm Time Complexity Space Complexity Best For
A* O((V + E) log V) O(V) Heuristic-based optimal pathfinding
Dijkstra's O((V + E) log V) O(V) Guaranteed shortest path
RRT* O(n log n) O(n) Continuous space exploration

Prototype Comparison

Aspect Matplotlib Prototype Web Prototype
Technology Python + Matplotlib Angular + Three.js
Platform Desktop (Python) Web Browser
3D Visualization Matplotlib 3D Hardware-accelerated WebGL
Interactivity Mouse + Keyboard Full web interface
Deployment Local Python environment Web server / Cloud
Performance 30-60 FPS (CPU) 60+ FPS (GPU)
Scalability Up to 30×30×5 Up to 50×50×10

🚀 Getting Started

Prerequisites

  • Python 3.7+ (for matplotlib prototype)
  • Node.js 18+ (for web prototype)
  • Modern Browser (Chrome 90+, Firefox 88+, Safari 14+)

Quick Setup

Matplotlib Prototype

cd matplotlib_prototype
pip install -r requirements.txt
python src/main.py

Web Prototype

cd web_prototype
npm install
npm start
# Open http://localhost:4200

Automated Setup

# Run the setup script for both prototypes
chmod +x setup_and_demo.sh
./setup_and_demo.sh

🎮 Usage Examples

Scenario 1: Ground Floor Fire

  • Fire starts on ground floor
  • People on upper floors must use stairs
  • Tests vertical evacuation paths

Scenario 2: Stairwell Fire

  • Fire blocks main stairwell
  • Forces use of alternate routes
  • Tests dynamic re-routing

Scenario 3: Multiple Fires

  • Multiple fire sources
  • Complex path planning required
  • Tests algorithm robustness

🔧 Customization Options

Building Parameters

# Matplotlib Prototype
building = Building(width=30, height=30, floors=5)

# Web Prototype
buildingConfig = {
  width: 30,
  height: 30,
  floors: 5
}

Fire Spread Rate

# Matplotlib Prototype
building.fire_spread_rate = 0.2  # 20% chance per timestep

# Web Prototype
fireSpreadRate: 0.2  // 20% chance per timestep

Animation Speed

# Matplotlib Prototype
animation = visualizer.animate_simulation(interval=500)  # 500ms per frame

# Web Prototype
simulationSpeed: 1000  // 1000ms per step

📈 Analysis Features

Algorithm Comparison

  • Execution Time: Millisecond precision timing
  • Path Length: Total distance of evacuation route
  • Floor Changes: Number of times path changes floors
  • Success Rate: Percentage of successful evacuations
  • Memory Usage: Algorithm memory consumption

Test Scenarios

  • Predefined Scenarios: Common evacuation situations
  • Custom Scenarios: User-defined fire and person positions
  • Stress Testing: Large buildings and complex layouts
  • Performance Benchmarking: Consistent testing conditions

Statistical Reports

  • Comparative Analysis: Side-by-side algorithm performance
  • Trend Analysis: Performance across different scenarios
  • Export Capabilities: Save results for further analysis
  • Visual Charts: Interactive performance visualizations

🛠️ Development & Architecture

Code Organization

  • Modular Design: Separate concerns for algorithms, simulation, and visualization
  • Service Architecture: Angular services for state management
  • Reactive Programming: RxJS observables for real-time updates
  • Type Safety: TypeScript for web prototype, type hints for Python

Testing Strategy

  • Unit Tests: Individual algorithm testing
  • Integration Tests: End-to-end simulation testing
  • Performance Tests: Algorithm benchmarking
  • User Acceptance: Interactive testing scenarios

Deployment Options

  • Matplotlib Prototype: Local Python installation, Docker container, executable bundle
  • Web Prototype: Static web hosting, CDN distribution, Progressive Web App (PWA)

🎯 Domain Application

Real-world Use Cases

  • Building Safety: Emergency evacuation planning
  • Fire Safety Training: Interactive training scenarios
  • Architectural Design: Building layout optimization
  • Emergency Response: Real-time evacuation guidance
  • Research & Education: Algorithm performance analysis

Industry Applications

  • Construction: Building code compliance
  • Facility Management: Emergency preparedness
  • Urban Planning: Large-scale evacuation planning
  • Gaming: AI pathfinding for game development
  • Robotics: Autonomous navigation systems

🔮 Future Enhancements

Planned Features

  • Machine Learning: AI-powered path optimization
  • VR/AR Support: Immersive visualization
  • Multi-agent Simulation: Crowd behavior modeling
  • Real-time Data: Integration with building sensors
  • Mobile Apps: Native mobile applications

Technical Improvements

  • WebAssembly: Performance optimization for web prototype
  • Cloud Computing: Distributed simulation processing
  • Real-time Collaboration: Multi-user simulation
  • Advanced Graphics: Ray tracing and advanced lighting
  • API Integration: Building management system integration

📚 Documentation & Resources

Project Documentation

  • Main README: Project overview and quick start
  • Prototype READMEs: Detailed setup and usage guides
  • API Documentation: Code documentation and examples
  • Performance Analysis: Algorithm comparison reports

External Resources

  • Pathfinding Algorithms: Academic papers and implementations
  • 3D Visualization: Three.js and Matplotlib documentation
  • Building Safety: Emergency evacuation standards
  • Performance Optimization: Web and Python optimization techniques

🤝 Contributing

Development Guidelines

  • Code Style: Follow language-specific conventions
  • Testing: Maintain comprehensive test coverage
  • Documentation: Keep documentation up to date
  • Performance: Monitor and optimize performance

Project Structure

  • Feature Branches: Develop new features in separate branches
  • Pull Requests: Code review process for all changes
  • Continuous Integration: Automated testing and deployment
  • Version Control: Semantic versioning for releases

📄 License & Acknowledgments

License

This project is open source and available under the MIT License.

Acknowledgments

  • Academic Research: Based on pathfinding algorithm research
  • Open Source Libraries: Matplotlib, Three.js, Angular, NumPy
  • Building Safety Standards: Emergency evacuation guidelines
  • Community Contributions: Feedback and suggestions from users

This comprehensive summary covers the complete Building Evacuation System project, including both prototypes, their features, architecture, and implementation details. The project demonstrates advanced pathfinding algorithms in a real-world emergency evacuation context with modern 3D visualization techniques.