Traffic Light Controller Module Based on Particle Swarm Optimization (PSO)

A traffic light control module base on PSO algorithm has been presented to find the optimal set of adjacent streets that are the candidate to take the green period time providing the best vehicles flow. In our previous work a visual traffic light monitoring module has been presented. This module able to determine the traffic conditions (crowded, normal and empty). The proposed control module should be able to integrate with the previous monitoring module to develop a new complete intelligent traffic light system. Promising results have been obtained via applying the proposed traffic light controller module. The controller module shows its ability to select a set of streets. The green period time will be given to these selected streets to achieve the optimal vehicle flow through the traffic light’s intersections. The results show that the proposed control module improving the flow ratio about 85% to 96% with a different number of traffic lights.


Introduction
Nowadays, vehicular travel is increasing through the world and many countries are facing many problems at traffic light intersection, which are caused many accidents between the emergency vehicle and other vehicle. Traffic light control at the intersection point is a matter of concern in large cities. As the number of road users constantly increase and resources provided by current infrastructures are limited, modern control of traffic will become a very important issue in the future. One way to develop traffic light flows and safety of the current transportation system is to apply a modern traffic light control system [21].
The common technology behind the traffic light controllers are programmable logic controllers (PLC). The PLC is an intelligent device which is capable to work without human interventions at all times, regardless of duration and weather conditions [3,4]. A real time intelligent traffic light control module using Swarm algorithm has been presented in this work to configure many intersections in a city. Different number of intersections and streets have been used to evaluate the proposed module. The proposed traffic light module shows its ability to improve the vehicles flow through these intersections and streets. The vehicles flow improvement reached to 96%.

Swarm Intelligence (SI) Models
Swarm intelligence models are referred to as computational models inspired by natural swarm systems. To date, several swarm intelligence models based on different natural swarm systems have been proposed, and successfully applied in many real-life applications. Examples of swarm intelligence models are: Ant Colony Optimization, Particle Swarm Optimization, Artificial Bee Colony, Bacterial Foraging, Cat Swarm Optimization, Artificial Immune System, and Glowworm Swarm Optimization. In this paper, a Particle Swarm Optimization PSO algorithm will be used to develop the proposed control module [5].

Particle Swarm Optimization (PSO)
PSO is a heuristic global optimization method, originally provided in1995 by Kennedy and Eberhart. Particle Swarm Optimization (PSO) incorporates amalgamate swarming behaviors observed in schools of fish and flocks of birds. Since PSO is a population-based optimization tool, it can be implemented and applied easily to solve various optimization problems or the problems that can be transformed to Particle Swarm Optimization (PSO) optimization problems. The main power of PSO algorithms is its fast convergence as compared with many global optimization algorithms such that Simulated Annealing (SA), Genetic Algorithms (GA), and other global optimization algorithms. In PSO, there are other features such that no complex mathematical functions, no costly mathematical and doesn't require a large amount of memory [6].
Starting from a randomly distributed set of particles (potential solutions), the algorithms try to improve the solutions according to a quality measure (fitness function). The improvisation is performed through moving the particles around the search space by means of a set of simple mathematical expressions which model some interparticle communications. These mathematical expressions, in their simplest and most basic form, suggest the movement of each particle toward its own best experienced position and the swarm's best position so far, along with some random perturbations. There is an abundance of different variants using different updating rules [18]. The general structure of a canonical PSO algorithm is shown in figure (1). Figure 1. General structure of a canonical PSO algorithm [19].
The optimal values for the parameters depend mainly on the problem at hand and even the instance to deal with and on the search time that the user wants to spend on solving the problem [20]. In fact, the main issue is to provide balance between exploration and exploitation tendencies of the algorithm.
Total number of particles, total number of iterations, inertia weight and/or constriction factor, and cognition and social behavior coefficients (c1 and c2) are the main parameters that should be considered in a canonical PSO. The total number of iterations could be replaced with a desired precision or any other termination criterion. In general, the search space of a n-dimensional optimization problem can be conceived as a n-dimensional hypersurface.
The suitable values for a metaheuristic's parameters depend on relative ruggedness and smoothness of this hyperspace.
In general, there are two different strategies for parameter value, selection, namely, off-line parameter initialization and online parameter tuning [20]. In off-line parameter initialization, the values of different parameters are fixed before the execution of the metaheuristic. These values are usually decided upon through empirical study. It should be noted that deciding about a parameter of a metaheuristic algorithm while keeping the others fixed (i.e., one-by-one parameter selection) may result in misleading observations since the interactions of the parameters are not taken into account. However, it is the common practice in the literature since examining combinations of the algorithm parameters might be very time-consuming. To perform such an examination, when desired, a meta optimization approach may be performed, i.e., the algorithm parameters can be considered as design variables and be optimized in an overlying level.
The main drawback of the off-line approaches is their high computational cost since the process should be repeated for different problems and even for different instances of the same problem. Moreover, appropriate values for a parameter might change during the optimization process. Hence, online approaches that change the parameter values during the search procedure must be designed. Online approaches may be classified into two main groups [20]: dynamic approaches and adaptive approaches. In a dynamic parameter updating approach, the change of the parameter value is performed without taking into account the search progress. The adaptive approach changes the values according to the search progress (which it used in this work).
Like the other Evolutionary Algorithms (EA), a PSO algorithm is a population based on a search algorithm with random initialization and there is an interaction between population members. In PSO, each particle flies through the problem space and has ability of remembering the previous best position, outrun from generation to another [7].

Literature Survey
Y. P. Singh, 2013 [8] A novel methodology was described in order to design an inelegant traffic light control system, using image mosaic based design methodology. The data is collected from several CCTV cameras and integrated to match the test image and reference image whose result manipulates the timing of green signal and red signal using a decision-making algorithm. The approach presented in the previous paper might be very beneficial, as it provides an actual data about traffic density, especially at peak hours.
Mojtaba, Iman, and Mohammad, 2014 [9] This research presents an application of fuzzy logic for multi-agent based autonomous traffic light control system using wireless sensors to overcome problems like congestion, accidents, speed, and traffic irregularity. The real-time parameters such as traffic density and queue length are obtained by using image-processing techniques. Thus, On and Off timings for the green, red and or amber lights, adjust to the actual road conditions. This paper describes a fuzzy logic signal controller for a four-way intersection suitable for mixed traffic, including a high proportion of motorcycles. The proposed agent-based approach can provide a preferred solution by minimizing the vehicles' waiting time, especially the emergency vehicles using fuzzy logic control under the situations that normally occur during emergencies. The effectiveness of this approach is tested by taking two traffic junctions.
Zane, 2014 [10] In this work they proposed Agent subsystem which is locally responsible for controlling the time periods to be distributed over time to each intersection, according to the vehicles queue length and give the priority for the side that have the longer queue length of vehicles. The perception for this agent are sensors that evaluate the queue length at each intersection side of the traffic light location, and the effect will be the distributed time for the intersection sides.
Kavya, Jyothi, 2014 [11] An intelligent traffic light system based on fuzzy logic technology was designed, in order to solve the problems of road traffic congestion in large cities in Nigeria, through monitoring and controlling traffic lights. The authors used Java software for building the simulated version of the traffic control system, the results show that the system applied provided better performance in terms of total waiting time as well as total moving time. Used edge detection techniques as a one of image processing technique to find traffic density. Ahmed, et. al., 2014 [12] A mathematical model has been developed to represent the traffic control stochastic environment. The authors determined the optimum/near optimal traffic signal timing values through the application of a genetic algorithm that feeds these values into a developed simulation model to obtain the corresponding queuing parameters. The generated signal timings significantly enhance the traffic performance and alleviate the choke points over a multiple-junction urban network. The authors applied the development approach to a network consisting of two consecutive junctions in Alexandria, Egypt using actual field data. The optimization results show that the proposed model can improve the queuing parameters of the vehicular flow.
Emad, I. Abdul Kareem, et al., 2014 [13] this work uses small associative memory. It will learn all street traffic conditions. The controller uses a virtual data about the traffic condition of each street in the intersection. Thus, in an image processing module this video camera will provide visual information. This information will be processed to extract data about the traffic jam. This data represented in a look -up table, then smart decisions are taken when the intersection management determines the street case of each street at the intersection based on this look-up table.
Ali A. J Adham, Khaled, and Mohammed, 2014 [14] In this study, they plan to construct a Simulation Model (SM) in corporate with the Road Network Design Method (RNDM), Genetic Algorithm system (GAs), and Optimization method. In order to elicit a general diagnosis for the traffic congestion problem in the main urban areas in Malaysia, and to find out the optimal solutions for transportation system problems in Malaysia. The results of this study used to apply optimal transportation policies with the aim of providing useful insights on critical issues about the impact of such policies, and to help as a guide for the Malaysian decision makers to elaborate the optimal transportation policies.
Khaled, 2016 [15] In this study, a new Artificial Intelligence Techniques (AIT) and Simulation Model (SM) are applied in order to elicit a general diagnosis for the traffic congestion problem in Kuala Lumpur and Kuantan. An integrated model involves a Neural Network (NN), Fuzzy Logic (FL), Genetic Algorithm (GA), and Simulation Model (SM) is used. The current traffic demand data will be captured by strategically placed cameras. By receiving and processing data, they plan to use our integrated model to adjust traffic lights, timing to optimize traffic flow in coordinated traffic light systems, in order to minimize the traffic congestion through controlling traffic lights. The results of this study used to suggest and apply more efficient transportation policies with the aim of providing useful insights on traffic congestion problem, and to assist the Malaysian decision makers to elaborate the best transportation policies.

Intelligent Traffic Light Control Module Based on PSO
The proposed control module will be integrated with our previous work [16] which it presented an intelligent a traffic light monitor module. This monitor module supplies a three street conditions of each street in the intersection (i.e. empty, normal and crowded). As well as, an intersections traffic light map need to be supported to the proposed traffic light control module. Though, the input of the proposed control module should be the intersections traffic light map in addition to the outcome of the monitoring module. These two inputs will be used by PSO algorithm to find the optimum set of adjacent streets to assign the green period time to them providing optimal vehicles flow (see Figure (2)). Particle Swarm Optimization (PSO)

Constraint-Handling Mechanism
The proposed control module uses an PSO algorithm to find the optimum set of adjacent streets to assign the green period time to them providing optimal vehicles flow. The constraint handling mechanism has been shown in table (1).

Constraints as a Text Constraints as Pseudocode
Is The PSO will be initially started with a random set of streets to be optimized via PSO algorithm. The particle that has the highest fitness value wins. Accordingly, Table 2 shows all fitness function possibilities, where the parameters have been taken based on street cases which are adopted during traffic light monitor module process, which thus depends to find the fitness function.

The Proposed Control Module Algorithm
The green period time will be given to the optimal series of streets which it the output of the algorithm. PSO is initialized with a group of random particles (solutions) and then searches for optima by updating generations. In every iteration, each particle is updated by following two "best" values. The first one is the best solution (fitness) it has achieved so far. (The fitness value is also stored.) This value is called pbest. Another "best" value that is tracked by the particle swarm optimizer is the best value, obtained so far by any particle in the population. This best value is a global best and called gbest. When a particle takes part of the population as its topological neighbors, the best value is a local best and is called lbest. After finding the two best values, the particle updates its velocity and positions with following equation (2) and (3).
v [ ] is the particle velocity, present [ ] is the current particle (solution). pbest [ ] and gbest [ ] are defined as stated before. rand ( ) is a random number between (0, 1). c1, c2 are learning factors. usually c1 = c2 = 2. The pseudo code of the procedure is as follows: Step 1: For each particle Initialize particle randomly. {which it a set of streets} Step 2: For each particle do Step 2.1: Calculate fitness value. {using equation (1)} Step 2.2: If the fitness value is better than the best fitness value (pBest) in history set current value as the new pBest.
Step 3: Choose the particle with the best fitness value of all the particles as the gBest Step 4: For each particle do 4.1: Calculate particle velocity according equation (2). 4.2: Update particle position according equation (3).

Result and Analysis
The proposed control module has been evaluated using different number of traffic light and streets.

One Traffic Light Cycle
This test has been guided by three scenarios. For each scenario, there are different number of traffic light and streets, the results have been taken for one cycle without taking time into account.

Scenario No. 1
In this scenario, 9 Traffic lights and 36 streets have been considered. Figure 3 shows that the proposed controller has been improved the flow ratio of the vehicles through 9 traffic light intersections by more than 96%. This ratio has been increased as soon as the number of PSO iterations is increased. The saturation phenomenon has been reached when the number of iterations increased more than 80 iterations.

Scenario No. 2
In this scenario, 16 Traffic lights and 64 streets have been considered. The same as the previous scenario, Figure 4 shows Particle Swarm Optimization (PSO) that the proposed controller has been improved the flow ratio of the vehicles through 16 traffic light intersections by more than 95%. This ratio has been increased as soon as the number of PSO iterations is increased. The saturation phenomenon has been reached when the number of iterations increased more than 80 iterations.

Scenario No. 3
In this scenario, 25 Traffic lights and 100 streets have been considered. Figure 5 shows that the proposed controller has been improved the flow ratio of the vehicles through 25 traffic light intersections by more than 96%. This ratio has been increased as soon as the number of PSO iterations is increased. The saturation phenomenon has been reached when the number of iterations increased more than 90 iterations.

More than One Cycle
In this test the proposed control module should be configured the traffic light intersections all the time with more than one cycle. This means, the proposed control module should be reconfigured the traffic light intersections according to the shortest green period time in the previous streets sequence.
The selection of the best cycle time considers the volume, intersection configuration, approach speeds and coordination with nearby intersections. Thus, typical cycle times -30s to 120s. On the other hand, the cycle time should be as short as possible in off-peak periods 40s -60s. While Cycle times of 120s -150s are often required in peak periods in urban areas [17].
Three types of tests have been presented according to the previous mentioned: first test will be taking during typical cycle times; the second will be during off-peak periods and the third test will be during peak periods in urban area using the same scenarios which are presented previously in the section 5.1.

Typical Cycle Times
In this test the shortest cycle should be 30s. This means, the proposed control module should be configured the traffic light intersections each 30s. For scenario 1, figure 6 shows that the controller module needs just 22.75s to improve the flow of the vehicles to more than 96% through 9 traffic and 36 streets. For scenario 2, figure 7 shows that the control module can improve the flow of vehicles to more than 94% through 16 traffic lights and 64 streets.  In the last scenario (scenario No. 3) figure 8 shows that the control module cannot be able to improve the flow of vehicles because the proposed control module takes time more than minimum green period time (which is 30s). This limitation comes from the big number of traffic light which is 25 and 100 streets.

Off-Peak Periods Time
In this test the shortest cycle should be 40s. This means, the proposed control module should be reconfigured the traffic light intersections within 40s. For scenario 1, just like previous test, the control module needs just 22.75s to improve the flow of the vehicles to more than 96% through 9 traffic and 36 streets (see figure 6). For scenario 2, figure 9 shows that the control module can improve the flow of vehicles to more than 96% through 16 traffic lights and 64 streets.

Peak Periods Time
In this test the shortest cycle should be 120s. This means, the proposed controller module should be reconfigured the traffic light intersections within 120s. For scenario 1 and 2, just like previous test, the controller module needs just 22.75s and 38.5 to improve the flow of the vehicles to more than 96% (see figure 6 and 9). For scenario 3, just like the other two scenarios, the control module can improve the flow of vehicles to more than 95% (see figure 11) because the controller module needs just to 76s for improving.

Conclusion
This research presents an intelligent control module. The proposed control module has been developed based on swarm technique. The proposed control module developed to optimize the traffic light configuration of a set of urban area's intersections. The results have been shown its ability to select one street from each traffic light according to each street condition in the intersection. The street condition should be provided from the monitor module which it integrated with the proposed control module. The green period time has been given to these selected streets to achieve the optimal vehicles flow through the traffic light's intersections. Its ability has been proved via three scenarios. These scenarios have been built by different number of traffic lights and streets. PSO improved the traffic flow through these traffic lights with ratio more than 96% for both scenarios 1 and 2 however, in scenario 3 the improvement was more than 95%. PSO needs from 80 to 90 iterations to reach the optimal series of streets. The results show that the proposed control module can be more efficient with peak periods because the traffic light cycle is relatively longer than the processing time that the proposed control module needs. Thus, the proposed control module is efficient as soon as the traffic light cycle is longer than PSO processing time.