{"id":22895894,"url":"https://github.com/daniel-lima-lopez/dynamic-state-traffic-lights","last_synced_at":"2025-05-12T15:44:02.668Z","repository":{"id":242762859,"uuid":"807748364","full_name":"daniel-lima-lopez/Dynamic-State-Traffic-Lights","owner":"daniel-lima-lopez","description":"This work consists of a dynamic state traffic light controlled by a neural network. The training of this model is carried out by genetic algorithms in a simulation environment.","archived":false,"fork":false,"pushed_at":"2024-08-02T03:12:02.000Z","size":10482,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T23:39:03.255Z","etag":null,"topics":["deep-learning","genetic-algorithm","genetic-algorithms","neural-networks","python","sumo","tensorflow","trafic-light"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daniel-lima-lopez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-29T17:37:15.000Z","updated_at":"2025-02-19T03:11:49.000Z","dependencies_parsed_at":"2024-08-02T00:48:31.271Z","dependency_job_id":"5c1526f0-fe6b-4cfb-85a4-e4cc471f1ff2","html_url":"https://github.com/daniel-lima-lopez/Dynamic-State-Traffic-Lights","commit_stats":null,"previous_names":["daniel-lima-lopez/dynamic-state-traffic-lights"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-lima-lopez%2FDynamic-State-Traffic-Lights","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-lima-lopez%2FDynamic-State-Traffic-Lights/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-lima-lopez%2FDynamic-State-Traffic-Lights/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-lima-lopez%2FDynamic-State-Traffic-Lights/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daniel-lima-lopez","download_url":"https://codeload.github.com/daniel-lima-lopez/Dynamic-State-Traffic-Lights/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253767433,"owners_count":21961108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","genetic-algorithm","genetic-algorithms","neural-networks","python","sumo","tensorflow","trafic-light"],"created_at":"2024-12-13T23:32:37.763Z","updated_at":"2025-05-12T15:44:02.645Z","avatar_url":"https://github.com/daniel-lima-lopez.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dynamic-State-Traffic-Lights\nThis project presents a proposal to implement a dynamic state traffic light system, which adapts to conditions in real time to optimize the trafic flow.\n\n[This video](https://youtu.be/caAPAvuc0jY) shows a comparison between our trained model and a conventional traffic light system.\n\n\n## Instalation\nIn order to try our model, a basic installation of SUMO is needed (see SUMO oficial installation). Moreover, the Traffic Control Interface and SUMO python libraries must be installed to. You can install these libraries using pip:\n```bash\npip install traci\n```\n```bash\npip install sumolib\n```\nThen, clone this repository:\n```bash\ngit clone git@github.com:daniel-lima-lopez/Dynamic-State-Traffic-Lights.git\n```\nMove to the instalation folder\n```bash\ncd Dynamic-State-Traffic-Lights\n```\n\n## Method description\nThe proposed method consists of a traffic light system whose states are controlled by a neural network, which receives as input the number of cars in each lane and predic the most next optimal state, as desribed in the next figure:\n![alt](imgs/Diagrama.png)\n\nRegarding the neural network training, genetic algorithms are used to optimize the weights configuration. In this approach, the genetic algorithm seeks to minimize the time needed to handle a defined traffic flow. In this way, the algorithm optimizes the neural network configuration to control traffic appropriately.\n\n## Examples\nTo run the simulations presented in the video, you first need to move to [Simulations](Simulations) folder:\n```bash\ncd Simulations\n```\nThe file [sim_base.py](Simulations/sim_base.py) execute a simulation with a conventional traffic lights system. The file [sim_nn.py](Simulations/sim_nn.py) execute a simulation with the same triffic configurations and the proposed method with a previously tranied neural networks, whose weight configuration is in the file [optimo.txt](Simulations/optimo.txt).\n\nTo train the model from scratch, from the installation folder, move to [Traning](Traning) folder:\n```bash\ncd Training\n```\nThe file [genetico.py](Training/genetico.py) contains the traning routine which produces the optimal weight configuration ([optimo.txt](Training/optimo.txt)). It should be considered that the training process takes approximately 6 hours.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-lima-lopez%2Fdynamic-state-traffic-lights","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel-lima-lopez%2Fdynamic-state-traffic-lights","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-lima-lopez%2Fdynamic-state-traffic-lights/lists"}