A programming challenge for dispatching elevators. If you've ever waited for an elevator and thought about how much sorter the wait would be if you were the programmer, give this a try.
This very simplistic implementation attempts to do just two things:
- Always choose the elevator car with the fewest queued destinations.
- Never push a destination onto the queue if it's already there.
When ran against their examples it's clear that the first elevator is constantly working hard while the remaining elevators sit mostly idle. A naive round-robin approach might work better than attempting to identify nearly-idle elevators.