Inspiration
Urban traffic congestion is one of the biggest daily frustrations for city dwellers.We’ve all waited at a red light even when there’s no vehicle on the other side. That inefficiency inspired us to build an AI-based system that helps traffic lights learn when to stay green and when to change — reducing waiting time, fuel consumption, and pollution. Our goal is to make traffic lights think, not just blink.
What it does
Traffic Light Optimizer uses Reinforcement Learning (RL) with Proximal Policy Optimization (PPO) to control signal timing dynamically based on real-time traffic flow.
We simulate a 4-way junction in SUMO (Simulation of Urban Mobility), where each lane has cars arriving at random intervals. The RL agent observes the environment — such as the number of vehicles, queue lengths, and waiting times — and then decides whether to extend or switch the green phase.
The agent’s objective is to minimize total vehicle waiting time.
How we built it
1 Simulation Setup:
-> Created a 4-way intersection network in SUMO. ->Defined routes and vehicle flows using XML route files. ->Used TraCI (Traffic Control Interface) to fetch real-time traffic data.
2 Environment Design:
->Built a custom Gym-style environment (TrafficLightEnv) that connects SUMO with the PPO agent. ->Defined states, actions, and rewards: =>State: queue lengths, waiting times, current phase =>Action: switch or hold current signal
=>Reward: negative of total waiting time
3 Agent Training:
->Used Stable Baselines3 (PPO) for training. ->Tuned hyperparameters like learning rate, discount factor, and episode length. ->Logged performance in TensorBoard to visualize training progress.
- Evaluation & Visualization:
->Compared PPO agent vs fixed-timer control. ->Visualized both in SUMO GUI to observe smoother, adaptive signal switching.
Challenges we ran into
- Connecting SUMO with Python RL environment 2.Balancing between waiting time reduction and stable switching (to prevent flickering). 3.SUMO simulations are slow 4.Ensuring the RL agent and SUMO simulation remained in sync across episodes.
What we learned
How Reinforcement Learning can solve real-world control problems. Integration of SUMO, Python, and Stable Baselines3. Designing reward functions that reflect real-world goals. Handling asynchronous communication between simulators and ML models.
What's next for Traffic Light Optimizer
Extend to multi-intersection city grids. Incorporate IoT sensors or real-time CCTV feeds for live traffic data. Use Graph Neural Networks (GNNs) for multi-agent coordination between intersections. Deploy trained model on edge devices or Raspberry Pi for field testing.
Log in or sign up for Devpost to join the conversation.