by omoikane · 3y ago · 0 comments
Simple example: the single elevator in a building is empty and heading up to the 10th floor to pick up people heading down. If there’s a button press “I want to go up” on floor 3 while the elevator passes floor 2, should the elevator stop at floor 3 to pick up passengers? Probably not, as the passengers might want to go to the 20th floor, and it would be unfair to those on the 10th floor for the elevator to go up to the 20th floor before picking them up.
(corollary: if you see an elevator going in the direction you want to go pass the floor you’re waiting on, that’s not necessarily a bug in the scheduler)
If, on the other hand, there’s a button press “bring me to the 10th floor”, the elevator could stop at floor 3, pick up passengers, drop them off at the 10th floor, pick up those waiting there and go down. That means those waiting on floor 10 have to wait a bit longer for the extra stop on floor 3, but efficiency in #persons/hour or #person-floors/hour goes up.
1. it should always stop if it's going in the direction you want to go.
2. All people inside the elevator must be dropped off before changing direction
I guess that may be because it would require the elevator to inform the passengers “we’re at floor ten now. Everybody for floors ten and up, get out”, _and_ the passengers would have to hear that _and_ they would have to listen. It also may mean some floors sometimes get too busy with waiting passengers.
It's not that hard. One creates a cost function for each floor. The cost for a floor is the time spent since the button for that floor was pushed. The elevator goes for the floor with the highest cost.
It's the same idea with traffic lights. Have a cost function which is the wait time for each car. Minimize it. Of course, traffic lights never do this, resulting in grossly inefficient light changes.