You're in for a Shock
One moment we're driving at a reasonable speed with low density when we notice that the traffic ahead of us is very dense and moving slowly. We need to quickly slow down and get in the line of slowly moving cars. We have then passed through the shock wave. ...
Introduction
It was my fault. I had put off packing and ended up leaving for the airport later than planned, which meant driving on the interstate through downtown at rush hour. Being in a state whose governor was elected on a promise to #fixthedamnroads, construction soon reduced traffic to a single lane, and I was stuck in a line of cars alternating between stopped and slowly crawling.
I began to wonder about this. If there was a single line of cars for several miles, couldn't we move together at the same constant speed through the bottleneck? Why did we all spend long periods of time motionless? Surely, mathematics has something to say.
I knew that traffic flow was typically studied using a partial differential equation, but when I looked into it later, I was surprised to find a simple and elegant geometric interpretation first described by Paul Richards in 1956. We'll investigate Richards' work here, beginning with a simple conservation law that leads to a partial differential equation. Then we'll see how solutions to this equation may be understood geometrically.
A conservation law
Considerable effort has gone into studying traffic flow using a number of models that focus on various features of the problem. Here, we will consider a relatively simple situation in which traffic flows in a single lane on a long, straight highway with no entrances or exits.
We will describe the density of cars on the road at a given position $x$ and time $t$ using the function $\rho(x,t)$, which is expressed in cars per unit length of road. In particular, consider the short stretch of road shaded below. If the length of road is $\Delta x$, then the number of cars in this interval is $\rho(x,t)\Delta x$.
We will also imagine that the velocity of the cars is described by $v(x,t)$. After a short time interval $\Delta t$, a car that begins at $x$ ends up at $x+v\Delta t$, as shown below. This means that the number of cars that pass $x$ in this short time interval is $\rho v \Delta t$. In other words, the rate at which cars pass through position $x$ is $\rho v$.
We obtain a useful description of the density function $\rho(x,t)$ if we consider the number $N$ of cars in an interval $[a,b]$.
This number may be expressed in terms of the density: $$ N(t) = \int_a^b \rho(x,t)~dx. $$ Therefore, the rate of change of the number of cars in this interval is $$ \frac{dN}{dt} = \frac{d}{dt} \int_a^b \rho~dx = \int_a^b\frac{\partial \rho}{\partial t}~dx. $$
This rate of change may also be expressed as the difference in the rate at which cars enter the interval on the left at $a$ and the rate at which cars leave on the right at $b$: $$ \frac{dN}{dt} = \int_a^b\frac{\partial \rho}{\partial t}~dx = (\rho v)(a, t) - (\rho v)(b, t) = -\int_a^b\frac{\partial (\rho v)}{\partial x}~dx. $$
Therefore, we see that $$ \int_a^b \left[\frac{\partial \rho}{\partial t} + \frac{\partial (\rho v)}{\partial x}\right]~dx = 0. $$ As this expression is true for every interval $[a,b]$, it must follow that the integrand itself is zero: $$ \frac{\partial \rho}{\partial t} + \frac{\partial (\rho v)}{\partial x} = 0. $$ This partial differential equation is simply an expression of a conservation law: the rate at which the number of cars in an interval changes is equal to the rate at which cars enter from the left minus the rate at which cars leave on the right. Similar equations arise in the study of fluid flow and are called the equation of continuity.
Of course, there is a maximum value for the density $\rho_{\rm max}$, which occurs in bumper to bumper traffic. If we divide our equation by $\rho_{\rm max}$, we obtain $$ \frac{\partial (\rho/\rho_{\rm max})}{\partial t} + \frac{\partial ((\rho/\rho_{\rm max}) v)}{\partial x} = 0. $$ Consequently, we consider a normalized density $d=\rho/\rho_{\rm max}$ so that $$ \frac{\partial d}{\partial t} + \frac{\partial (d v)}{\partial x} = 0. $$ where $0 \leq d \leq 1$. The condition $d=1$ corresponds to the maximum density: bumper to bumper traffic. A value such as $d=1/4$ means that there are three car lengths separating individual cars.
It is reasonable to expect that the velocity $v$ will depend on the density $d$. When $d$ is close to $0$, for instance, there are almost no cars on the road so we will be traveling at a maximum speed, which we denote by $c$. We expect that our speed $v$ decreases as the traffic becomes more dense. In the case $d=1$, the traffic is bumper to bumper so our velocity will be zero. A simple model that satisfies these properties is $$ v = c(1-d). $$
While this may seem like an overly simplistic assumption, Lighthill and Whitham describe experimental evidence that justifies its use.
We now have $$ \frac{\partial d}{\partial t} + \frac{\partial (d c(1-d))}{\partial x} = 0, $$ which leads to our final expression, the equation of continuity governing the evolution of the density: $$ \frac{\partial d}{\partial t} + c(1-2d)\frac{\partial d}{\partial x} = 0. $$
The shear rule
Given an initial distribution of cars, described by an initial density function $d(x,0)$, as shown below, we would like to describe the evolution of the density $d(x,t)$ for later times. Notice that we seek to describe the density, an aggregated measure of all the cars' positions, rather than the movement of individual cars.
The approach we take is formally called the method of characteristics. Suppose we begin at a point $x_0$ whose density is initially $d_0$; that is, $d_0= d(x_0,0)$.
We will determine a path $x(t)$ such that the density $d(x(t),t)$ along the path is constantly $d_0$.
It may be helpful to view the density as a wave, somewhat like a wave in the ocean. We then seek to determine how fast a point on the wave is moving. To that end, we have $$ \frac{d}{dt}d(x(t),t) = \frac{\partial d}{\partial t} + \frac{dx}{dt} \frac{\partial d}{\partial x} = 0. $$ Comparing this expression to the equation of continuity, we see that we must have $$ \frac{dx}{dt} = c(1-2d_0). $$ In other words, if $x(t) = c(1-2d_0)t + x_0$, then the density will be constant on $x(t)$.
There are a couple of things to notice here.
-
First, a point $x_0$ whose density $d(x_0,0) = 0$ moves with speed $c(1-2(0)) = c$. That is, such a point moves to the right with the largest possible speed.
-
A point $x_0$ whose density is $d(x_0,0)=1/2$ moves with speed $c(1-2(1/2)) = 0$. In other words, this point doesn't move so that the density at $x_0$ is constantly 1/2.
-
Finally, a point whose density is maximal, $d(x_0,0) = 1$, moves with speed $c(1-2(1)) = -c$. Therefore, such a point moves to the left with maximal speed.
Putting this together, we can see that the density wave evolves as seen below.
This leads to what Richards calls the shear rule: given an initial density $d(x,0)$, the density $d(x,t)$ at a later time is obtained by performing a shear on the $(x,d)$ plane, as seen below.
For example, consider a traffic light as it turns from red to green. Initially, the density is 1 behind the light, as the traffic is stopped, and 0 in front of the light since no traffic is moving through the light. The following animation shows how the shear rule applies to show the density evolving once the light turns green.
|
|
Notice how the density increases in front of the light as traffic begins to flow through the light, while the density behind the light decreases. The rightmost point at which the density is 1 moves to the left with speed $c$ as the cars in front of this point begin to move.
Shock waves
The shear rule provides an elegant description of how the density evolves in time. However, it only tells part of the story.
Imagine, for instance, that the initial density is an increasing function.
As before, we determine the density at later times using the shear rule:
Now that the initial density is increasing, we have faster moving points on the wave trailing slower moving points. Eventually the faster moving points overtake the slower points, which leads to an impossible result: the density at some points appears to take on three distinct values.
In actuality, this introduces a discontinuity, called a shock wave, in the density as seen here.
Anyone who's driven on a highway is familiar with this situation. One moment we're driving at a reasonable speed with low density when we notice that the traffic ahead of us is very dense and moving slowly. We need to quickly slow down and get in the line of slowly moving cars. We have then passed through the shock wave.
We may determine where the shock wave appears using our original conservation law. Remember that the area under the density graph measures the number of cars in an interval. Since the number of cars before and after the appearance of the shock wave is unchanged, the shock wave appears at a location where the red and green areas depicted below are equal.
It's not hard to see that this condition determines the speed with which the shock wave moves. Suppose that $d_1$ and $d_2$ are the densities on either side of the discontinuity and $v_1$ and $v_2$ the velocities.
If $s$ is the speed at which the shock wave is moving, cars on either side move with relative speeds $v_1-s$ and $v_2-s$. Since the rate at which cars flow into the shock wave equals the rate at which they flow out, we have $$ (v_1-s)d_1 = (v_2-s)d_2. $$ This implies that the speed of the shock wave is $$ s = c(1-d_1-d_2) = \frac{c(1-2d_1) + c(1-2d_2)}{2}. $$ In other words, the shock wave moves at the average of the speeds on either side of the shock.
Applying this principle along with the shear rule, we can understand how the density evolves when a traffic light changes from green to red. Suppose that the density is initially constant, meaning that traffic is moving smoothly through the light when the light turns red. This time is represented below when the animation begins. Notice that the motions of the two resulting shock waves describe how the traffic piles up behind the light and how the traffic clears out in front of the light.
|
|
We can use the shear rule to predict when a shock wave will appear. Consider the figure below.
We find the point on the initial density graph having the largest slope and draw its tangent line. The horizontal intercept $\overline{x}$ of the tangent line defines the distance $L$ as shown. Now $\overline{x}$ moves to the right with speed $c$, and the shock wave occurs when $\overline{x}$ has traveled a distance $L$, at which time the tangent line becomes vertical. This means that the shock wave first appears when $t = L/c$.
Timing traffic lights
What we've seen so far has, for the most part, confirms our intuition for how traffic should flow. Is there anything new we can learn from this model?
At one time or another, we've all been stuck at a poorly timed light where the signal is not green long enough to allow traffic to clear out behind the light before turning back to red. Our theory can help us determine the optimal timing for the signal.
The next animation will help clarify the situation we are interested in. Initially, traffic is flowing smoothly through a green light, but once the animation begins, the signal turns red and traffic backs up behind the light. Eventually, the signal turns back to green and traffic behind the light begins to clear.
|
|
We can determine how long it takes for the traffic to clear behind the light, which tells us how long the signal should stay green to allow this to happen.
To begin, we will call $T_r$ the amount of time the signal is red and $T_g$ the amount of time the signal is green. We choose $t=0$ as the time when the signal changes from red to green.
At $t=-T_r$, traffic is moving smoothly through the light with a uniform density we denote by $a$. Then the signal turns to red.
At $t=0$, the signal turns back to green, but traffic is now backed up behind the light due to the shock wave moving left away from the light. If the light is at position $x=0$, then the shock wave has moved with velocity $c(1-1-a)=-ca$ meaning traffic is backed up to $x=-caT_r$.
When $t\gt 0$, this shock wave continues moving left with velocity $-ca$. However, the point $P,$ shown in the figure below, moves left with velocity $-c$ and will eventually overtake the shock wave.
We call $t_0$ the time at which $P$ overtakes the shock wave.
Before $P$ overtakes the shock wave, $P$ has moved to $x=-ct$ while the shock is at $x=-caT_r-cat$. The time $t_0$ occurs when these positions coincide: $$ -ct_0 = -caT_r - cat_0, $$ which tells us that $$ t_0 = \frac {a}{1-a}T_r. $$ The position at which this occurs is $x_0 = -ct_0$.
As $t$ increases beyond $t_0$, we find the density profile shown below.
Let's focus on the motion of the point $(x,d)$, which lies on the shock wave and therefore moves with velocity $c(1-d-a)$ so that $$ \frac{dx}{dt} = c(1-d-a). $$ Using similar triangles, we have $$ \frac{d-1/2}{-x} = \frac{1/2}{ct}, $$ which means that $$ d = -\frac{x}{2ct} + \frac 12. $$ This tells us that $x(t)$ satisfies the linear differential equation with initial value: $$ \begin{aligned} \frac{dx}{dt} & {}={} \frac{x}{2ct} + c\left(\frac12 - a\right) \\ x(t_0) & {}={} -ct_0 \\ \end{aligned} $$
Solving this initial value problem is fairly straightforward and leads to $$ x(t) = c(1-a)t - 2c(1-a)\sqrt{t_0}\sqrt{t}. $$
Now the traffic behind the light clears when $x(t) = 0$, which leads to $$ t = \left(\frac{(1-a)}{\left(\frac12-a\right)}\right)^2t_0 =\frac{a(1-a)}{\left(\frac12-a\right)^2}T_r. $$ This is the optimal time to turn the signal red so we'll set $$ T_g = \frac{a(1-a)}{\left(\frac12-a\right)^2}T_r. $$
Of course, we need $a\lt 1/2$ if we want the traffic to clear; otherwise, the shock wave keeps moving left away from the light. This could be the case if there is an accident on a busy highway at rush hour. Even after the accident is cleared, the backup persists for a long time.
If, for instance, we have $a=1/4$, then $T_g = 3T_r$. In other words, with a density of $1/4$, the signal needs to stay green for 3 times as long as it is red in order for the traffic to clear behind the light. This is the situation illustrated in the animation near the beginning of this section.
If we want the signal to stay green for the same amount of time that it is red, we need $T_g=T_r$ or $$ \frac{a(1-a)}{\left(\frac12-a\right)^2} = 1. $$ This happens when $a=(2-\sqrt{2})/4$, which is a density of about 15%. In this case, cars are separated by roughly six car lengths. Next time you're driving around town, think about whether this seems reasonable.
Summary
This is clearly a simplistic model for traffic flow. We know, for instance, that the assumption that the velocity is a linearly decreasing function of the density is overly optimistic. We also haven't attempted to include reasonable features such as additional lanes or traffic entering or exiting the highway. These problems have all been studied mathematically.
This model of traffic flow does have some real advantages, however. The equation of continuity, $$ \frac{\partial d}{\partial t} + c(1-2d) \frac{\partial d}{\partial x} = 0, $$ is an example of the type of quasilinear partial differential equation that appears in many physical situations. The simplest example of such an equation is $$ \frac{\partial u}{\partial t} + c \frac{\partial u}{\partial x} = 0, $$ which is a version of the one-dimensional wave equation. In this case, every point on the wave moves with the same speed $c$ so the wave at a later time is obtained by simply translating the original wave.
Equations of the form $$ \frac{\partial u}{\partial t} + c(u) \frac{\partial u}{\partial x} = 0, $$ such as the model of traffic flow we studied here, appear frequently in fluid and gas dynamics. In this case, the velocity with which a point on the wave moves depends on the height of the wave, and it's possible to create the type of shock waves that we've seen here. Examples of this in the physical world include the breaking of an ocean wave into a white cap and a sonic boom.
The model presented here, though quite simplistic, allows us to gain insight into these phenomena. For more general equations, the analysis needed to describe the evolution of a wave can be more complicated. However, the specific equation we have studied allows us to use the shear rule as a geometric tool that bypasses some of the analysis. Considering traffic flow also provides an intuitive context for thinking about these issues.
Oh, and I made my flight despite the traffic!
References
-
Paul Richards. Shock Waves on the Highway. Operations Research. Vol. 4, No. 1 (February, 1956), 42-51.
Richards introduced the model for traffic flow that we considered here and described the shear rule and the evolution of shock waves.
-
M.J. Lighthill and G.B. Whitham. On kinematics waves I. Flood movement in long rivers. Proceedings of the Royal Society A. 229 (1955) 281-316.
M.J. Lighthill and G.B. Whitham. On kinematics waves II. A theory of traffic flow on long crowded roads. Proceedings of the Royal Society A. 229 (1955) 317-345.
This pair of papers presents a general theory of wave motion and includes traffic flow as a detailed example. The second paper considers the question of how the velocity depends on the density and provides some evidence for the model used here: $v=c(1-d)$.
-
Helge Holden and Nils Henrik Risebro. A mathematical model of traffic flow on a network of unidirectional roads. In Nonlinear Hyperbolic Problems: Theoretical, Applied, and Computational Aspects. A. Dontao, F. Oliveri (editors). Vieweg+Teubner Verlag. 1993.
Here is a more sophisticated model of traffic flow on a network of interconnected roads.
-
Richard Haberman. Mathematical Models: Mechanical Vibrations, Population Dynamics, and Traffic Flow. Society of Industrial and Applied Mathematics. Philadelphia. 1998.
-
Gerald Whitham. Linear and Nonlinear Waves. Wiley. New York. 1999.