Inspiration
Everybody in Munich has experience with the slow traffic, especially during rush hour. The Braess paradox demonstrates that taking the shortest path may not always be the best decision. Using this principle, one could imagine traffic to flow smoother than ever before. Our simulations show the effect, and the App brings it to the drivers.
What it does
Munich Traffic Optimizer simulates thousands of vehicles navigating in and around Munich, comparing two routing strategies:
- INDIVIDUAL Routing: Each driver independently chooses the shortest path based on free-flow travel times (ignoring congestion)
- SOCIAL Routing: Drivers sequentially choose routes that consider current traffic congestion, optimizing for collective benefit
- MIXED Routing: Most realistic simulation where only a portion of the users take the smart route and the rest stick with their individual choice.
The simulation uses real OpenStreetMap road network data and visualizes traffic flow with heat maps, showing which strategy reduces total travel time. Using configurations on numbers of participants, congestion models, added delays and social participation, different traffic configurations can be tested.
Using this knowledge, we propose an App designed for people that travel through Munich by car during rush hour. The user predefines the routes he is taking during that periods. We collect all registered users starting points, targets and arrival times. With our traffic simulation, we create a routing strategy for all users, potentially leading to some users having to take longer paths. Users which take that burden are awarded with a monetary compensation.
Who is going to pay those compensations? The constant traffic jams in Munich cost the city around 300 Million Euros. Through investing into incentives, the city could drive those costs down and even profit from them, not only in monetary means, but also happier, less stressed citizens.
Problem of Voluntarism Naturally, not everyone is a fan of this altruistic behaviour. But as our traffic simulation shows, it only needs a small percentage of people to improve the traffic network for everyone. And those who participate using the app also profit financially.
How we built it
- Python 3.11 - Core language with Poetry dependency management
- OSMnx - Downloads real road network data from OpenStreetMap and convert into a graph
- NetworkX - Graph algorithms and bidirectional Dijkstra pathfinding
- Streamlit - Interactive web interface with real-time parameter controls
- Matplotlib - Traffic flow heat map visualization
Challenges we ran into
BPR (https://blog.truegeometry.com/app/geometry/2023/06/28/BPRFunctionNetworkAnalysis.html) Parameter Visibility: Initial implementation had parameters (α, β) that didn't visibly affect results. Solution: Reduced road capacities by 75% and added 2×α multiplier to amplify congestion effects.
Performance Bottlenecks: Initial implementation took ~120 seconds for 10,000 participants. Solution: Inlined BPR calculations in hot loops, pre-calculated delay cache, module-level imports, reduced RNG calls. Overall, we achieved ~60% total speedup.
Thread Safety: Parallel execution caused race conditions with shared graph state. Solution: Deep copy graph structures for each simulation thread.
Accomplishments that we're proud of
We can successfully demonstrate a significant improvement in the SOCIAL mode; the MIXED setting performs as expected, falling between the other two modes. This improvement is significant enough to actually make a difference in the real world.
What we learned
Traffic optimization on real world data is not as easy as we thought, but nevertheless the possible improvements are tremendous. We learned alot about traffic simulation, graph algorithms and endurance.
What's next for Munich Traffic Optimizer
Mobile Application Prototype: Develop and deploy the mobile app. Dynamic Trip Updates: Implement the ability to handle real-time changes (e.g., a road closure, an accident) within the simulation. This requires transitioning from a static one-shot optimization to a dynamic re-routing algorithm that adjusts for ongoing events. Advanced Congestion Pricing/Incentive Models Integrating Public Transport: It helps to eliminate the problem altogether and needs to be taken into account.
Built With
- matplotlib
- networkx
- openstreetmap
- osmnx
- python
- streamlit
Log in or sign up for Devpost to join the conversation.