科学与数学setosa.io
公交车为什么会扎堆?
Why Do Buses Bunch?
2015 — 2019,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这个页面用交互式模拟解释公交车为什么会“串车”:一辆车因延误或上下客多而变慢,后面的车因载客少而加速,最终几辆车挤在一起同时到站。页面展示了这种正反馈如何把原本均匀的间隔推成不稳定状态,以及可能的干预思路。
为什么经久不衰:它用一个简单模型揭示了日常现象背后的系统失稳机制,还能类比分布式系统中的调度问题,所以多年后仍值得读。
HN 评论精选
Percolator 用公交串车类比扫描线程聚集,并通过随机跳转来打散聚集。
几年前读 Google 的 Percolator 论文时,我很高兴看到它提到这个现象:扫描线程会像公交车一样聚集在表的少数区域,降低并行度。公交变慢后,每站等待乘客随时间增加,上下客更慢;后面的车则因每站载客少而加速,最终一串车同时到站。Percolator 的解决办法是让扫描线程发现自己在扫同一行时随机跳到新位置。
brian_cloutier查看英文原文
I enjoyed the callout to this when I was reading Google's Percolator paper a few years ago: > The random-scanning approach requires one additional tweak: when it was first deployed we noticed that scanning threads would tend to clump together in a few regions of the table, effectively reducing the parallelism of the scan. This phenomenon is commonly seen in public transportation systems where it is known as “platooning” or “bus clumping” and occurs when a bus is slowed down (perhaps by traffic or slow loading). Since the number of passengers at each stop grows with time, loading delays become even worse, further slowing the bus. Simultaneously, any bus behind the slow bus speeds up as it needs to load fewer passengers at each stop. The result is a clump of buses arriving simultaneously at a stop [19]. Our scanning threads behaved analogously: a thread that was running observers slowed down while threads “behind” it quickly skipped past the now-clean rows to clump with the lead thread and failed to pass the lead thread because the clump of threads overloaded tablet servers. To solve this problem, we modified our system in a way that public transportation systems cannot: when a scanning thread discovers that it is scanning the same row as another thread, it chooses a new random location in the table to scan. To further the transportation analogy, the buses (scanner threads) in our city avoid clumping by teleporting themselves to a random stop (location in the table) if they get too close to the bus in front of them. From here: https://ai.google/research/pubs/pub36726
让后车超车可以暂时拉开间距,但并非完美的自平衡机制。
串车时让后车超过前车会有帮助吗?我的推理是:满车因上下客多而更慢,前车通常更满更慢,所以两车会靠近;如果后车超过去,快车在前、慢车在后,应该能拉开距离。至少能维持一段时间。新的前车接下来会吸走很多乘客而变慢,所以不是完美自平衡,但可能比不超车好。
adrianmonk查看英文原文
Would it help to have the trailing bus pass the leading bus when they bunch up? My reasoning: (1) As the article said, full buses move slower because more passengers means more boarding/unboarding time at stops. (2) The lead bus is the fuller, slower one. Slower bus in front means buses get closer together. (3) If one bus passes the other, then you have the faster bus in front and the slower one behind. They should then get further apart. At least they should for a time. The now-leading bus is going to scoop up a lot of passengers at the next several stops and the now-trailing bus won't, so the leading bus will eventually slow down. So it's not perfectly self-balancing or anything, but maybe it would get some distance between them. More distance than not doing it.
乘客需求的突发高峰和终点晚点连锁,会让串车问题更复杂。
还值得注意的是,现实中的乘客在时间上并不均匀。放学、火车到站带来大量换乘乘客等情况,会让某一站突然爆发客流,打乱整个系统。这还会产生连锁效应:公交车晚到终点站,返程也会晚开始。
bobthepanda查看英文原文
It is also worth noting that in real life passengers are not uniformly distributed through time. When school lets out, or a train arrives at the station full of transfer passengers, etc. you can get a huge burst of traffic at one stop that screws up everything. This can have knockback effects, because if buses show up late to their terminal they have now also started their return trip late. EDIT: edited a word
均匀间隔是不稳定平衡,小偏差会被正反馈放大。
一个相关的普遍概念是稳定平衡与不稳定平衡。稳定平衡下小偏差会自我纠正,不稳定平衡下小偏差会被放大、让系统远离平衡,除非主动干预。在模拟的假设下,均匀间隔的公交车就是不稳定平衡:一辆车稍早或稍晚会造成载客不对称,把系统进一步推向错误方向。
_delirium查看英文原文
Fwiw a relevant general concept is that of stable vs. unstable equilibria. In a stable equilibrium, small deviations will tend to correct back to the equilibrium, while in an unstable one, small deviations get magnified and the system drifts away from it (absent active intervention). Given some assumptions, such as those implemented by this simulation, evenly spaced buses represent an unstable equilibrium, since a bus slightly early or late will cause an asymmetry in passenger load that pushes things further in the "wrong" direction.
历次讨论
同类还值得读
如果月球只有 1 像素:一个极其精确的太阳系模型(2014)
If the moon were only 1 pixel: A tediously accurate solar system model (2014)
一个网页版太阳系模型,以“如果月亮只有 1 像素”的真实比例呈现:你必须一路横向滚动,才能体会行星之间空旷到何等程度。
科学与数学上首页 7 次 · 2014–2025joshworth.com编辑精选沉浸式线性代数(2016)
Immersive Linear Algebra (2016)
《Immersive Linear Algebra》是一本完全免费、开放在线的线性代数“超文本教科书”,其最大特色是大量可交互的图形:读者可以直接拖动、操作图中的向量、矩阵和变换…
科学与数学上首页 5 次 · 2015–2024immersivemath.com编辑精选如何将贝果切成两个相连的半环(2009)
How to Slice a Bagel into Two Linked Halves (2009)
数学家 George Hart 的经典教程,演示如何用一刀把贝果切成两个相互扣住的环,并附上切割步骤与数学原理。
科学与数学上首页 5 次 · 2009–2022georgehart.com“犹太问题”:一组用于歧视的数学题
Jewish problems
一篇 arXiv 论文,整理并讨论苏联时期犹太学生在申请大学数学系时被问到的特殊数学难题:这些题往往有简单解法却极难想到,被用作面试中拒绝犹太考生的手段。
科学与数学上首页 5 次 · 2011–2021arxiv.org你的身体并非为长久而造:人类死亡率数据的一课
Your body wasn’t built to last: a lesson from human mortality rates
文章从人类死亡率随年龄变化的统计规律出发,解释身体并非为长久使用而设计:年轻时死亡风险较低,之后随年龄近似指数上升,像复杂系统在不断累积损伤。
科学与数学上首页 5 次 · 2009–2018gravityandlevity.wordpress.com