why would an elevator ever make the long journey for the 10th floor to pick up passengers if it always has passengers waiting to move between doors 2 and 3?
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.
Comments
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.