Where Should I Stand When Waiting For Elevators
2017-11-12
Introduction
Elevator scheduling does not depend on where people stand. You pushed the button
on one side, then "ding! ", a flashing green light on the other end means you will
have to walk. People would just stand in random positions hoping elevators will hit
their guesses. However randomness is not our best friend, and here I am proposing a
scientific way to decide where you should stand while waiting for elevators.
If you do not like theories, you may skip the rest and go to the code (to be added) now.
If you do not like codes as well, that is all I have for you and you may now click wherever
the little cross is to close this tab. Thank you.
The Math
Suppose we have elevators, lined up on one side, in the lobby in total. Let be a random
variable of categorical distribution with classes numbered from 1 to , with a probability vector ,
records prior information with
is the vector of hyperparameters. Suppose we have a flat Dirichlet distribution to begin with, that is, .
Suppose we have a historical record of arrival count for all elevators. Let it be , we would update the prior distribution using
Then the probability of elevator arrives for you is expected to be
where is total number of historical arrivals.
Suppose is a representation of where you should stand. For example, can mean you should stand at the
very left of the lobby and would then mean you should stand right in the middle of the lobby, and so on. And the elevators
are spaced equally in the lobby. We want to minize the expected walking distance from where you are standing to the arriving elevator,
by solving following optimization problem,
Of course this will blow up if there is only one elevator and you want to know where you should f***ing stand. To solve, let
The equivalent LP will be,
And this can be easily solved, for example, using interior point method.
To Be Added
- The case where both sides have elevators in the lobby.
- The case where you are floating in the air in the center of a spherical lobby, and elevators , or better, the teleports, are locating on the surface of the sphere.
- I used expectations, but we have much more in the posterior. Optimization can be done instead with probabilistic variables directly.
© The Responsible Adult 2017 - 2025