by Dirk Brockmann

This explorable features an agent based model for road traffic and congestion. The model captures a phenomenon that most of us have witnessed on highways: phantom traffic jams, also known as traffic shocks or ghost jams. These are spontaneously emergent congested segments that move slowly and oppositely to the traffic. The explorable illustrates that phantom jams are more likely to occur if the variability in car speeds is higher:

So, if say 90% of the cars try moving at 120 km/h and 10 percent at 150 km/h, everyone might end up going 80 km/h on average. Whereas if everyone travelled at about 120 km/h no reduction of collective traffic flow occurs.

Press Play and keep on reading….

This is how it works

In the model 80 cars move on a two lane highway (the highway has a funky shape, but that is only so we can fit a longer strip into the display box. The highway is also endless but finite, like a circle, unlike a sausage).

Intitially the cars are at rest and distributed in both lanes equidistantly. Each car has an individual prefered speed $v_0$. This is the speed a car wants to go and would do so without any obstables. Initially, each car has the same prefered speed.

If you press Play for the first time, you will see that all cars start accelerating until the prefered speed $v_0$ is attained. The prefered speed is fixed. The actual speed of a car $v(t)$ changes over time.

Only a few rules govern the system:

  1. Every car tries to accelerate to reach its prefered speed.
  2. If a car gets too close to the car ahead it stops accelerating, speed is reduced to avoid a collision.
  3. To avoid a crash all cars can also switch lanes but only if the other lane is sufficiently empty in the vicinity (no cars in the rear view mirror).
  4. When a car (say car A) is going at a speed less than its prefered speed, $v(t)< v_0 $, because another car (say car B) is blocking it, and if car B starts accelerating, car A waits until a distance $S$ seperates the two until it starts accelerating, too.


With the sliders you can modify three parameters of the system. With the acceleration slider you can set how quickly a car reaches its prefered speed. The intertia slider determines how quickly a car starts moving when the road ahead clears up.

The most important slider is the speed variability slider. With this one you can set the distribution of prefered speeds in the set of cars. At the default setting speed variability is zero, every car has a prefered speed of $v_0 = 120$ km/h. When you increase variability, each car is assigned a different prefered speed in the range $120 - 150$ km/h. If you turn color prefered speed on, the cars are colored from white to red according to their invididual prefered speed.

Normally the cars can switch lanes. You can switch passing off with the corresponding toggle. If you highlight passing events, passing cars are colored blue making it easier to see these events.

Try and observe this

Reset the system (button with arrow to the left) and the parameters to their default value (button with the circular arrow) and press play. All cars will accelerate to their prefered speed. Because every car does exactly the same, the seperation between cars remains constant and everything flows well. You can see the average speed $\left< v(t) \right>$ in red in the speedometer.

Now increase the speed variability to its maximum value and observe first what happens in the speedometer. Now every car is trying to go at its individual prefered speed in the range 120-150 km/h. Each car’s speed is depicted in the speedometer as a grey line. Initially the population’s average speed increases as expected. But after a transient period the first ghost jams emerge. Some cars slow down and even come to a stop, the average speed drops down significantly.

Even if you go back to a situation in which every car has the same prefered speed, the traffic jams persist for a long time.

You can also see how the tail of a the ghost jam travels in the direction opposite to traffic flow.

Try experimenting with the cars’ acceleration and the cars’ inertia to explore the effects of these parameters. You can also figure out in which way the ability to switch lanes affects the traffic flow.

A note on Mr. Scheuer

Here’s some information for those of you unfamiliar with German politics. In Germany, we have no speed limit on highways, more precisely, on a substantial fraction of highways. Some people believe this is a good idea. In the context of carbon emission, other detrimental impacts on the environment and the death toll on German roads, a questionable attitude.

One argument, of course, is the idea that a speed limit would slow traffic down. The guy in charge of this sort of thing is Andreas Scheuer the secretary of the Federal Ministry of Transport and Digital Infrastructure. Mr. Scheuer is not the sharpest tool in the shed. Busy dealing with affairs concerning the validity of his academic title (see this article, it’s in German) he has no time to grasp the intricacies of basic traffic flow dynamics. Potentially a reason why Mr. Scheuer, contrary to advice by leading experts, strongly opposes a speed limit on German highways. He also thinks that combustion engines are the future.

I do hope that Mr. Scheuer will stumble upon this little explorable by chance although my hopes concerning his intellectual capacity to understand the model are limited. If you read this feel free to point the explorable out to Mr. Scheuer, maybe even DM him on Twitter: AndiScheuer.

The other Dirk

This explorable was inspired by my friend, colleague and expert on traffic dynamics (among many other topics) Dirk Helbing. In his talks, Dirk often shows a slide of cars that move in a circle in which ghost jams and stop-and-go situations naturally emerge even though the drivers are instructed to avoid them. Thank you, Dirk! An excellent book that contains many models and theoretical background is one of Dirk’s : Social Self-Organization.

Related Explorables:

Horde of the Flies

The Vicsek-Model

Horde of the Flies

The Vicsek-Model

The walking head

Pedestrian dynamics

The walking head

Pedestrian dynamics

T. Schelling plays Go

The Schelling model

I herd you!

How herd immunity works