# Traffic jam science and visualization

# Ever been stuck in traffic and thought — if others drove better I wouldn’t be here? German physicists Kai Nagel and Michael Schreckenberg came up with a fundamental breakthrough in understanding and modeling the emergence of traffic jams. It turns out, traffic jams are not isolated events, in fact, they are extremely predictable.

Skanda Vivek

In the Nagel-Schrekenberg model, cars are simulated as discrete objects on a grid of cells. At every time step, vehicle positions are updated according to 4 simple rules:

**Speed limit:**All vehicles drive at speeds between 0 and the speed limit. In the original paper the speed limit is ‘5’, so vehicles drive between 0 and 5.**Acceleration to speed limit:**At every time step, vehicle speeds are updated to their current speed +1, as long as it is below the speed limit.**Slowing down if too close to the vehicle in front:**If a vehicle is going to crash into the vehicle in front given its current speed, it is slowed down so as to not crash. For example, say at time*t*, a vehicle is 3 cells away from the vehicle in front of it and its current velocity is 4. The velocity of the vehicle is slowed down to 2 so that it moves only a distance 2 cells from time t to time t+1, so as to not overlap with the vehicle in front (not cause an accident).**Random slowing:**At every time step, a vehicle reduces its velocity by 1 with a certain probability,. If p=0.5, then every vehicle has a 50% chance of slowing down at every timestep. In this case if the velocity is 3, it is reduced to 2, 50% of the time. This represents the human imperfection aspect, that nucleates traffic jams.*p*

In the video, you see vehicles moving to the right and jams nucleating (patches of red vehicles) combined with bursts of fast moving vehicles (green). This captures stop-and-go traffic jams. Density of 0.35 denotes that 35% of cells are occupied by vehicles. If you have a 100 cell grid, that means 35 of them are filled with vehicles.

**Space-time plots to visualize traffic jams**

A common way to visualize traffic flow is a space-time plot. Dark black regions illustrate vehicle density waves. The negative slope shows that an initially upstream traffic jam that originates at time t=0 propagates downstream at later times. E.g. the jam originating at position 80 affects position 30 at t=100.

**What is the origin of traffic jams?**

As the number of vehicles increases, velocity reduces. Above around density of 0.2, there is a sharp decrease in velocity. This is because at density of 0.2, the average spacing between each vehicle is 1/0.2=5.

Why is the number 5 familiar? It’s because 5 is the maximum possible speed! Hence above that density, vehicles start to feel the effects of the vehicle in front, and need to slow down in response.

The flux density plot is another great way to understand the point at which traffic jams emerge. Flux measures the number of vehicles per time that pass through a given point, (vehicle throughput). It's basically **the sum of velocities for all vehicles within a certain distance**.

At low densities, every vehicle is basically traveling at the speed limit so flux increases linearly with density. However, at larger densities, vehicles can’t travel at the speed limit and at a certain point (here density = 0.2), the effect of a larger number of vehicles is countered by each vehicle traveling at a smaller speed, resulting in a reduced flux.

There’s an optimal vehicle density (number of vehicle per distance), which maximizes vehicle throughput.

**Traffic jams in the real world**

The Nagel-Schrekenberg model is great in that it captures key features of traffic. But what do these plots look like in the real-world? And how do they translate to real distances and speeds?

On June 15th, 2005 researchers for the NGSIM program collected detailed vehicle trajectory data on southbound US 101, also known as the Hollywood Freeway, in LA.

The space time plots show the distinct waves associated with traffic jams. Similar to the Nagel-Schrekenberg model, a jam initially nucleated at 0.5 km upstream eventually makes it downstream to 0.1 km after 100 seconds or so.

The flux-density plot from vehicle trajectory data looks pretty similar to the Nagel-Schrekenberg plots. However you see the units are different. In the real world, flux starts to drop down at density around 30 vehicles/km/lane.

Why is that point special? A quick back of the envelope calculation shows that 30 vehicles/km/lane corresponds to 1000/30=33 m between every vehicle on average. A vehicle traveling at 65 mph (30 m/s), has 33/30 seconds — essentially a second to reach the vehicle in front. **If for some reason the person in front were to suddenly stop, you have a second to react**.

Vehicles start to slow down at a density of 30 vehicles/km/lane as it corresponds to 1 second to react to the vehicle in front (driving at 65 mph or 29 m/s).

In conclusion, traffic jams emerge as a consequence of imperfect human driving. The most important of these are the tendency to drive noisily — sometimes someone stops for no reason or does not drive optimally.

The other reason is that we have a finite reaction time which makes us stay apart from the driver in front (usually one second away). Once there are too many vehicles on the road, we get uncomfortably close to the vehicle in front and don’t drive as we would on a free stretch of highway.

The next time you feel **X — **city would have improved traffic if people just drove better, take a good look at the human in the mirror :)

Upvote

Skanda Vivek

Senior Data Scientist in NLP. Creator of https://www.answerchatai.com/

Related Articles