Skip to content

Add Smart Traffic Light Example#369

Open
FedericoCelauro wants to merge 11 commits intomesa:mainfrom
FedericoCelauro:add-traffic-light-model
Open

Add Smart Traffic Light Example#369
FedericoCelauro wants to merge 11 commits intomesa:mainfrom
FedericoCelauro:add-traffic-light-model

Conversation

@FedericoCelauro
Copy link

@FedericoCelauro FedericoCelauro commented Mar 9, 2026

Summary

This PR adds a new example model. It's a very simple modellization of traffic flow at an intersection that can show how smart traffic light control can reduce the wait time of the cars.

Motive

This is a very easy traffic model that can be made using meta agents.

Implementation

In the model, both cars and traffic lights are agents that interact with each others. On top of them, I implemented a meta-agent called IntersectionController, that can change the status of the traffic lights based on the number of cars waiting in line.

Usage Examples

To run the example usage do

    $ cd examples/smart_traffic_lights
    $ python run_example.py

To run the interactive Solara simulation please do

    $ cd examples/smart_traffic_lights
    $ solara run app.py

Additional Notes

Being a simple model, this can be made much more complex implementing, for example, smarter traffic lights controls, larger road systems, non periodic boundary conditions and many more. It can be easily implemented using experimental meta agent class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant