How not to waste 4 months in traffic — a strong case for smart traffic lights

Turning Leuven into an accessible and traffic-safe city.

Pieter Portauw - 21/2/2022

Four months.
The average person spends four months of their life in traffic, waiting at red lights.
Four months of living, laughing and loving wasted sitting in your car, polluting the environment. Four months of your life you're never getting back.

But what if we told you we could give you back those four months?

*Flashback to November 29, 2019*

Our innovation group, Raccoons, is hosting its very first 24-hour hackathon (dubbed the Raccathon™️). With the topic of the Raccathon being Smart Cities, Mohamed Ridouani, the mayor himself, was kind enough to drop by and give us the green light (pun intended). In his speech about the future of our city, he shares his ten top priorities, number three of which is to turn Leuven into an accessible and traffic-safe city.

Mayor Mohamed Ridouani's ten top priorities.
Mohamed Ridouani's ten top priorities.

Queue team "Smart Traffic Lights"!

Smart traffic lights?

Smart traffic lights. Traffic lights connected to the traffic on and around an intersection through one or more sensors, allowing them to remain green for as long as vehicles keep approaching, and to skip green phases when fewer or no cars are detected.

The concept is all but new: many cities are currently implementing this type of traffic lights or have already done so. Antwerp, for example, wants an entirely new traffic computer to control all of its traffic lights by 2020, while Hasselt is investing 150.000 to 300.000 euros in smart traffic lights at three points on the Slachthuiskaai to allow smooth passage for its emergency services.

The advantages

It's not at all surprising that cities want to invest in smart traffic lights, because by improving the flow of traffic:

  • They reduce air pollution, as motor vehicles collectively cause 75% of carbon monoxide pollution, one-third of the air pollution that produces smog, and 27% of greenhouse gas emissions. Together, lung cancer (3,39%) and respiratory disease (11%) make up about one-seventh of all deaths in Flanders.
  • They may prevent some of the nearly 40.000 traffic accidents in Flanders annually.
  • And they could save four months of your precious time you would otherwise have wasted waiting for the damn thing to turn green when there's nobody else at the intersection.

But with these advantages, as always, come challenges.

The challenges

One major challenge when developing smart traffic lights is the relatively new GDPR, which defines the following seven principles we need to adhere to when processing data:

  1. Lawfulness, fairness and transparency — Drivers should be informed that their vehicles are being detected and for what purpose, e.g. with a road sign.
  2. Purpose limitation — The data we use for optimizing green phases should only be used for that exact purpose, and not for e.g. speed registration.
  3. Data minimization — We should only detect a vehicle's presence, not its license plate, speed, or pictures of the driver's face.
  4. Accuracy — Data should be kept accurate and up to date.
  5. Storage limitation — Possibly identifying data should only be stored for as long as is absolutely required, i.e. from the moment a vehicle approaches an intersection until the moment it leaves it.
  6. Integrity and confidentiality — Processing must be done in such a way as to ensure appropriate security, integrity, and confidentiality, e.g. by using encryption.
  7. Accountability — We are responsible for being able to demonstrate GDPR compliance with all of these principles.

For the purpose of our Raccathon, we limited the scope of our simulation to cars, and kept pedestrians and cyclists out of the equation. Additionally, instead of using sensors to detect cars approaching and leaving intersections, we used AI models. This lack of sensors (and therefore user data) takes away our responsibility of conforming to the GDPR.

Another challenge is making the whole thing self-steering. And that's where the AI (in this case Reinforcement Learning) comes in. More on that later.

The prototype

For our prototype, we used SUMO (Simulation of Urban MObility, a road traffic simulation package) as our interface, along with NETEDIT, a visual network editor, to create a network resembling Leuven's roads system. SUMO-RL was used as the "glue" between the two, connecting the Reinforcement Learning to our roads.

In layman's terms: we used simulation software with drawing software to draw a rudimentary map of Leuven more or less on top of an actual map, and then we used some more software to teach our lights (or rather, have them teach temselves) how to be smart.

Here's what that looks like for the Brusselsepoort:

Traffic at the Brusselsepoort during the morning rush
Brusselsepoort morning rush - Left: Without smart lights - Right: With smart lights

With our roads and traffic lights in place, all we need now are our vehicles!

In an attempt to mimic a real morning rush, the trajectories of our cars are pseudo-randomised: the vast majority of the cars in our simulation spawn (or appear) outside the city and attempt to make their way inside. Once they reach their destination, they despawn and are removed from the simulation. As the simulation is running, we keep track of the number of loaded, departed, running, arrived and discarded vehicles:

The numbers behind our simulation.
The numbers behind our simulation.

While regular, "dumb" traffic lights follow a fixed "rhythm" of m seconds of green light followed by n seconds of red light, our smart lights adapt their rhythm to the different times of day and differing numbers of vehicles at an intersection. To do so, they use AI (Reinforcement Learning) in order to minimize waiting times and travel times.

This gives us the following graphs:

Total waiting time over time - Left: Without smart lights - Right: With smart lights

As you can see, without smart lights the total waiting time of vehicles would keep increasing. With our smart lights, however, this waiting time effectively decreases by four orders of magnitude.

Conclusion

While impressive at first glance, our so-called "smart lights" are obviously a gross over-simplification of the actual traffic situation in and around Leuven.

We realise all too well that, as proven in the pilot project that was announced in 2009, implemented in 2014 and in 2016 was found to actually have delayed traffic, there is much, much more to traffic than just cars going from point A to point B and lights switching from red to green and back.

But we shouldn't be discouraged by these failures. If anything, we should learn from them, because what better way to learn than through failure? The city is eagerly looking for solutions to make its inhabitants lives as sustainable as possible and we are happy to lend a hand wherever needed!

Overview