You walk to the elevator, you hit the Up button, and you wait. And you wait. And...you wait.

There really is a good reason the lift keeps rising away from you. And it’s not karmic payback for never returning your neighbor’s pruning shears. With every press of a button, we’ve given our elevators a doozy of a computational challenge. The elevator system must decide which car to send for you, and when. It must choose whether to go up from the fifth floor to collect those people on the seventh before coming down to the lobby to answer your call. It must consider who’s been waiting longer, and which of the many paths is the most efficient and least painful for everybody. Elevator traffic is an elaborate, delicate dance, and once you see the steps, you can’t help but tip your hat to the engineers who choreograph it all.

Elevator routing wasn’t always so complex. The earliest electric elevators were controlled by human operators. An attendant standing inside would drive the lift up and down with a throttle of sorts, stopping wherever he or a dispatcher saw a waiting passenger. But humans proved to be clumsy, expensive, and prone to strikes. By the 1950s, electrical switches took over.

1926 Otis elevator installation; two still in operation in New York City at 1212 Fifth Avenue. Wikimedia Commons

For elevators to direct themselves, engineers had to spell out rules for when to go where. The simplest method was for the elevators to shuttle back and forth between predefined floors at scheduled intervals. It was like taking a bus; you waited for the 3:10 car up to the 10th floor, and then found your way from there. This, of course, was grossly inefficient. During busy times of day, the elevator cabs would waste everyone’s time sitting at a floor until their scheduled departure. During off-peak hours they would make pointless empty trips.

“A lot happens when you push that button.”

By 1965, lift engineers settled on the model we all know and love and sometimes hate: Passengers push buttons to call elevators, and the elevators respond to these requests. But here it gets tricky. As requests to different parts of a building pile up, how does an elevator decide where to go?



Pain Index

What is the perfect elevator system? Does it serve the person who’s been waiting the longest? Or always go to the closest call? Where does it make the compromise between speedy service and keeping energy usage down?

Elevator engineers grapple with all these questions, and none of them are as simple as they seem. Clearly, an elevator should try to reduce travel time. But how should it prioritize your time? If you wait a minute instead of 20 seconds for a car to come, is that three times as bad, or perhaps six or even nine times worse? Even the most basic of these goals isn’t a given.

Sometimes, it’s actually better to make a passenger’s ride longer. Imagine two scenarios, one in which your elevator takes 10 seconds to arrive and then one minute to reach your destination, and another in which each portion takes 30 seconds. Many people find waiting so painful that they’d prefer the first option, even though they’d reach their destination 10 seconds later. Accordingly, some elevators optimize not for time, but for a customized pain index, in which the computer system weighs the awfulness of each kind of delay.

Eleni Dimou

Further complicating matters are an elevator’s many constraints. It has physical limits on its speed, and it has only a second or two to choose its next move. It also shouldn’t do anything that will seriously piss off passengers, like bypassing someone’s desired floor without stopping, which is just asking for a fist in the control panel. A good system will balance all these goals and worries, even when you needed to be upstairs 10 minutes ago.

The Elevator Algorithm

The earliest and simplest reasonable approach to elevator dispatching is still surprisingly common. Known as “collective control,” or simply “the elevator algorithm,” it consists of two rules:

As long as there’s someone inside or ahead of the elevator who wants to go in the current direction, keep heading in that direction. Once the elevator has exhausted the requests in its current direction, switch directions if there’s a request in the other direction. Otherwise, stop and wait for a call.

This is why your typical elevator bay has call buttons for up and down: so the car that’s already heading skyward can stop to collect anybody who’s going up. This policy doesn’t account for most of the factors mentioned earlier, but it’s not a bad place to start. The elevator algorithm is easy to follow and fairly energy-efficient, and everyone gets an elevator within one round-trip. (The very same algorithm controls the read-and-write head on many hard drives.)



A lift-shaft viewed through the top of an elevator with a glass ceiling in a newly constructed skyscraper, The Leadenhall Building, on September 9, 2014 in London, England. Getty Images

Small office and apartment buildings, which don’t need to squeeze every bit of efficiency out of their elevators, tend to use this simple approach. In larger buildings, though, collective control starts to cause problems. The elevator services the middle floors each time it passes by, but it’s never going to stop by the basement on its way to floor 7. So the wait at the very top and very bottom, the areas most in need of elevators, can be a nightmare.

This content is imported from YouTube. You may be able to find the same content in another format, or you may be able to find more information, at their web site.

More importantly, large buildings usually have banks of elevators, not just one. If each follows the elevator algorithm, then under heavy traffic, the elevators start leapfrogging each other a few floors at a time. And they bunch up in the middle of the building, potentially even serving the same calls twice.

To handle these larger setups, engineers developed a slew of tricks. Just having the lifts talking to each other goes a long way. If Car 1 is headed up, Car 2 can instead handle a lobby request. Furthermore, lifts can be assigned to specific clusters of floors. You also may have seen elevators hanging out in a lobby, doors wide open. This is the parking strategy, where idle elevators return to a commonly requested floor. Thanks to traffic prediction and real-time monitoring, the elevators can switch between strategies to adapt to the morning or close-of-business rush.



Computing Complexity

The coup that really carried elevator programming up a few floors happened in the 1970s, when reprogrammable computers came on the scene. If someone had a new elevator routing strategy, they no longer needed to sell a mogul on the idea and wait for a building to go up. Instead, they could test and fine-tune their ideas in software simulations.

“Does it serve the person who’s been waiting the longest? Or always go to the closest call?”

A flurry of new algorithms hit the shafts. One strategy, still popular today, is called “estimated time of arrival control.” Basically, the computer considers all cars moving toward a call and assigns the one it thinks will get there the fastest. Another favorite was to always hand the most urgent call to the car predicted to create the best outcome for that passenger: minimize journey time, use the least energy, or whatever else the designers prioritized. The apex of the computerized control is destination dispatch, which you can experience if you visit skyscrapers built or modernized since the 1990s. In these buildings, rather than simply pressing up or down, you enter what floor you want to go to, and it tells you which elevator will come to take you there.

For this destination dispatch system, enter your floor on the keypad outside the elevator bank, and it will direct you to the fastest lift. Joshua Wolff

Because they know exactly where you’re going, these systems edge closer to perfect efficiency. People headed to the same floor are bunched together, turning each elevator into an express train. As such, you might then have to wait longer for a lift, so destination dispatch systems often shift their priorities depending on the time of day. During the morning rush, when net capacity is key, you’ll suffer more of a wait so the system can reduce overall trip times. In the afternoon, when fewer people are riding at the same time, they can afford to collect you sooner to reduce the mental anguish of waiting.

With all of these strategy options, engineers are faced with a new problem of choosing the best algorithm. One of the most successful approaches has been to let a computer decide. Using machine learning techniques, engineers can specify what success looks like, then let the elevator controller experiment on its own in simulation. At each moment, the system inspects the state of each simulated elevator and the parameters of each outstanding request, decides what to do, and measures the results. The software eventually learns a policy for each combination of factors. With these more sophisticated policies, even the people who built the software often don’t know why it’s doing what it’s doing.

This article was originally published on May 25, 2016. It's been updated for its publication in the September 2019 issue of Popular Mechanics. You can subscribe here.