Optimization of Vehicle Flow Times in a Single Crossing System Through the Development of a Multi-Agent Platform

Optimization of Vehicle Flow Times in a Single Crossing System Through the Development of a Multi-Agent Platform

Martínez Cruz Miguel AngelDorantes Benavidez Humberto Trejo Martínez Alfredo

Escuela Superior de Ingeniería Mecánica y Eléctrica Unidad Zacatenco, Av. Luis Enrique Erro S/N, Unidad Profesional Adolfo López Mateos, Gustavo A. Madero, Zacatenco, Ciudad de México 07738, Mexico

TecNM Campus TESOEM, Paraje de, Isidro S/N, Tecamachalco, Los Reyes Acaquilpan 56400, Mexico

Corresponding Author Email: 
17 June 2021
9 August 2021
31 August 2021
| Citation



We live in a globalized and competitive world where cities face serious mobility problems so it is important to intelligently control vehicular traffic. This article proposes the optimal cycle time that the interface (Traffic Light) must be programmed at the time of having a vehicular load on both axes (x-y) in a system of a single vehicular crossing. Based on the Monte Carlo method as a numerical technique to calculate probabilities on the average times and speeds for each combination performed in the simulator. We used a computer tool based on a programmable environment oriented to models of multi-agent systems, called NetLogo as part of the development of the research, finally describing the overall optimal behavior of the system represented graphically and mathematically.


mobility issues, intelligent traffic control, NetLogo, multi-agent systems, monte Carlo method

1. Introduction

Today, one of the problems of any society has to do with the amount of time it takes for individuals to move from one destination to another no longer as a local problem, but as a global one. Some studies show that cities with high population density tend to have problems with vehicular flow; for example, in Mexico City, according to the TomTom index, motorists spend on average 59 minutes of time stranded in traffic (TomTom International BV, 2018). This results in 227 lost hours a year. In this sense, the company TomTom, of Dutch origin, places a classification of the most congested cities around the world, the percentage of congestion in which Mexico City (Mexico) stands out 66%, Bangkok (Thailand) 61%, etc. [1].

This article proposes in an innovative way the optimal way to program the traffic light to the change of lights, considering the different vehicular loads that could be presented in both axes or routes of the intersection in a real scenario, for this we used a computer tool based on a programmable environment oriented to models of multiagent systems, called NetLogo, the results analyzed after the simulation seem to be encouraging. To this end, it is proposed to respond to the global problem of vehicular traffic by programming a chip, which must contain all the results of the optimal combinations that make vehicular traffic more efficient by changing the red light and the green light of the traffic light in a single-junction system.

2. Revizada Literature

There are different works, in which different proposals have been developed for the solution to the problem on vehicular traffic, the proposal made by Yunrui Bl On control at a single intersection and simulation based on fuzzy logic, which proposes a signal control method for the single intersection based on fuzzy logic Type-2 and GA, the results of the simulation indicate that this method can reduce the length of the tail and the vehicular delay at the intersection [2].

Takashi mentions in his work, the control of vehicular traffic through a sequence of traffic lights placed with a disorderly interval, which exposes to study the dynamic behavior of vehicular traffic, the dynamics of traffic controlled by traffic lights, is described in nonlinear stochastic terms of vehicles that move with their inherent speeds through a sequence of lights positioned with inhomogeneous intervals, and have studied the dynamic behaviors of vehicles varying the cycle and the setback of time, traffic is controllable, speed and randomness, it is shown that agents or automata are controlled by traffic lights at specific values of cycle time [3].

Some related research to improve vehicular traffic, propose the sharing of vehicles [4]. However, due to various social circumstances in practice it becomes difficult to implement, so that our research is oriented to the optimization of speeds in the flow of vehicles using wilinsky's model, programming multiple simulations in the Netlogo program [5].

In its work entitled "Signal control optimization for utomated vehicles at isolated signalized intersections" they use traffic signals at intersections as an integral component of the existing transport system, so that they contribute significantly to the mobility of vehicular traffic, the algorithm assumes that vehicle trajectories can be fully optimized, that is, vehicles will be able to follow the specific routes by a signal controller. (Control, 2016) proposes with the algorithms to identify an order of passage of vehicles to the exchange of light at a traffic light, so that the analysis at multiple intersections is not considered in some investigations [6].

They propose that wireless sensor networks and multiple fuzzy logic controllers, pose a dynamic control of traffic lights that are basically combined in a network of wireless sensors (WSN) designed for real-time traffic with multiple fuzzy logic controllers, working in parallel using wireless sensors designed in (WSN) their purpose is to control traffic in real time. Each diffuse controller directs the movements so where a vehicle must turn and dynamically manages the time it should take to change the light of the traffic light [7].

He says that intelligent transport systems (ITS) are those that focus on the integration of technology and information, as well as their infrastructure to make transport more efficient, recent advances point to a future in which the vehicles themselves take care of the driving tasks, since drivers will not be the ones who cause the bottlenecks, but rather the mechanism by which the circulation of autonomous vehicles through intersections is coordinated. This mechanism is known as autonomous agents in a multi-agent system [8].

They have another point of view, where they comment that autonomous vehicles promise to radically change the mobility of agent-based transport as an appropriate means to shape the future and transport scenarios, including autonomous vehicles. As they see an increasing number of automated vehicles on the market and fully autonomous vehicles are expected to be available in the coming years [9].

They propose a generic platform that allows us to model based on agents dedicated to the management of resources, as free software, aims to facilitate the design of management by activities, as well as the analysis of simulation scenarios, the purpose of modeling called cormas, allows to model the asymmetry of information, manipulation of the agent, modification of behavior, recoil and distribution of information [10].

They comment that a possible goal for transport and regional planning is to design systems through quantitative methods for their planning, the proposal is to speed up travel as well as the distribution and allocation of new routes [11].

A proposal based on vehicular density for the change of lights is made by consulting research on the adaptive control of the semaphore in the intelligent transport system based on wireless sensor networks, proposes an adaptive traffic light control algorithm that adjusts both the sequence and the length of the traffic lights according to the traffic detected in real time and considers a series of traffic factors, such as traffic volume, waiting time, vehicle density, etc., to determine the sequence of the change of lights in the semaphore [12].

The resentful works consider the flow of traffic as a stochastic process in the modelling of road traffic. Computer simulation is a widely used tool to represent traffic systems in engineering applications, group-based control becomes one of signaling technology in recent research being applied in many cities around the world [13].

3. Proposed Work

In particular to perform the analysis of the model of agents for the optimization of the vehicular flow of a single crossing, a computer tool based on a programmable environment oriented to models of multi-agent systems was used, called NetLogo since it allows to interact in a world where behaviors can be characterized. The present work was developed on the platform of the "trafic grind" model.

The problem that exists throughout the world is how to move from a point A, to a point B, effectively in a shorter possible time. The proposal of this paper shows a scope in the programming of the NetLogo program generating 2,500 simulations for each combination; where the number of combinations is given by the following methodology:

$N_{t}=\sum_{T=1}^{99} \sum_{t=1}^{T} \frac{t(t+1)}{2}$      (1)

where, Nt is the total number of interface combinations (semaphores) in green, t shows the time of the green semaphore in the range of 0 < t < T and T the maximum time of the green semaphore.

Equivalently the total number of combinations made of the agents (cars) on the x-axis, (Mi) is given by:

$M_{i}=\sum_{i=1}^{50} \frac{i(i+1)}{2} \mathrm{M}_{\mathrm{i}}=\sum_{\mathrm{i}=1}^{50} \frac{\mathrm{i}(\mathrm{i}+1)}{2}$      (2)

where, i is the number of combinations of cars on the x-axis, in a range of 0 < i < 50. Similarly, the number of combinations of automobiles on the y-axis is defined; however, being a symmetrical process, the study of its combinations is ruled out.

The simulations show several scenarios of the optimal point since it is not unique, the results are encouraging the light was dynamically programmed at the interface (traffic light) with normalized time periods, within that period sub-periods were generated with all combinations of time variables and the number of vehicles obtaining (n) number of finite combinations already normalized within the System , the times of the vehicles waiting to change lights at the intersection are minimal as seen in the normalized, within that period higher were generated with all combinations of the time variables and the number of vehicles obtaining (n) number of finite combinations already normalized within the System , the times of the vehicles waiting to change lights at the intersection are minimal as shown in Figure 1.

Figure 1. Vehicle waiting time

In the programming of the model "traffic grind" the interface is considered to discriminate the number of cars per axis (Cars_ x (Cx)), (Cars_ and (C)), is created a variable of time overall full-time (tT), it is considered one time discrete and normalized with variable Increment (tp) that combined with the variable full-time we provide all the combinations finite potential of the system in the change of lights, it shows the environment of the simulator in the Figure 2.

As method of control is recorded by separately the number of cars that are able to cross through the axis x and the axis and, in the Figure 3. Represent the crossing of vehicles in a single intersection.

Figure 2. Simulator screen

Figure 3. Vehicle intersection

The method Monte Carlo allowed determined by the randomness the number of vehicles on the roads, with it were obtained the probabilities of the flow vehicular and their respective time optimal the Figure 4. It shows a normal distribution of the number of total cars crossing the traffic light (CT) in the relative time tp / tT (Increment_time / Full_time) with mean 0.1898607 and standard deviation 0.08207613 of 2,500 simulations of a single combination of the proposed model (30, 25, 75, 15) [Cars_x, Cars_y, Full_time, Increment time].

Figure 4. Optimal time of a single combination

The results obtained through the programming and simulation of the program show in a successful way how the traffic light should be programmed, which will contain the optimal times where the largest crossing of vehicles is registered with respect to a given period of time, as well as the shortest time of awaiting the change of lights, by synchronizing cycle, thus avoiding the problems of congestion vial.

The results optimos, to the make a total of 2, 250,000 simulations, we obtained the programming optima with which must program Arce the semaphore, the which is shown in the Table 1.

Table 1. Optimal semaphore programming




Full Time (s)

Increment (s)


























Notes: 1. (s) Represents the unit of measurement in seconds.

In the column one sample or n number of identification (ID) for each combination optima resulting, in the second and third column is observed the vehicle load in one scenario probably true, then in the fourth and fifth column is showing the time overall and time of the change of traffic lights.

4. Program Code

He used one list of structure of data to store the information that must contain the semaphore considering all the possibilities of vehicular load on both axles. The programming is performed using lists and you can build new lists starting from lists old, even with the same name, so they will use the command sentence, the elements of the lists in Netlogo may be, in their turn, other lists. to create these "lists of lists" is used again the order sentence, with double bracket, continuation is shown the code of programming:

Code of programming .to-report tiempos_autos[lista2 condicion]

  ;lista2 -> tiempos obtenidos en cada ciclo para carros en el eje x

  ;lista3 -> tiempos obtenidos en cada ciclo para carros en el eje y

  let automaximo 0

  let buscarmaximo 0

  let tiempo_global 0

  let cont 0

  let cont2 3 ;cars

  let fulltime 1; full_time

  let incr 2;increment

  let a 0;fulltime

  let b 0;increment

  let c 0;cars

  let listareturn[]

  let auxiliar 0

  foreach lista2


    if cont2 < (continuo * full_time) * 5


     if condicion = item cont2 lista2


          set auxiliar auxiliar + 1

          if auxiliar < 2


          set a a + (item fulltime lista2)

          set b b + (item incr lista2)

          set c c + (item cont2 lista2)

          set listareturn sentence listareturn (list "[" a b c "]")


E l operation of the program is shown continuation in the Figure 5.

Figure 5. Operation of the NetLogo multi-agent system

5. Data Analysis and Results

You starting of simulations performed in the simulator results show the density vehicular in one junction with the goal of finding the time optimal (TO) of the change of lights the light , which crosses a greater number of vehicles [Total of Cars That cross] max (cct) in one given period of time , and is as per each density of cars are made all the combinations of the vehicular charging and controlling the change of lights the semaphore to determine the max ( CCT ) given by max {cct / (tp / tT)}; and therefore in this point it will be given the combination optimal light in which cross the greater number of vehicles with respect to the time [Time optimized (TO)]; that is, TO (max CcT) = {t$\in$ t⁄T/ CcT is maximum}. We observe that basically two given types of behavior, the first in where it gets a point optimal and B behavior in which it obtained several points optimos and is easy to justify and that, to a certain level of traffic, the vehicles can circulate one speed relatively free, determined by the limits of speed, the frequency of intersections, and other conditions as is shown the operation of the software in the following Figures 6-15.

Figure 6. Simulator graph of the average waiting time of the cars

Figure 7. Graph of the average speed of cars

Figure 8. Graph of the stopped cars

Figure 9. Simulator world

Figure 10. Button where it shows the number of stopped cars

Figure 11. Button where is the sample average cars

Figure 12. Button where the number of waiting cars is displayed

Figure 13. Button is where the car registration is displayed on the X, Y axis

Figure 14. Buttons to restart and run the program

Figure 15. Car counting buttons on the X, Y axis

6. Conclusions

Present study proposes how innovative the programming optimum of a stoplight smart one time that our own simulation is an area rich of work of research and development, which may be part of the infrastructure of information vehicle in any environment. L I data that is shown in the Table 1. It is the programming of the optimal times with which the change of traffic light should be programmed.

This work presents mathematically and graphically the behavior of the times in a virtual environment and gives an answer to the problem of vehicular traffic.



Total number of combinations


Time of the semaphore


X axis


Total number of combinations made


Global system time


Discrete time


Total Cars

tp / tT

Relative time


Optimal Time


[1] Ramírez, B.T. (2018). Califican a la CDMX como la ciudadcon peor tráfico delplaneta. La jornada, pp. 10-11. 

[2] Bi, Y., Li, J., Lu, X. (2011). Singe intersection signal control and simulation based on fuzzy logic. Third International Conference on Intelligent Human-Machine Systems and Cybernetics, pp. 87-89. https://doi.org/10.1109/IHMSC.2011.91

[3] Takashi, N. (2006). Control of vehicular traffic through a sequence of traffic lights positioned with disordered interval. Physical A: Statistical Mechanics and Its Applications, Elsevier, 368(2): 560-566. https://doi.org/10.1016/j.physa.2005.12.031

[4] Armendáriz, M., Burguillo, J.C., Peleteiro-Ramallo, A., Arnould, G., Khadraoui, D. (2011). Carpooling: una simulación de múltiples agentes en Netlogo. ECMS.

[5] Wilinsky, U. (2003). NetLogo Traffic Grid Model. Available: http://ccl.northwestern.edu/netlogo/models/TrafficGrid. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

[6] LI, Z.F., Elefteriadou, L., Ranka, S. (2014). Signal control optimization for automated vehicles at isolated signalized intersections. Transportation Research Part C, 49: 1-18. https://doi.org/10.1016/j.trc.2014.10.001

[7] Collotta, M., Lo Bello, L., Pau, G. (2015). A novel approach for dynamic traffic lights management based on wireless sensor networks and multiple fuzzy logic controllers. Expert Systems with Applications, 42(13): 5403-5415. https://doi.org/10.1016/j.eswa.2015.02.011

[8] Dresner, K., Stone, P. (2008). A multiagent approach to autonomous intersection management. Journal of Artificial Intelligence Research, pp. 591-656. 

[9] Boesch, P.M., Ciari, F. (2015). Agent-based simulation of autonomous cars. 2015 American Control Conference (ACC), pp. 2588-2592. https://doi.org/10.1109/ACC.2015.7171123

[10] Bommel, P., Becu, N., Le Page, C., Bousquet, F. (2016). Cormas: An Agent-Based simulation platform for coupling human decisions with computerized dynamics. Simulation and Gaming in the Network Society, pp. 387-410. http://dx.doi.org/10.1007/978-981-10-0575-6_27

[11] Nagel, K., Raney, B. (2004). Complex systems applications for transportation planning. The Real and Virtual Worlds of Spatial Planning, 306-309. https://doi.org/10.1007/978-3-662-10398-2_16

[12] Zhou, B., Cao, J., Zeng, X., Wu, H. (2010). Adaptive traffic light control in wireless sensor network-based intelligent transportation system. 2010 IEEE 72nd Vehicular Technology Conference - Fall, pp. 1-5. https://doi.org/10.1109/VETECF.2010.5594435

[13] Jin, J., Ma, X.L., Kosonen, L. (2017). A stochastic optimization framework for road traffic controls based on evolutionary algorithms and traffic simulation. Advances in Engineering Software, 114: 348-360. https://doi.org/10.1016/j.advengsoft.2017.08.005