Various elevator algorithms complete with a passenger load simulator and activity monitor for measuring efficiency.
- Decide which algorithm you want to run (details below):
- Independent
- Call the associated script. For example,
npm run independent
npm test
will run all unit tests.
One of the primary curiosities of this project is to write and evaluate the efficiencies of various algorithms that control elevators. In this context, efficiency means reducing both the amount of time a passenger must wait to board an elevator and how long they must be inside the elevator.
This algorithm was the first and it's not at all optimised. In this implementation each elevator operates completely independently with no consideration for the state of the other elevators. This causes all elevators to respond to a single passenger, which is one of the main behaviours that will improve efficiency in other algorithms. Perhaps a coordinator or shared queue would be more efficient. That said, this does work and the tests pass.
Building
elevatorCount
numberOfLevels
numberOfSublevels
Elevator
id
floor
direction
doorsOpen
Passenger
source
destination
inElevator
(0
while not inside or the id of the elevator once inside)waitTime
travelTime