A Python-based simulation of an advanced elevator scheduling system. This project uses a hill climbing algorithm, guided by heuristics, to minimize passenger wait times and is visualized in real-time with Pygame.
The system visualizes elevator movements, hall calls, and passenger destinations in real-time, providing clear insight into the algorithm's performance.
A snapshot of the terminal for user input and the Pygame window visualizing the state of 3 elevators in a 15-floor building.
- Hill Climbing Algorithm: Employs a local search strategy to continuously refine and optimize the elevator schedules in real-time.
- Heuristic-Driven Decisions: Uses a robust heuristic function based on distance, direction, and load to guide the optimization process.
- Real-Time Visualization: Built with Pygame to provide a live, intuitive graphical representation of elevator states.
- Dynamic Request Handling: Efficiently manages real-time passenger requests and adapts schedules on the fly.
- Proven Performance: Significantly reduces average waiting time, elevator idle time, and energy waste compared to traditional systems.
Traditional elevator systems are inefficient in modern buildings, leading to:
- Long Wait Times: Average waits often exceed 18 seconds during peak hours.
- Inefficient Pathing: Simple algorithms get trapped in suboptimal solutions.
- High Energy Waste: Unoptimized systems can have up to 70% redundant movements.
- Poor Adaptability: Static algorithms fail to handle unpredictable peak traffic.
The core of this system is a Hill Climbing algorithm. This local search method iteratively improves the current elevator schedule by making incremental changes.
The algorithm's search is guided by a heuristic evaluation function which scores potential schedules. This function considers multiple factors to determine the most efficient state:
- Distance-Based Selection: Assigns the closest elevator to a new request.
- Directional Preference: Prioritizes elevators already moving in the request's direction.
- Load Balancing: Distributes requests evenly to prevent bottlenecks.
At each step, the algorithm explores neighboring solutions (e.g., by reordering requests) and moves to the state with the best heuristic score, effectively "climbing the hill" towards an optimal schedule.
- Language: Python 3
- Visualization: Pygame
- Data Structures:
heapq(for priority queues) - Concurrency:
threading
- Python 3.x
- pip
- Clone the repository:
git clone https://github.com/your-username/elevator-scheduling-system.git cd elevator-scheduling-system - Install dependencies:
pip install pygame
- Run the simulation:
python "Elevator Scheduling (2).py" - Interact:
- Enter the number of floors and elevators in the terminal.
- Enter a source and destination floor (e.g.,
5 12) to create a request. - Watch the simulation in the Pygame window.
Our optimized system shows significant improvements over traditional models.
| Metric | Traditional System | Split-Floor System | Optimized System | Improvement |
|---|---|---|---|---|
| Avg. Waiting Time | 18.6 sec | 12.5 sec | 8.2 sec | ↓ 55.91% |
| Elevator Idle Time | 220 sec | 160 sec | 105 sec | ↓ 52.27% |
| Energy Wasted | High | Moderate | Low | ↓ ~70% |
| Request Throughput | 30 req/10 min | 40 req/10 min | 50 req/10 min | ↑ 66.67% |
| Unnecessary Reversals | Frequent | Reduced | Rare | ↓ ~90% |
This project is licensed under the MIT License.