What is the best rest position for two elevators in a 10-story building?
In general, elevator scheduling is a seriously difficult problem (see, e.g., this presentation and its list of references for some idea of its complexity). Your example situation starts to get at why it's hard: in order to know how often this happens, you need to know how quickly the elevator travels, relative to how often people arrive. And once it happens, maybe it would be better to dispatch the 10th-floor elevator, but maybe the 1st-floor elevator will do its thing fairly quickly and you should just wait for it to be done. In order to answer these kinds of questions, you need lots of data about your apartment's specific situation; a theoretical answer based on a few assumptions isn't going to get you anywhere useful.
But the hard part is determining what to do when the elevators are busy. You're asking about which floors you want the elevators to rest on, which is something that only matters when they are not particularly busy. And in that case, along with your assumptions, we can come up with something tractable.
So, in addition to the assumptions you made, I will also assume that:
- Only one person wants to use the elevator at a time, so the elevators are always on their resting floors when someone wants to use them.
- Elevators move from floor to floor at constant speed, so a passenger's wait time is proportional to the distance to the closest elevator. (This assumption could be removed and it wouldn't make the problem much more difficult, but it's hard to know what to replace it with.)
Additionally, unless we are in a certain classic mathematician joke, your assumptions imply that a passenger will want to go up or down with equal probability.
This is enough to solve the problem. We take a representative population consisting of one person on each higher floor wanting to go down, and 9 people on the ground floor wanting to go up. Over this population, we minimize the total waiting time; i.e., the total distance to the closest elevator. The following simple python script does this for each possible elevator configuration, and then tells you which one is best:
least_wait_time = float('inf')
passengers = [1 for i in range(0, 9)] + range(2, 11)
def wait_time(passenger, elevator1, elevator2):
return min(abs(passenger - elevator1), abs(passenger - elevator2))
for high_elevator in range(2, 11):
for low_elevator in range(1, high_elevator):
total_wait_time = sum(wait_time(passenger, low_elevator, high_elevator)
for passenger in passengers)
print 'Elevator positions: ' + str((low_elevator, high_elevator))
print 'Total wait time: ' + str(total_wait_time)
if total_wait_time < least_wait_time:
best_elevators = (low_elevator, high_elevator)
least_wait_time = total_wait_time
print ''
print 'Optimal elevator position: ' + str(best_elevators)
print 'Optimal wait time: ' + str(least_wait_time)
It turns out that the optimal thing to do, given all these assumptions, is to put one elevator on floor 1 and the other one on floor 7. This gives a total wait time of 15 (i.e., over the population of 18 people, the nearest elevator will on average start 15/18 floors away).
Why is this different from your result? Because we're not assuming the elevator on floor 1 is used solely to go up. If someone wants to come down from floor 2 or 3, the 1st-floor elevator is already closer to them than the higher-up elevator even when the higher elevator is at floor 6, so it's not useful to keep the higher elevator close to them. So we might as well move the higher elevator up a bit to keep the people on really high floors happy.
Your model concerns the "low frequency mode" of the elevators: The building is $n\geq1$ stories high, whereby the floors are numbered from $0$ to $n$. The elevators are at rest at floors $r$ and $s$ with $0\leq r<s\leq n$, and are waiting for the next customer. This customer will arrive with probability ${1\over2}$ at floor $0$, and with probability ${1\over2n}$ each at one of the floors $k\in[n]$. The expected waiting time of this customer then is $$E(r,s)={1\over2} r+{1\over2n}\sum_{k=1}^r(r-k)+{1\over2n}\sum_{k=r+1}^{s-1}\min\{k-r,s-k\}+{1\over2n}\sum_{k=s}^n(k-s)\ .$$ In your case $n=9$. Use your spreadsheet power to compute the minimal $E(r,s)$. In any case the lower elevator should not be reserved for customers wanting to go upwards.