Top
Best
New

Posted by Jrh0203 5 hours ago

Elevators(john.fun)
651 points | 171 comments
peterldowns 3 hours ago|
Back 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

bherms 3 hours ago||
We did this in college as well using microcontrollers and leds or something - i forget the exact details. It was super fun
omoikane 4 hours ago||
> Destination Dispatch [...] are in general worse

I 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.

darkwater 2 hours ago||
Yeah, and definitely is not the right story for hotels. His premise of "morning traffic mostly from lobby to floors" is completely false in an hotel where you get it both ways due to people going down for breakfast and going back up and the down once again.

I see hotels with the kiosk model changing the UI depending on breakfast rush hour

taftster 3 hours ago|||
Yes, it's definitely more likely for an individual already in an upper floor to return to ground than a stop above or below. The people queuing up in simulations don't seemingly get this right all the time.

Also the group of people going to or returning from lunch is real as well. The grouping factor happens more at the middle of the day and less at the morning or evening. Primarily because of lunch.

dawnerd 1 hour ago|||
Cruise ships that use destination dispatch have been much nicer too. Ships that use the older algorithms are a pain to wait during peak times. Guess plus side you’ll use the stairs more.
alexpotato 2 hours ago|||
> - People who are on the ground floor generally travel in large groups to the same destination.

I also thought that this is one of the biggest reasons destination dispatch was better.

There are even articles about switching to destination dispatch in office buildings or hotels lead to dramatic reductions in wait time.

acomjean 3 hours ago|||
Is it because the criteria is wait time not travel time? Destination dispatch would avoid some extra stops on the trip.

I just visited a new building with destination dispatch, so it seems to be still around.

My EE roommate in college had to build an elevator circuit as a final problem. It was on a bread board and had a bunch of call buttons and had a motor and a clear disk with black squares so it could figure out where it was…. I think it was the simple algorithm…

ApolloFortyNine 2 hours ago||
Surely there's a dataset out there with elevator calls for an office building you could test on, instead of the poor random destination case.

Surprisingly, claude failed to find a good one.

Also, part of destination dispatch (I'm guessing based on experience) removes the 'stopping on every floor problem', so the real test would be total time including wait at that point I think.

brandonpelfrey 4 hours ago||
For folks that have never seen elevator scheduling the game: https://play.elevatorsaga.com/ Enjoy this rabbit hole :D
inkkin 43 seconds ago||
Omg! <3
alanwreath 4 hours ago|||
I wish there were more games like this. It’s such a simple premise but so satisfyingly difficult after each level. And it even has a bit of randomish failure which makes for even more challenge.
darkvertex 3 hours ago|||
If you buy the adorable monochrome console called the "Playdate" https://play.date it comes with a bunch of games included, including a cute elevator game where you help penguins to different floors while controlling the elevators yourself using the crank: https://play.date/games/flipper-lifter/
ivanjermakov 3 hours ago||||
You will like https://www.zachtronics.com/
john_strinlai 4 hours ago|||
at a quick glance, it reminds me of "the farmer was replaced", if you havent seen/heard of that one
NooneAtAll3 3 hours ago||
https://store.steampowered.com/app/2060160/The_Farmer_Was_Re...

I remember this one, it deserves all sorts of praise

ivolimmen 3 hours ago||
I can also recommend https://store.steampowered.com/app/375820/Human_Resource_Mac...
NooneAtAll3 2 hours ago||
and its sequel is also worth a mention https://store.steampowered.com/app/792100/7_Billion_Humans/

but imo, unlike farmer, these games reaaaaly lack the ability to make functions/subroutines

manually doing all the goto loops becomes tiring

emmanueloga_ 4 hours ago|||
looks very well made, but I still prefer https://en.wikipedia.org/wiki/Elevator_Action !
CobrastanJorji 3 hours ago|||
This is great, but to me, the definitive elevator scheduling game was SimTower.
genericone 1 hour ago||
Sid Meier's Elevator Manager was such a great game... so much nostalgia.
grep_it 4 hours ago|||
I always come back to this game whenever I'm at a hotel for a conference waiting for the elevator.
perryprog 4 hours ago||
Wow, I just came here to comment that I've always wondered if a game where you have to program an elevator scheduler would be any fun. I thought surely no-one's thought to make that before, too! Glad to be proven wrong.
hermanschaaf 4 hours ago||
Hah, 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 shafts

and 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.

jamies 4 hours ago|
Thanks for sharing this. I was just commenting about the challenge of making a fun elevator sim game. This looks great -- can't wait to play with it this weekend!
hermanschaaf 1 hour ago||
Thanks! Would love to hear your thoughts if you get a chance to play it. I'm currently working on adding a few more towers and challenges. After that maybe I'll deep-dive into the "best" automated scheduling algorithm for all this :)
Bossie 13 minutes ago||
Every time I enter an elevator, I wonder whether it will be the first one I've come across that supports deselect.
besil 21 minutes ago||
I 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

orliesaurus 4 hours ago||
Oh 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.
StableAlkyne 3 hours ago||
> minimize the amount of wait times between picking up people and taking them to their destination

I wish elevators accounted for load.

I've been to a couple of larger conferences where on the Monday morning after, the hotel elevator was just hammered. Everyone wanted to go down, and the elevator would dutifully stop on every single floor no matter how full it was. If you were mobility disabled on the 2nd floor, you were basically fucked if you had a flight to catch.

One would think that, if it's a 10 person elevator and it's already stopped on 10 floors requesting it, that it could save an extra 5 minutes by just going directly to the ground floor, instead of stopping on every floor with the same conversation of "Oof, can't fit in there. I'll get the next one!"

Quinner 16 minutes ago|||
The article describes the RSR algo which takes load into account.
BenjiWiebe 34 minutes ago|||
In that case, would it pay to call for an elevator going up, and then remain on it until it's being called down?
dbcurtis 3 hours ago|||
I have done several third-party elevator integrations (software that talks to the elevator controller) for coordinating other equipment with the elevator. One thing that always struck me once I had full visibility into the location and motion of all the elevator cabs is how busily they are scheduled. Waiting in the elevator lobby for a cab seems to take forever, but viewed from the dispatch side, it is a flurry of activity and cabs are rarely idle during any hours the building is normally occupied. It is easy to nerd out just watching the status panel.

Another thing I learned: If an elevator mechanic says: "I'll meet you first thing in the morning." He means something like 4:00AM. They want to get in and out before people start arriving to start their day.

dbcurtis 3 hours ago|||
One other thing to add: It isn't the elevator scheduling software being obtuse, that software gets a huge amount of thought. But elevators are expensive, and building owners do not over-spend on a whim. Typically, they have just enough cabs (if that) to handle the expected load.
cruffle_duffle 2 hours ago||
Not only that but different countries have code regimes that make more elevators especially expensive. See how building codes in the US basically ensure there are only two real manufacturers in the market vs a healthy ecosystem in others: https://youtu.be/Or1_qVdekYM
neutronicus 4 hours ago||
They might have other objective functions like wear-and-tear on the elevators, total energy usage, or something
dbcurtis 3 hours ago|||
It's pretty much throughput. The cap-ex of a single cab swamps any other cost, so the only way to reduce total number of cabs is optimizing for throughput.
cyberax 3 hours ago|||
Modern elevators have regen braking, so they can recover most of the energy spent on going down. Older elevators used braking resistors for that.

(BTW, going _down_ while empty is typically more energy-consuming for the elevators because they are counterweighted)

Edit: that's also why you shouldn't use elevators in a fire. If the brakes in the elevator machine room fail, the cab won't crash down. It will go _up_, possibly dragging you into the fire. Many firefighters died because of that.

olex 4 hours ago||
The 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?..
Georgelemental 4 hours ago||
I don't think I've ever seen someone do that
summermusic 4 hours ago|||
I haven't ever seen anyone do this in the United States, but I saw it in China and Italy.
esperent 4 hours ago|||
I've never seen anyone do this anywhere in the world including Italy.

I've never been to China but wouldn't you learn quickly after getting in an elevator going the wrong way not to do that again?

The only exception I can see if there's way more people than elevators and you just need to get spot at all costs.

the_af 4 hours ago||
My wife always randomly hits the up or down button, then gets upset if I explain why she should only pick the one she really wants. She forgets the next time. I think some people never really understand how elevators work.

See also: the keep open / close doors button. I had one building administrator explain to me we should add a delay of 10 seconds to the "quickly shut door" button because otherwise she kept getting her arm hit by the door. When I asked why we would add a delay to the button that's meant to reduce delays (why not simply wait for the door to close on its own, then?), and whether we should fix the sensor that prevents doors from closing if there's an obstacle instead, she just kept staring blankly at me. I don't think she understood me at all.

Again, some people simply don't grasp how elevators work.

superhuzza 3 hours ago||
I fear in both cases, its not a lack of understanding of elevators but of common sense...
tamimio 4 hours ago|||
Because most buildings now they just put one button so people stop clicking both
rsanek 3 hours ago|||
That has not been my experience, and logically it doesn't really make much sense. If you do so, you are making the problem strictly worse.
what 4 hours ago|||
What? I’ve never seen that. The elevator needs to know which way you want to go.
cozzyd 16 minutes ago|||
i just saw this for the first time today in Romania...
allannienhuis 1 hour ago|||
On the ground/lowest floor, there's only one button as there's only one way to go.
trivo 4 hours ago|||
And then when the elevator door opens, they ask the people inside: "Are you going up or down?" There's an arrow showing that, for Christ's sake.
wpm 4 hours ago|||
Yeah and you can flail your head around looking for the arrow or you can just ask. Especially on a busy elevator lobby there might be multiple cars opening at the same time so you cant even tell from the ding/ding-ding
themaninthedark 4 hours ago||||
True but sometimes someone hits a button on the inside by mistake. Or someone was going to get off then decides not to.
SoMomentary 4 hours ago|||
Sometimes I think "stupid" questions like these are just a way to break the ice, something that gets used to kindly acknowledge the momentary existence of others in our lives before we continue down our separate paths.
deathanatos 3 hours ago|||
… and the elevator is still going the way it is going, and that way is still indicated by the illuminated arrow.
gabrieledarrigo 3 hours ago|||
"Questions are never indiscreet. Answers sometimes are."
GurnBlandston 2 hours ago||
"Have you stopped urinating in public?"
davnicwil 3 hours ago|||
In situations like this the answer usually comes by flipping it and assuming they do understand, and asking why it makes sense now.

It's probably just the old 'fake loader' psychology, to be honest. Waiting without knowing when the elevator will arrive is boring/frustrating, where getting into an elevator that moves, even if the wrong direction, feels like progress.

Things are happening, and even if it takes longer ultimately that's a less frustrating state to be in.

gene91 2 hours ago|||
In some places, I see people do that. It’s not stupidity. I learned the logical reason after observations. During busy hours in some busy buildings, there isn’t enough elevator capacity. Therefore, if you want to go down to the ground floor, taking a trip up and then down might be better (a less-bad worst case outcome, or even a better average outcome) than waiting for a non-full downward elevator. In such case, it’s logical to press both up and down.
ivanjermakov 3 hours ago|||
Elevator algorithm I'm used to always goes up from lobby and always goes down from any other floor. Meaning that it goes all the way to the highest order and picks orders top-down until reaching lobby. Only exception is going to underground parking floors which is relatively rare in my housing complex.
vel0city 1 hour ago||
When you're at a lower floor and you're trying to go down, but its a time period where traffic is trying to leave you can end up in a situation where nearly every elevator going down is already full. So you call for down, cab arrives but is already full, it goes, you call again, another comes, its already full, rinse/repeat. Sometimes there's not much up traffic during that time, so it can be a legit strategy to just go ahead and call on the up and ride it all the way instead of waiting and hoping for space coming down.

Although I guess that's not quite what you're talking about.

tintor 5 minutes ago||
I 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.
slater 4 minutes ago|
That's the case with most elevator doors, worldwide...? If you put your hand in a closing elevator door, it's supposed to open again.
psadri 2 hours ago|
Aside 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.

More comments...