<- Back
Comments (380)
- theodorejbThe worst situation I've encountered is after a large conference when everyone is leaving the hotel at once. An elevator quickly fills up on the way down, but then wastes time stopping at every subsequent floor with a call, even though no one else can fit inside. At each floor the elevator stops, the doors open, the waiting people see it's already packed, the doors close, and this repeats on the next 15 floors before finally reaching the bottom where everyone gets off. If the algorithm could know an elevator is completely full and only stop at its destination floors rather than every floor along the way with a call, it would be far more efficient.
- peterldownsBack in highschool, simulating different elevator algorithms was one of the projects I implemented during my CS class. It wasn't for the class — AP CS did not require anything like actual programming — but it was a fun project.A cool connection is that a spinning-disk hard drive (HDD) is actually kind of like one really long elevator, just wrapped around a spindle instead of perfectly vertical. The SCAN algorithm is actually a disk-scheduling algorithm!https://en.wikipedia.org/wiki/Elevator_algorithm
- omoikane> Destination Dispatch [...] are in general worseI wonder if this is an artifact of how the author used random destinations. I worked in a building that used Destination Dispatch, and the common travel pattern seemed to be:- Everyone who is not on the ground floor generally want to go to the ground floor.- People who are on the ground floor generally travel in large groups to the same destination.This happens because people who worked on the same floor often leave for lunch at the same time, and return at the same time to the same floor. Destination Dispatch helps in this case because it's batching large groups of people with the same destination.
- brandonpelfreyFor folks that have never seen elevator scheduling the game: https://play.elevatorsaga.com/ Enjoy this rabbit hole :D
- woehI am currently staying in an AirBnB of a 60 floor tower, and the three elevator shafts definitely cannot handle this (I don't think the building was designed with renting to tourists in mind). The elevators are frequently completely saturated during weekends, meaning that the elevator stops at each floor, but noone can get in because the elevator is already full. This means the backlog of people wanting to use the elevators is increasing until after rush hour, and I have at one time experienced a waiting time of over half an hour.What I take from this is, elevators need a proper check to see if they are full, and if so skip floors.
- hermanschaafHah, I thought a lot about this problem while developing Sky Lobby, a mobile game (iOS / Android) about controlling and automating elevators.In the game, some of the elevators are automated, and I wanted to choose an algorithm that best aligned with what players would expect an elevator to do. I ended up going with something close to LOOK, which (as the article states) is mostly what people expect. Except in case of ambiguity, I had it prioritise floors that have been waiting longer, to improve the p90, which is important in the game.But now, add in these challenges:- double-deck cabs (where attached cabs cover two floors at once)- transfer floors between shafts- express shaftsand the best (or at least, most expected) algorithm becomes much less obvious! I'll leave it as an exercise for the reader to figure out the best one.Luckily I was in charge of a game, not a real elevator system, so I just had to find a heuristic that was good-enough, and could tweak the rules to let players manually override the elevator's plan if they don't like where it's going. This seems to have satisfied most players.
- olexThe biggest problem I always have with elevators is not the algorithm, it's the people seemingly being unable to grasp the concept of pressing either the up or the down request button, depending on where they want to go. Almost always I find someone will press both, because "then the elevator comes faster". Completely ignoring the fact that they end up going the wrong way first half the time, and adding an unnecessary halt for everyone already in there. How hard can it be to understand?..
- dsegoIn my residential building we have two elevators, a big one and a small one, the small one can fit 3-4 people if they squeeze together, it can't fit a bicycle. And of course, they don't work independently, so if the small one is already on your floor the big one won't stop there, so if I have my bicycle with me, I need to send the small one to a higher floor first, and since people are using the lifts constantly, sometimes I need to wait for a while and repeat the same process. There were times where the small car came several times before I managed to stop the large one.
- grishkaHow often do people travel between non-ground floors though? In my own experience, whether it's a residential or an office building, 99% of elevator usage is a) someone going down to the ground floor, and b) someone going up from the ground floor. There are some exceptions like hotels that have amenities on different floors though.The first elevator "algorithm", if you can even call it that, that I've ever encountered and that seems intuitive to me, is what Soviet relay logic elevators did. If it's not in use and someone calls it, it goes there. If it's in use, it will collect the calls on its way down (and ignore them on the way up, these had no up/down call buttons). It's surprisingly effective for apartment buildings.
- psadriAside for the algorithms and how well they work, there is a psychological aspect to how people perceive "wait" times. It turns out just waiting is very annoying. But having people do anything during that same wait period → perceived as progress → not upset.An example iirc was waiting for luggage at the airport. It takes min of x minutes for the first bags to show. In one version, passengers went directly from the gate to the luggage carousel and waited x mins for the first bag → unhappy. Then the airport decided to add a long, round-about "walk" path from the gate to the luggage area that burned some of those minutes → same total "wait" but happier passengers.
- orliesaurusOh my god, every time I'm waiting for the elevator, I think of how annoying it must be to be someone who's building the algorithm to make sure that you minimize the amount of wait times between picking up people and taking them to their destination. Then I also wonder if the people who apply the logic and program the logic into the elevators are actually evil sadists that are doing it on purpose to make us wait longer enough and suffer a little extra.
- sorzI just come back from a furry con hosted in hotel in China, and learn how every furry con like this completely break hotel's elevators:- rooms are all booked- young furries usually share one room with 4 or even up to 6 friends- more guest room-lobby-ballroom traffic- far more inter-guest-floor traffic than their usual tourists- one full-suit furry take 1.5-2 human's spaceTheir elevators are not designed for this scenario and got overloaded all the day. Queueing for tens of minutes is not uncommon.
- geephrohSlightly OT, but this reminded me of Colson Whitehead's _The Intuitionist_[1], an amazing speculative mystery novel about two dueling schools of elevator inspection philosophies: the Empiricists and the Intuitionists.1. https://en.wikipedia.org/wiki/The_Intuitionist
- MostlyStableGiven that there is already a simulation, with very clear performance metrics, I wonder if anyone has ever tried making an evolutionary algorithm and if so, how well it would perform. Do we have any idea of how a theoretically perfect algorithm would perform? How much theoretical performance is there to be picked up?
- WowfunhappyAll I want to know is why the heck I can't un-press a button I pressed by accident. This should be very simple. Press once to turn the button on, press again to turn it off.Or I guess you could do long-press to turn off or something if you're worried about confusing people, but I really don't think that should be necessary. We know how toggles work. The button lights up when it's on.
- dperfectDestination dispatch should be no worse than standard up/down buttons, right (at least in theory)? It provides additional information about the destination, but it should be possible for that information to be interpreted as if it were just an up/down button press, so RSR could still be used. I have a feeling a better algorithm could in fact make destination dispatch slightly better than RSR... or am I missing something?Of course, user error is also a factor, so this isn't accounting for people not understanding how to use it and making things worse that way.
- taftsterIn these various elevator algorithms, it's not commonly discussed the overall wear and tear on the elevator. More movements would typically translate to faster repair times. Hydraulic fluids needing to be replaced, parts breaking, etc.Efficient elevator algorithms will often suggest moving an elevator into a preempted positioning strategy, based on time of day or peer elevator positions. The scheduler might move an elevator up to offset one coming down, for example. The demand-signal algorithms at least minimize movement in this way.I think minimizing maintenance at the cost of increasing wait times is probably an important balance to get right. No doubt, the cost owners for maintenance are not going to perceive the wait time of passengers to be as important.
- pavlovOne of the best-loved Maxis games of the 1990s was SimTower which was all about designing elevator flows for your skyscraper.It might be fun to revisit. The game was actually of Japanese origin.The Digital Antiquarian just wrote about it the other week:https://www.filfre.net/2026/07/the-life-and-times-of-maxis-p...(Part of an ongoing multi-part Maxis article, SimTower is halfway down in this part 2.)The origin story:”As Yoot Saito would be the first to tell you, the rest of the game was really born out of his odd fascination with elevator systems.> ’Late one night, I was waiting in my building’s lobby for an elevator. There are two cars in my building’s shaft. I pushed the button, but instead of the closest car coming to my floor, the farthest car arrived first. In my usual questioning way, I asked myself, “What happened here? How are these cars logically synchronized?” That was the beginning of SimTower.’
- ladbergOne elevator feature I specifically noticed at Apple Park but haven't seen anywhere else: elevator prefetching to the ground floor.I.e. in a bank of 2 elevators where one is resting on ground and the other is resting on a different floor, as soon as someone calls the ground elevator (which is already there and immediately opens) the other elevator (if idle) will move to the ground floor so that there's no delay the next time someone calls one from the ground floor.
- WaterluvianMakes me want to play Sim Tower again.There’s something so satisfying about watching a machine just dutifully work through queued tasks like this.
- duderificWe used to do this as an interview question at my current job. We didn't expect people to solve it necessarily, and we just specified to solve for a single elevator car. We just wanted to see how people would break down the problem.Even at that relatively reduced level of complexity, it's quite tricky to figure out how to prioritize who gets served when.
- airbreatherGreat article.Where I live, on the taller buildings it is common to have banks of elevators which only service certain floors, eg floors 2:25 and 26-50 are two different banks of elevators.Some modern elevators have two cars per shaft, imagine scheduling that.
- gregorvandAmazing article and demos thank you. I’ve also been fascinated by what algorithms are driving elevators.As someone often using destination dispatch, I am inclined to think after the elevator arrives, you get to the destination more quickly than RSR or LOOK because it’s optimised everyone to the same floor (less stopping)So it may be a case of more waiting in the lobby but less in a claustrophobic box, which I’ll happily take
- pseudosudoerThis is commonly referred to as the "dial-a-ride" problem, which is an optimization problem with a multi-variate cost. Back in college for my senior design project we built a multi-axis closed loop servo system which would emulate a slide guitar. The dial-a-ride problem is identical to optimizing travel for a string of notes/chords.
- vova_hn2> What if the nearest car is full?I wonder how do elevators find out if the car is full or not.I once been to an office building where it obviously didn't work properly.I needed to get down from a pretty high (15+) floor to the bottom during the evening rush.The elevator got full immediately but still stopped almost on every floor on the way down.Each time an awkward scene ensued: a huge crowd of people outside elevator just standing and looking at the crowd in the elevator. Everyone has to just wait pointlessly.
- pwythonI was on a Royal Caribbean ship a couple weeks ago (Utopia, 18 decks, 5,668 passengers). It has 24 main elevators split between front and back, left and right. So a bank of 6 in front of you each time you needed a lift. You press your floor on a touchpad and it assigns you an elevator A through F.I swear no matter if it was busy or not, it seemed like everyone was assigned to the same one or two elevators. The wait was always so long too, I used the stairs most of the time if just going <6 flights.Someone besides RCCL needs to study that algorithm.
- NikxDaMy biggest issue with elevators is that some places and hotels I‘ve been to use disconnected systems:They have three elevators, but pressing one button only calls that specific elevator. So everyone presses all three buttons, meaning the three elevators basically turn into one.I don‘t understand how this was ever signed off, but I‘ve seen it multiple times now...
- altairprimeThis is pretty cool. OP+author, I wish that it was possible to gray out the elevators as the speed increases, so that their high-contrast "flashing" is reduced while still allowing their movement patterns to emerge. You could even go as far as to fade their color back in once they're standing still, so that the 'stop' locations in the LOOK vs RSR diagram become really clearly apparent, while the elevators' non-stop movement fades into the woodwork as orange dots travel endlessly in the left.I figure something like a simple weighted ratio of car color = { 1.0: car fg color, max(1,speed^0.1)-1: shaft bg color } would do, so that 2x only shifts the color 7% towards the background color, but 500x shifts the color 86% towards the background color — and a stationary elevator can fade in from 86% bgcolor to 0% bgcolor over a few ticks as it sits there.I recognize that for most of us, the flashing elevators blur into motion blur, but I can see individual frames at 120fps and while I am not seizure-sensitive to high-contrast flashing, I imagine those folks would appreciate you going the extra mile to reduce contrast at higher velocities, too.
- danfunkAI use in the creation of this article is inconsequential. There is obvious joy and high fidelity information here. Perhaps some vibe coding made the animations easier to develop, and made it possible to produce this in reasonable time. Who cares. Love of craft is evident. What more proof do you need that this is worthy of human attention?
- heironimusNo mention of an algorithm/sensor for checking capacity of the car. It's a pain when your elevator car shows, it's full, and your request is canceled, meaning you have to press again. Better if the car was full and just moved on.I can see how that could be challenging when people get off on intermediate floors, making a full car available again, changing status. And, if 3 people are waiting and there is room for 1, should it stop or not? Etc.My favorite takeaway from this is how simplicity often beats complexity.
- larrydagDiscrete event simulation frameworks, like SimPy, are a great mathematical way to simulate the environment if wanting to discover better methods of any methodoical staging flow. Elevator scheduling is one example that can be simulated.https://simpy.readthedocs.io/en/latest/
- oxag3nUser experience is not always correlated with metrics targeted by engineers.I visit a building sometimes with destination dispatch elevators, and with low exposure across multiple years I'm confused every time the elevator I need to take is open behind me.I once used the paternoster lift in Germany, beats any elevator algorithm efficiency because it's a non-stop "conveyor" with no doors. I still get nightmares about that elevator.
- BossieEvery time I enter an elevator, I wonder whether it will be the first one I've come across that supports deselect.
- ericmcerI used to access locked floors in my old office building by using these algos.Just ride to the floor I have access too, stay in while the doors close, and it would take me to a random floor. Push open door and voila I was on some random corporations private floor.
- teepoI've never really liked Destination Dispatch elevators. Besides struggling to find the car I've been assigned to, sometimes you really have to hustle across the lobby to catch it. Then you also run into visitors that assume it's a normal car and can hit a floor button when the get in, only to realize they've walked into a car without buttons.
- pbrumAwesome article. This being HN there must be a quibble right?:Missed opportunity to entitle it "Elevator Action"
- hahahaaLove the article.> The state of the world 30sec after you called your elevator might be very different but the system is unable to adapt. Turns out the loss in flexibility is not worth the extra information for the optimizer.Very interesting. I am on a 30 flr 8 car today so guess it made sense for Destination Dispatch. It does mean there is rarely a full elevator and usually 3 stops max allowing it to go fast to high floors.Other things I thought could factor in elevators is shopping trolleys: both customers and trolley collectors. One level will have people coming in with full trolleys and almost always the other levels will not. I don't think elevators really care they just fill up and you need to call another one.Also prams but they are 2-way.
- besilI currently work in one of the top global incumbent company in the elevator market in R&D software.I would have never thought there were so many challenges behind a car moving up & down.This industry is so niche and peculiar.Elevator trip scheduling is one of the many challenges. Really a great experience so far
- userbinatorIt's worth noting that for roughly half of the last century, elevators were entirely controlled by relays, with no computers at all; these algorithms would be implemented in hardwired logic. Look at Otis' old patents for some interesting details, including schematics.
- vivzkestrel- epic rap battles of history- john.fun vs neal.funnnnnnnnnnn- who woooon? you decide!!!!!!
- newswangerdI have an old iPhone SE and I want to give you kudos that the animations run buttery smooth on this page. There are a lot of websites where just the ads will cause my phone to completely freeze.
- jamiesThis is absolute catnip to me. Fantastic job to the author! It really scratches the itch of wanting to understand elevator dispatch algos!I want something similar for advanced sensor stop lights...I've long toyed with creating an elevator simulator game, but every time I build a prototype I realize it's not that fun to manually dispatch elevators, and playing with algos only goes so far! Elevator Saga is great for the programming side: https://play.elevatorsaga.com/
- ChuckMcMThe "Elevator Problem" (and the "Street Light Problem") were both CS 200 exercises when I was in college. Along with a bunch of other 'game' type systems like 8 queens, Hanoi towers, maze solving, etc. Still, that is the most elegant web widget I've ever seen that illustrates the options. If you're reading this John I'd love to hear how you wrote them.
- coop57You have no idea how excited I was to see this article today. I've long been fascinated with elevators and the algorithms that control them. Thank you!
- jp191919Reminds of something I haven't thought about in a very long time... SimTower
- krishna180An elevator that stops at every other floor is quite annoying. Someone pressed a button and then entered another elevator. just like in door, there shall be a sensor as well that will check if someone is waiting outside or not. if not, please pass that floor.
- stkniGreat analysis! I used to ask a fairly open ended elevator system design question for engineering interviews. There is a lot of mileage in this topic and everyone has an understanding of the basics so the setup costs for the question are minimal. Always generated a lot of interesting discussion.
- AuncheOur building installed destination dispatch system to their elevators and it seems to help overall. However, it breaks when say a team wants to get lunch together, but only one person presses the elevator button. The elevator thinks that it can keep on accepting new passengers so it stops at floors even though it's already full.
- pkstn
- perilunarIt's a pity that paternoster lifts are so unsafe [0] — we could avoid all problems to do with scheduling if they were safer.On a related note, could someone please design continuous spiral escalators with horizontal sections at each floor?0: https://en.wikipedia.org/wiki/Paternoster_lift#Safety
- vachinaAnybody knows what algorithm HITACHI is using on their elevators? Their elevators feels most “responsive” in high rises.
- abhaynayarI have destination dispatch at my office, and while I don't like my personal user-experience of it, I can't imagine what would better suit a building when you have so many elevators in the same place i.e. in my case 10+ I think?What I find annoying though is you clunkily go click a floor then clunkily wait then clunkily walk over to the elevator assigned which may or may not be on the other end of the space. Also another interesting thing I've seen is that it seems in my case the distance from destination selection and elevator assigned seems to reduce at times when the office is emptier so that too seems to def be accounted into the algorithm.
- reader9274I feel like most cases of wait times are due to elevators "waiting" empty in the wrong floor. They either all wait in the bottom floor, or all wait where they were last left at. Would be better if their waiting floors were distributed throughout the floors so that first response is fast.
- clarkmoodyOne of the most frustrating assignments[1] (2011) in my computer science education was trying to build a better mousetrap for elevator control.[1]: https://clarkmoody.com/Moody_AgentBasedElevatorControl.pdf
- efavdbI recently wrote an article about this problem, and detail one reasonable algo for minimizing wait time. (Doesn’t consider concept of cars being full though, interesting addition)https://jslandy.com/elevators/
- hotenElevatorpedia is a fun read. I particularly enjoy reading about service modes, such as the Sabbath service (hands-free operation).https://elevation.fandom.com/wiki/Sabbath_service_(SHO)
- rrvshYeah, intuitively the request floor instead of up-down paradigm always seemed inefficient. However, if the issue is that it forces a single elevator and doesn't allow reoptimisation, I wonder if there's a middle ground where instead of up down there's a button panel for the floors, but you still just take whatever elevator's going up? It technically wouldn't require double work but kind of feels like it does psychologically - anyone seen prior work on this?
- paxysMy biggest pet peeve is elevator banks where they don’t make some number of idle elevators automatically come back to the lobby. Half your traffic is over there! Everyone coming in has to wait an extra minute or two because all your elevators were chilling on the 35th floor and above.
- mr_wiglafMy first thought with optimizing the elevators was to optimize where the elevator went when it was empty. Surely sticking around at the top floor decreases avg wait times, no? I feel like I've been in buildings where the elevator returned to the lobby after use (but perhaps there was always another person waiting...)
- cushThis is a fun simulation to play with. One variable I appreciate in efficient elevators is how the doors work. Usually they don't let you press the button to open a closing door - effectively delaying an already departing car
- teglingOne case not covered, I believe I saw at London Heathrow was where 4 cars essentially moved people across only 2 floors. With only 1 centralized button, only 1-point-something car was effectively moving people on average, because people had to wait for the currently filled car to have its doors closed and starting to move, before hitting the button to call the next car to pick them up. Imaging 100-200 people in line and, often, overly eager would-be elevator passengers hitting the button too early. Thus leading to halting the just filled car and doing an additional full open and close doors cycle. Fun stuff!
- sambaumannThis reminds me of elevator saga (https://play.elevatorsaga.com/) - little programming game where you have to program elevator schedules.
- gwbas1c> Not all elevators have buttons in them. Some of the fancy new elevators have a kiosk on each floor that allows you to specify what floor you're heading to before the elevator even arrives. The kiosk then points you to which elevator you should wait for.I stayed in a hotel with these. It was horrible. Most people didn't figure it out, would get in the wrong elevator, and just get lost in the building.
- JoshTriplett> This counterintuitive result is all thanks to the rebalancing step where every 5 seconds, the system re-optimizes each elevator's path. The kiosk enforces rigidity, you must get in the assigned elevator.Sounds like destination dispatch would work better if it didn't tell you which elevator to get into until the elevator arrived.EDIT: already being discussed in the thread at https://news.ycombinator.com/item?id=49125423
- duncangh“The elevator did hear you, it just has a lot to think about”Didn’t anticipate that my day would be bookended by relating to and empathizing with the plight of the elevators while I wait for one in a tall corporate building.Pressed the kiosk some time ago but watching the sun begin to arc towards setting it does appear the world can change a lot in 30 seconds.
- agentultraSimulating Elevators in TLA+ is a fun exercise.https://github.com/tlaplus/Examples/blob/master/specificatio...Another interesting, and underrated one: hotel keys.
- jhaileFor a long time, this was one of my favorite interview questions - it is one of those problems that no candidate will ever fully solve, but you see how they think through problems. And it is a problem that seems simple at first but has layers of complexity that peel back like an onion - just like this article does.
- jihadjihadIn a similar vein, there was an interesting discussion [0] a while back about elevator buttons [1] and how timing for door close/open works, along with a bit of the history and regulations that go into them.0: https://news.ycombinator.com/item?id=351523411: https://computer.rip/2023-03-13-the-door-close-button.html
- jabroni_saladThis was fun to read and play with but I'd like to see it with different usage patterns, too.The simulator seems to have passengers spawning on a random floor and then transiting to a different random floor. But for where I work, the trips are pretty much always from the lobby to a floor, or from a floor to the lobby. Nobody goes inbetween floors except maybe the cleaners.
- bob1029Parking is a big factor too. Where you put the elevator when it is not being used can mean the difference between the doors opening instantly and worst case scenario.
- ryukopostingMy friend lives in a building with one of those super old elevators with the manual double doors and no queuing. It's the sort of elevator that someone probably got paid to operate once upon a time.Using such a primitive elevator gave me a newfound appreciation for the complexity of modern designs. The queueing algorithms are subtle but clever, and the difference in efficiency is instantly obvious once you've dealt with the alternative.
- ed_mercerElevators drive me crazy. One of the worst sins I've seen is an elevator that says, “Sorry to keep you waiting,” while continuing to hold the doors open for the entire sentence. Just be quiet and close the doors already.
- dansoOh wow, this is perfect reading for me. One of my first college career fair questions was "Tell me how you would program an elevator". Forgot what sad attempt at an answer I gave, but I pretty much thought about that algorithm every time I've ever waited for the elevator. Which was pretty much daily when living in NY.
- nhhvhyIf you feel like going down an elevator rabbithole, Deviant Ollam has quite a few talks/videos about all sorts of niche elevator stuff. My personal favorite: https://youtu.be/ZUvGfuLlZus
- niklasrdeI wonder how a TWIN system with 2 cars per shaft factors in here: https://www.tkelevator.com/us-en/products/elevators/all-elev...That will need planning and assignment I guess? But at what load figures does it become more efficient?
- Himanshu_942Finally someone looked at frustrating problem. What if lift manufacturers install all the algos and change the algo based on need?
- efieldsThis is like the how it’s made of a website. I could read and click through an endless amount of these kinds of explainers.
- ivanjermakovI don't think it was mentioned, but the algorithm would be different based on the behavior of the majority. In some buildings most traffic is either up from lobby or down to lobby, e.g. it's very rare for people to go from floor 5 to floor 6. In some it's the other way around, where majority of moves don't involve lobby.
- tuetuopayMeanwhile, the elevator at my apartment building: hey only one floor at a time can call me! And no queueing, you must wait for me to be idle for someone to call me. (And yes, often someone beats me and presses the butter faster than I can).
- FabHKWonder what would happen if the objective instead were to minimise sum of quadratic wait times (ie, penalise long waits explicitly).
- alightsoula lot of autistic people like trains or elevators
- tgsovlerkhgselIs there a comprehensive overview of a) multi-bank elevator algorithms that are out there, b) the config parameters that the elevator tech/company can set on an elevator system?For example, some elevators allow adjusting the door closing/opening speeds etc., I'd be curious what other things can be adjusted.
- frizlabI’m surprised to not see any reference to the Happy Vertical People Transporters from The Hitch Hiker’s Guide to the Galaxy!Them elevators are able to see into the future to be there even before we call them. Come on!
- baxtrI have never understood why it’s not possible to deselect a floor once you’ve pressed the button.
- jgrahamcIt also depends on the person understanding what the elevator button does: https://blog.jgc.org/2010/06/elevator-button-problem.html
- cyberrockVery cool. I would be curious how elevator banking (elevators split into different floor ranges) and double decker elevators impact this.
- randallsquaredIf you optimize for initial wait times, someone who is going to a floor not usually visited might effectively get trapped on an elevator which shuttles between more trafficked floors to reduce wait for elevators overall. Maybe this is very unlikely in practice.
- the_cosmosAhhh brings back memories of "Elevators from Hell" [1]Now maybe I can beat that game!1. https://www.dosgames.com/game/elevators-from-hell/
- andrewseanryanAs I step into an elevator, I often think about the algorithm that's driving it. Now I know what they are! Thanks!
- arm32My autism just went KABLAOW when seeing this. I know what I'm doing the next hour.
- ncr100Next time please add a cool potted plant that appears whenever you open a door, for the final full sim at the end of the article. Decorative plants for the win.I love this by the way.
- senthilnayagamwanted to create a lift simulator for a very long time, this looks pretty good.claude could recreate it in unity in about 10 minutes. now ticked it off my "want to code" bucket list.
- jhallenworldWhat this doesn't include: not all people are equal. Do you want the CEO of your new office building to have to wait behind a bunch of plebeians? At least one car is going to have to be reserved for the better people.
- nukerWhy not count people waiting on each floor? To add to the algo? A simple camera with basic computer vision will do.
- salbertsOur elevator (4 cars) displays above each car the planned stops and can change mid-wait the car<>floor allocation and issue sound indication. I’d expect it to be allow optimal allocation.
- hagen8Most importantly, after entering the elevator. First press the close button and then the floor. That way u, safe the time of pressing a button as the door is already closing.
- brudgersThe elevator rabbit hole:Deviant Ollam on Elevator Hacking https://youtu.be/ZUvGfuLlZus
- cruffle_duffleIf you like elevator hacking don’t forget the seminal DEF CON talk by Deviant Ollam and Howard Payne: https://youtu.be/oHf1vD5_b5II watch it like once a year because it always tickles some part of me. Like all the different modes you can get an elevator into. The most fancy one people might encounter is when moving into or out of a building. The front office can give you a key to give exclusive control over an elevator so your movers aren’t waiting around on elevators. Put it in that mode and it will stop responding to calls from other floors. Only the person with the key can control the elevator. You get on, select the floor, door closes elevator goes, and then just chills there with the door open waiting for you. Annoying for the rest if the building (the building is down an elevator when in that mode) but is amazing for the person using it! But there are way, way more depending on the installation and function.Fun fact: most elevator shafts are sealed at the top as tight as possible to prevent them from becoming a giant chimney in a fire. It never even occurred to me until I was in a mechanical room wondering “where is the hatch to look down the shaft?” The answer is “there is none, and it’s a feature not a bug.” You want to block all airflow so fire doesn’t chase up the shaft into neighboring floors. Who knew!
- zatkinI think a small improvement that could be made is to have the dot representing the person be colored the same as a dot on each floor, which would obviate the destination floor for each individual.
- mallory854Super interesting. I've always wondered how exactly they work.
- pavinjosephSurprised that the LOOK algo beat RSR in the final sim!
- hastegLol, love this post. Every single day when I take the elevators at the office I try and figure out what the algorithm is behind it. Been too lazy to just research it. Now I know!
- m463I'd like to see skyscraper elevators simulated, not just a few floors.They have to be built a certain way, and need super fancy dispatch algorithms.
- sghiassyAs a software engineer who lives on the 58th floor this is gold!!
- realaccfromPLI absolutely adore this, I am always trying to guess whichever elevator will come in first in large crowded buildings. Thanks for this article.
- proeeDon't forget the executive elevator algorithm (EEA), which uses a priority interrupt to take passengers directly to the top floor.
- yreadOur elevator doesnt stop for people who called it after it started on the way up. It only picks up people on the way down
- prometheus1992This is beautiful. By the end of it I started to feel like I was calculating complicated chess lines in a middle game.
- thenoblesunfishFun! I hate those new kiosk style elevators, because I can't reconfirm that I actually pressed the button, remember which one I am supposed to wait for or press the button again while I'm waiting to make sure I really pressed it. Also don't like that I can't change my mind inside the elevator. All in theory not problems if you were a rational person and the system WAI but I am not and things like elevators rarely do. The up/down buttons are more brainless and I like that. Interesting to hear that they might not even be more efficient!
- cyanregimentLevel 1: Elevators, load balancing (1D arrays)Level 2: Traffic lights, graphics (2D arrays)Level 3: Flight control, simulations (3D arrays)Level 4: Satellite tracking, virtual worlds (4D arrays)...So many problems can be cast to arrays to be solved with various linear algebra.Considering LLMs are "Level 1000+" puzzles in this analogy, I wonder if every problem could be represented by an n-dimensional vector and solvable with algebra.They at least make great interview questions - Tic-Tac-Toe is commonly given, but is obvious. The board already "looks" like arrays. The less obvious ones, like elevators (or load balancing), are always interesting.
- shadeslayer_This article gives me war flashbacks about a particularly irritating OO design interview from 5 years ago.
- nubg> The simplest elevator algorithm is called SCAN and was patented in 1961. The elevator starts at the lobby and goes all the way to the top floor before reversing and coming back down. It picks up and drops off anybody on the way.Patents, everybody...
- tintorI am amazed how in US closing elevator doors switch to opening if someone touches the door edge. This results in abusive behavior of people intentionally jamming their arms in the path of closing doors, and delaying everyone else inside the stopped elevator.
- QuantumhunkThis is cool, but wondering which tool was used to build those animations?
- supportmThe animation is really cool, how did you make it?
- itunpredictableI didn't realize that neal.fun had some competition.
- TeMPOraLElevators are, in a way, a heap of social and psychological problems stuffed into a box that moves up and down a lot. The article briefly acknowledges it, but like ~all such articles I read over the years, it's primarily interested in wait time and focuses on which quantile to minimize and how. But I'd love to know if and how the soft, squishy thing is being accounted for.The core problem: elevators are frustrating for many reasons, and that frustration often manifests as hidden blame and hate towards other fellow passengers. Like, IDK, I'm sitting there with a stroller and a kid on floor -1, trying to get to the train platform at floor 0, but the elevator isn't coming because it's going back and forth between 0 and 2 and 3, as people who came by cars shuttle their luggage to and from the parking lot. As a city dweller and non-car person, I can feel my hatred towards cars and drivers bubbling up right there.I imagine the same is felt by them if I manage to snatch the lift and go from 0 to -1, when they'd really love to already be on +2.There's many other cases. Mall problems are different than train station problem, different than tall residential building problems, different than office building problems. Destination Dispatch is its own special thing, with its own special psychological twists. But two things I observed in general are:- If there is a control element available, you will blame people for using it (even internally). Like, "I'd be there a minute ago if not for this damn XYZ who just had to press the button at exactly this time, and they weren't even going in this direction!"- If there is an indicator element available, people will optimize around whatever it shows.Like, someone gets at floor N, sees most of the buttons between there and their destination M lit up, immediately presses N+1 to get off there and call another elevator. But if the buttons are visible enough from outside the lift, they may just not get in in the first place, saving themselves and the others time and trouble, etc.The more I think about it, the more I see that placement of buttons and indicators in the lift is in itself an UX engineering problem with unusually high impact of every decision on well-being of the users.EDIT: Also ironically, and in line with my feeling that Star Trek got more things right than people give it credit for, a lot of elevator problems - both scheduling and social/psychological ones - would be solved if elevators just moved faster, like 2-4x faster than now, and also in some cases, also moved sideways. I.e. turbolifts.(That, and if it didn't immediately led to the building owners putting less of them. So put another way: frustrating lifts is the sign of building owners/designers cheapening out.)
- oeithoI am wondering where these more complex elevator algorithms are deployed, because I never see them.I was recently at a Radisson hotel in Germany where I was tried to summon an car, but none would appear for a long time. I believe that someone was keeping the doors open on their floor to wait for someone. The fact that all the other elevators were passing by in both directions was actually a bit infuriating as well.At that moment I really wished for an algorithm that would recognize when an car spent a significant amount of time on one floor and then reassign the other floors to a new elevator.
- npodbielskiHow people do such nice animation? Is there is some nice program you can use? I looked and I could not find anything that seemed really easy to use. Llms can sometimes generate something usefull and sometimes something attrocious. I remember few months back article where someone create animation of how 3.5" 1.4MB disk is build, somebody asked about this in the comment and author said it was done mostly by hand. While this is impressive it would be cool to be able to draw some animation for work prestnation that looks nice but also so I do not have to spend 3 days crafting something like that. Would be nice to draw few of them in my blog too. Any recommendations?
- kazinatorOver the years, I've witnessed numerous instances of poor elevator behavior:- Two elevators ascending and descending in near lock step, in a two-elevator building, effectively reduced to one elevator.- When going in a different direction from the requested one (e.g. called elevator to go up, but actually going down), the doors wastefully close, open and close again. Seen this in many elevators.- At 3 a.m. you take the elevator to a parkade, like to get something from a car. When you return to the elevator a minute later, it is gone; it spontaneously moved away even though nobody is using it but you.
- crabboneThe question about designing elevators used to be the mainstay of programming job interviews. I had an annoying interview where I was asked, for the umpteens time to design an elevator. I already made up my mind at the time, knowing I'm not going to work for the company, but decided to have a... unexpected approach.So, for instance, I didn't measure the elevator's efficiency in the wait time. I included (weighted) travel time. I assumed LOOK algorithm was used. And then when I tried to calculate various outcomes for different trips I suddenly realized that elevator's efficiency and fairness seem to go different ways.Without trying to reproduce my evaluation system, here's my finding in fewer details: if you have two passengers, one going from the ground floor to the top floor and other joining for the shorter ride down in the middle, then the elevator that makes a "detour" is more efficient, but it hardly seems fair that the passenger traveling ground floor to the top should go even a single floor in the opposite direction.Somehow, until that point, I lived with an illusion that the most efficient solution to a problem must be the most fair to every participant. Discovering this counterexample sent me on the "tour of discovery" of ethics and different philosophers who contributed to it... and while in the end it made me none the wiser, I'm happy to have discovered this field.
- rrr_oh_man> Another metric you can track is journey time, how long you're actually waiting in the elevator before getting to your floor. RSR and LOOK have different characteristics here as well but that's beyond the scope of this article.AAAAAAAAAAAH. WHY.
- elisbceThis article didn't consider two very important optimizations: 1. Odd-even split with all-floor backup. 2. Low/High floor split.
- tamimioAs someone who lives in a penthouse, elevator’s frustrations are real struggle especially in rush hours, because the elevator has to travel dedicated to you rather than you piggy backing on one that is already going up or down.
- mallory854This is super interesting. I've always wondered how the complicated things work!
- sltkrReminds me of this little game, where you have to code your own elevator algorithm: https://play.elevatorsaga.com/
- danielvaughnI've always wondered about elevator algorithms. This is awesome.
- quietsegfaultI love elevator simulations.
- gosub100Maybe I missed it, but the algorithm should also redistribute empty elevators that stop too closely to each other.
- moralestapia>All this technology just to underperform the S&PMy takeaway is that the benefit of using a much more complex algorithm is marginal.
- cubefox> Everyone has shared the frustration of waiting for an elevator that never seems to arrive.Really? Maybe I'm lucky I never had to deal a lot with elevators.
- DoneWithAllThatHaving gone to many large furry cons(notoriously brutal on the elevators due to how much floor-to-floor traffic there is compared to other usage) I’ve seen these algos basically completely fail to adapt to unusual patterns. I once spent over half an hour on checkout day, in a hotel with 8 banks, to even have a car stop on our floor at all. Can’t really blame the algo for such a unique situation and at the end of the day a saturated system is a saturated system and nothing can be done to make it fast, but it’s always interesting to witness when a system is completely unable to accommodate a demand like that.(In the example above we gave up and decided it was cardio time, five laps up and down 14 flights to escape with all our luggage.)
- jmyeetThis is a good article. It reminds me of a story.At a previous employer we had heteregenous elevators. In one bank, some went to the lower half of floors only while others went to all and the company installed a "smart" elevator system. I kind of became known because I was constantly yelling about this system in the feedback group because I hate "smart" elevators and and (IMHO) they just don't work. What actually works is express elevators and sky lobbies.This article covers one of the deficiencies this system had: full elevators. For example, you'd want to go down and an elevator would skip your floor because another had already been assigned. That one would show up full and you couldn't go down. Down wasn't so bad because the stairs weren't a bad option but up was terrible. Going up a few floors was fine. Going up 20 was... a bigger issue.Back in the day we had elevator operators and people in the lobby during the morning rush who would shepherd people into particular elevators. I actually think this system works way better than anything technology has come up with. Even if you nail the implementation (and I've never experienced elevators that have), people don't read and will just get into elevators anyway.Anyway the article says that generally speaking on smaller banks simple up and down buttons work best. I absolutely agree.There's a deeper issue here though and that is solutions looking for a problem. Nobody is making money from up and down buttons. They are fromn selling smart elevator solutions. And you see this everywhere in life. It basically devolves into rent-seeking behavior. Salespeople wine and dine a couple of people responsible for making decisions and then make bank on selling something nobody wants or needs as well as the constant maintenance and updates.
- deton3991[dead]
- nc55g3g[dead]
- yucongchen[flagged]
- hnrprtlpdb[dead]
- hn3ufz62f7[dead]
- mito88did he factor in the lifting speed?
- cpuguy83Enjoyed the read, thanks!Beyond the content, the font, style, etc made it a pleasant experience for me.
- OJFordI think this comparison is also assuming the distribution of request & requested floor is uniform? When actually near pairs are less likely (I'll just take the stairs) than bottom to top, so even analysing it is more complex than at first glance.