-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bus-bunching-1.html
327 lines (310 loc) · 16.9 KB
/
bus-bunching-1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<!DOCTYPE html>
<html lang="en">
<head>
<title>Blueschisting</title>
<link rel="icon" type="image/png" href="/images/favicon/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="/images/favicon/favicon-16x16.png" sizes="16x16" />
<link href='//fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,700italic,400,600,700' rel='stylesheet' type='text/css' />
<link href='//fonts.googleapis.com/css?family=Merriweather:300' rel='stylesheet' type='text/css'/>
<link href='//fonts.googleapis.com/css?family=Source+Code+Pro:200,400,700' rel='stylesheet' type='text/css'/>
<link rel="stylesheet" type="text/css" href="/theme/css/icons.css"/>
<link rel="stylesheet" type="text/css" href="/theme/css/styles.css"/>
<meta charset="utf-8" />
</head>
<body id="index">
<!-- header -->
<header class="siteheader">
<!-- site image -->
<div class= "siteimage">
<a class="nodec" href=/images/escape_of_the_core.png>
<img width="200" height="200" src=/images/escape_of_the_core.png>
</a>
</div>
<div class = "sitebanner">
<h1><a class="sitetitle nodec" href="/index.html">Blueschisting</a></h1>
<h3 class ="sitesubtitle">Thoughts on planetary science, fluid dynamics, transit, and scientific computing</h3>
<!-- nav -->
<nav class="menu">
<ul>
<!-- menu items-->
<li><a class="nodec" href="/pages/about.html">Ian Rose</a></li>
<li><a class="nodec" href="/blog_index.html">blog</a></li>
<!--pages-->
<!-- services icons -->
<li><a class="nodec icon-github" href="http://github.com/ian-r-rose"></a></li>
<li><a class="nodec icon-twitter" href="http://twitter.com/IanRRose"></a></li>
</ul>
</nav>
</div> <!-- sitebanner -->
</header>
<!-- content -->
<div id="main">
<div id="content">
<section class="content">
<h3 class="posttitle">
<a class="nodec" href="/bus-bunching-1.html" rel="bookmark" title="Permalink to Buses are bosons, or How I learned to stop worrying and love AC Transit (Part one)">
Buses are bosons, or How I learned to stop worrying and love AC Transit (Part one)
</a>
</h3>
<div class="postinfo">
<p class="published" title="2018-03-19T00:00:00-07:00">
Mon 19 March 2018
</p>
</div><!-- .postinfo -->
<div class="article">
<p>If you have spent any amount of time using mass transit,
you know the frustration of waiting for the better part of an hour for a bus to arrive,
only to see two or three of them roll up in quick succession.
This phenomenon is a common enough problem that it has a name: "bus bunching":</p>
<p><img alt="18-bunch2" src="articles/transit/images/18-bunch2.jpg" title="Bunching on the 18 bus line in Berkeley"></p>
<p>In this two-part series, we'll investigate bus bunching by making a mathematical model of a bus route.
In this first part, we'll construct the model and find it's equilibrium solution.
In the second part, we'll demonstrate the inevitability for that model to bunch.</p>
<p>Let's start by constructing a model for the speed of a single bus.
We will assume that the bus has a fixed route, on which it travels all day.
That route may be on any number of different streets, go wending through different
neighborhoods, and generally make very little sense
(like my beloved <a href="http://www.actransit.org/pdf/maps/version_38/12.pdf">12 line</a>).
However, if it travels back and forth on this same route, we can model it as a loop,
and its position on that loop can be mapped to an angle on a circle <span class="math">\(\theta\)</span>.
We can then identify the speed of the bus with the time derivative of <span class="math">\(\theta\)</span>.</p>
<p>The simplest model for <span class="math">\(d\theta/ dt\)</span> is for the bus to travel at a constant speed <span class="math">\(v_0\)</span>:</p>
<div class="math">\begin{equation}
\frac{d \theta}{d t} = v_0
\end{equation}</div>
<p>
Or, expressed in a simulation:</p>
<iframe src=/visualization/bus/bus-bunching.html?interactive=false&boost=false&equilibrium=true&gamma=0&n=1 width=700 height=700></iframe>
<p>Now, this model isn't very interesting.
There is only a single bus, and it is traveling at a fixed speed,
so it has no hope of exhibiting the kind of bunching behavior that we want to explain.</p>
<p>A typical mass transit route operates multiple buses with a given
<a href="https://en.wikipedia.org/wiki/Headway">headway</a>,
the distance (or time) between successive vehicles on the route.
If everything is operating according to the plan,
the headway from one bus to the next should be approximately constant,
with possible scheduled variations depending on the time of day
(such as increased frequency during rush hour, or decreased frequency at night).</p>
<p>We can increase the complexity of our model adding some more buses so that there are <span class="math">\(N\)</span> on the route:</p>
<div class="math">\begin{equation}
\frac{d \theta_n}{d t} = v_0
\label{constant}
\end{equation}</div>
<p>In this equation the subscript indicates the <span class="math">\(n\)</span>th bus out of <span class="math">\(N\)</span>,
so a simulation with five buses looks like this:</p>
<iframe src=/visualization/bus/bus-bunching.html?interactive=false&equilibrium=true&boost=false&gamma=0&n=5 width=700 height=700></iframe>
<p>Okay, so this is starting to more closely resemble a bus route.
However, the buses are still moving at a constant speed, and have no effect on each other.
In order for our model to exhibit the richer characteristics of a system that can bunch,
there must be some way for their speed to be a function of conditions on the road.</p>
<p>There are many factors that can control the speed of a bus traveling through town,
including traffic, construction, scheduled layovers, and the number of passengers.
In order to keep the model simple, we will focus on the last factor:
the number of passengers who board and exit the bus.
A traveling bus constantly picks up and drops off passengers as it makes its way around its route.
This process takes time (as anyone who has watched a passenger fumble with change upon boarding knows).
A bus that boards and deposits more passengers will, in general, make slower progress along its route.</p>
<p>Many things affect the number of passengers boarding a given bus,
including time-of-day, scheduling, and population density.
In order to keep the model as simple as possible, we will ignore those and
concentrate on a single factor: the amount of time since the previous bus.
We will assume that as more time passes, more passengers arrive at a bus stop for pickup.
If a bus falls behind schedule, more people will have arrived at each stop,
meaning that it will be further slowed down by the excess passengers.
In the following analysis, we will use the distance between buses as a proxy
for the number of passengers that need to be picked up.</p>
<p>We need to augment our model to account for this slowing-down behavior.
The expression for speed in equation \eqref{constant} is a constant,
so the next-simplest expression is to make it linear in the distance between buses
(our proxy for the number of passengers):
</p>
<div class="math">\begin{equation}
\frac{d\theta_n}{d t} =
v_0 \left[ 1 - \gamma (\theta_{n+1} - \theta_n) \right]
\label{evolution}
\end{equation}</div>
<p>In this equation, a bus picking up <em>no</em> passengers travels at <span class="math">\(v_0\)</span>
(which happens if there has been no time for them to accumulate since the previous bus).
As the distance between a bus and the one ahead of it increases,
the speed of the bus slows down, reflecting the additional time spent boarding and disembarking.
The dimensionless parameter <span class="math">\(\gamma\)</span> determines how sensitive the bus speeds are to differences in headway.</p>
<p>Equation \eqref{evolution} is a set of ordinary differential equations
(one equation for each of the <span class="math">\(N\)</span> buses).
It will be the primary evolution equation for our system of buses,
which we will analyze by answering the following two questions.</p>
<ol>
<li>
<p>Is there an equilibrium solution to these equations?
That is to say, is there a solution that does not evolve in time?</p>
</li>
<li>
<p>If there is an equilibrium solution, is it stable?
A stable solution, when perturbed, will return to the equilibrium.
An unstable one will get further and further from equilibrium until the buses are bunched.</p>
</li>
</ol>
<p>Strictly speaking, an equilibrium solution does not exist for the system of equations as described:
as long as the buses have a nonzero velocity, their positions will evolve in time.
However, with a slight reframing of the question it makes sense to talk about an equilibrium:
is there a configuration for which the bus velocities are constant,
and that the distance between them (headways) are not changing?</p>
<p>In a coordinate system traveling with the buses at equilibrium speed
the solution to the system would then look like this:</p>
<iframe src=/visualization/bus/bus-bunching.html?interactive=false&equilibrium=true&boost=true&gamma=0&n=5 width=700 height=700></iframe>
<p>It seems intuitive that an equilibrium solution, if it exists,
should have the buses equally spaced, so let's start looking for a solution of that form.
Let's further guess that the equilibrium velocity is the base bus speed <span class="math">\(v_0\)</span>.
A change of coordinates makes this system a bit easier to reason about.
Let's boost ourselves into moving a coordinate system <span class="math">\(\psi\)</span>, defined by:
</p>
<div class="math">\begin{equation}
\psi_n \equiv \theta_n - v_0 t
\end{equation}</div>
<p>From this we can also get the relations
</p>
<div class="math">\begin{equation}
\frac{d\theta_n}{d t} =
\frac{d \psi_n}{d t} + v_0
\end{equation}</div>
<div class="math">\begin{equation}
\theta_n =
\psi_n + v_0 t
\end{equation}</div>
<p>Substituting these into equation \eqref{evolution},
we get the governing equations in terms of <span class="math">\(\psi_n\)</span>:
</p>
<div class="math">\begin{equation}
\frac{d \psi_n}{d t} + v_0 =
v_0 \left[ 1 - \gamma (\psi_{n+1} - \psi_n) \right]
\end{equation}</div>
<div class="math">\begin{equation}
\frac{d \psi_n}{d t} =
v_0 \gamma (\psi_{n} - \psi_{n+1})
\end{equation}</div>
<p>When the buses are equally spaced around the loop, then the distance
between them is the whole loop length divided between the number of buses, or
<span class="math">\(\psi_{n+1} - \psi_n = 2 \pi/N\)</span>,
which makes the governing equations in the <span class="math">\(\psi\)</span> coordinates</p>
<div class="math">\begin{equation}
\frac{d \psi_n}{d t} =
\frac{ 2 \pi v_0 \gamma }{N}
\end{equation}</div>
<p>Unless the interaction term <span class="math">\(\gamma\)</span> is zero, the time evolution of <span class="math">\(\psi_n\)</span> is nonzero,
making this configuration a non-equilibrium solution to the system.
Therefore, <span class="math">\(v_0\)</span> is <em>not</em> the equilibrium velocity.</p>
<p>This should make sense, as we defined <span class="math">\(v_0\)</span> to be the speed of the bus
in the absence of any delays due to loading and unloading of passengers.
When we include that delay, the buses will be slower.
Instead, let's construct a speed for buses that takes into account the
delay due to passengers.</p>
<p>Again we presume that the buses are equally spaced,
such that the distance between them is <span class="math">\(2 \pi/N\)</span>.
Then, given the evolution equation \eqref{evolution}, we can calculate the speed <span class="math">\(v_e\)</span>:
</p>
<div class="math">\begin{equation}
v_e = \frac{d \theta_n}{d_t} = v_0 \left[ 1 - \frac{2 \pi \gamma}{N} \right]
\end{equation}</div>
<p>
Let's boost into a <em>new</em> coordinate system <span class="math">\(\phi\)</span>, defined by
</p>
<div class="math">\begin{equation}
\phi_n \equiv \theta_n - v_e t
\end{equation}</div>
<p>Substituting this into equation \eqref{evolution}, we find</p>
<div class="math">\begin{equation}
\frac{d \phi_n}{d t} + v_e =
v_0 \left[ 1 - \gamma \left(\phi_{n+1} - \phi_n \right) \right]
\end{equation}</div>
<p>
As before, when the buses are equally spaced, <span class="math">\(\phi_{n+1} - \phi_n = 2 \pi/N\)</span>:
</p>
<div class="math">\begin{equation}
\frac{d \phi_n}{d t} + v_e =
v_0 \left[ 1 - \frac{2 \pi \gamma}{N} \right]
\end{equation}</div>
<p>The right-hand-side is exactly <span class="math">\(v_e\)</span>, so we can subtract it from both sides to get</p>
<div class="math">\begin{equation}
\frac{d \phi_n}{d t} = 0
\end{equation}</div>
<p>
This is exactly what we wanted: in the <span class="math">\(\phi\)</span> coordinate system,
the positions of the buses are constant in time, so
equally-spaced buses are all in equilibrium.</p>
<p>In order to get a feel for the equilibrium solution,
you can experiment with this interactive simulation, which shows the buses
traveling at their equilibrium speed and spacing
(in the <span class="math">\(\phi\)</span> coordinate system that moves with them).</p>
<iframe src=/visualization/bus/bus-bunching.html?interactive=true&equilibrium=true&boost=true&gamma=0.15&n=5 width=700 height=700></iframe>
<p>You can see that as the number of buses increases and the headway between the buses gets smaller,
the equilibrium speed increases, reflecting the decreased number of passengers each has to pick up.</p>
<p>At this point we have answered the first of the two above questions: there is an equilibrium solution.
In the next installment of this series, we are going to answer the second question:
is this equilibrium solution stable? (Spoiler: it's not.)</p>
<p><img alt="streetcar" src="/articles/transit/images/streetcar-bunch.jpg" title="New Orleans streetcars can be bunched too"></p>
<script type="text/javascript">if (!document.getElementById('mathjaxscript_pelican_#%@#$@#')) {
var align = "center",
indent = "0em",
linebreak = "false";
if (false) {
align = (screen.width < 768) ? "left" : align;
indent = (screen.width < 768) ? "0em" : indent;
linebreak = (screen.width < 768) ? 'true' : linebreak;
}
var mathjaxscript = document.createElement('script');
mathjaxscript.id = 'mathjaxscript_pelican_#%@#$@#';
mathjaxscript.type = 'text/javascript';
mathjaxscript.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
mathjaxscript[(window.opera ? "innerHTML" : "text")] =
"MathJax.Hub.Config({" +
" config: ['MMLorHTML.js']," +
" TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'AMS' } }," +
" jax: ['input/TeX','input/MathML','output/HTML-CSS']," +
" extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']," +
" displayAlign: '"+ align +"'," +
" displayIndent: '"+ indent +"'," +
" showMathMenu: true," +
" messageStyle: 'normal'," +
" tex2jax: { " +
" inlineMath: [ ['\\\\(','\\\\)'] ], " +
" displayMath: [ ['$$','$$'] ]," +
" processEscapes: true," +
" preview: 'TeX'," +
" }, " +
" 'HTML-CSS': { " +
" styles: { '.MathJax_Display, .MathJax .mo, .MathJax .mi, .MathJax .mn': {color: 'inherit ! important'} }," +
" linebreaks: { automatic: "+ linebreak +", width: '90% container' }," +
" }, " +
"}); " +
"if ('default' !== 'default') {" +
"MathJax.Hub.Register.StartupHook('HTML-CSS Jax Ready',function () {" +
"var VARIANT = MathJax.OutputJax['HTML-CSS'].FONTDATA.VARIANT;" +
"VARIANT['normal'].fonts.unshift('MathJax_default');" +
"VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
"VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
"VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
"});" +
"MathJax.Hub.Register.StartupHook('SVG Jax Ready',function () {" +
"var VARIANT = MathJax.OutputJax.SVG.FONTDATA.VARIANT;" +
"VARIANT['normal'].fonts.unshift('MathJax_default');" +
"VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
"VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
"VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
"});" +
"}";
(document.body || document.getElementsByTagName('head')[0]).appendChild(mathjaxscript);
}
</script>
</div><!-- .content -->
</section>
</div>
</div>
<!-- footer -->
<footer>
<p>
Copyright © Ian Rose.
Generated by <a href= "http://docs.getpelican.com/">Pelican</a> with
<a href="http://github.com/ian-r-rose/pelican-blueschisting">blueschisting</a> theme.
</p>
</footer>
</body>
</html>