Paper—Ant Colony Optimization for Real Time Traffic Lights Control on a Single Intersection Ant Colony Optimization for Real Time Traffic Lights Control on a Single Intersection

In this paper, we present a new scheme to intelligently control the cycles and phases of traffic lights by exploiting the road traffic data collected by a wireless sensor network installed on the road. The traffic light controller determines the next phase of traffic lights by applying the Ant Colony Optimization metaheuristics to the information collected by WSN. The objective of this system is to find an optimal solution that gives the best possible results in terms of reducing the waiting time of vehicles and maximizing the flow crossing the intersection during the green light. The results of simulations by the SUMO traffic simulator confirm the performance of the developed algorithm compared to the predefined time controller and other dynamic controllers. Keywords—Traffic optimization, traffic light control, intelligent transportation system, ant colony optimization.


Introduction
The number of vehicles in the world continues to increase, leading to a saturation of the road network. This saturation represents the main cause of congestion, accidents, and pollution. These problems have major consequences for the economy and the daily life of the citizen. A possible solution to this problem is to effectively manage the road traffic, based on real-time traffic monitoring that will provide instant insight into the state of our roads. A simple example is an intersection, where traffic light management can be much more efficient by knowing the exact number of vehicles on each segment of road at any time; thus, the duration of green lights can be adapted according to the number of vehicles waiting.
In this paper, we propose an algorithm that uses ant colony optimization metaheuristics to plan and sequence the phases of a traffic light controller to adapt to instantaneous traffic variations in an isolated intersection.
The document is organized as follows: after a presentation, we present the context of the traffic lights control problem in section 2, then we show the analogy of traffic light control problem with scheduling problem in section 3. After in section 4 and 5 we present respectively related works and the Ant System Colony optimization metaheuristic. Thereafter, in section 6 we implement the dynamic traffic lights system based ACO for phases scheduling. Finally, in section 7 we evaluate our method via the SUMO simulator and we demonstrate its effectiveness by comparing the results to other methods.

Traffic Lights Control Problem Control in an ITS Context
In the traffic lights control in a intersection, a static light plan is useful when there is some historical information on the arrival of vehicles. It can be built and optimized using average traffic data that has been taken over a long period of time. The arrival of Intelligent Transportation Systems (ITS) provided access to in-formation on vehicle arrival time, speed, etc. in real time. This latter information is less relevant when a static light plan is being used at a crossroads or it will not be able to adjust to the natural variability of the flow. As a result, it cannot react to changing traffic conditions. This means solutions considered moderately satisfactory. However, an adaptive light plan will be able to adjust to both stable and variable circulation conditions. It is in fact for this reason that it becomes more interesting to process the stochastic data of the warning system of traffic monitoring systems by using the plan of the false adaptive. Traffic monitoring systems provide accurate data in real time, allowing the adaptive plan to choose the flows of the highest priority vehicles for their data on a goahead basis.
The real-time management of a traffic light in an ITS context seeks to determine the sequence of green time of the different flows of a junction that minimizes total waiting time and maximizes vehicle throughput crossing an intersection by adjusting these decisions to changing traffic conditions. Several difficulties must be considered when solving this problem. We must, among other things, consider the compatibility between flows in order to avoid conflicts between vehicles. We must also ensure that the maximum green light time does not exceed a certain threshold. Finally, the problem to be solved is in a real-time management environment, so the chosen approach will need a model that can be resolved quickly so that the model information can be updated and the process can be restarted.
Our goal is to control traffic lights in real time to optimize the total waiting time of vehicles in the intersection and maximize the flow of vehicles crossing the intersection. The real-time management approach therefore consists to exploit the data of the road traffic status in each lane of the intersection that is collected by a road traffic surveillance system by the optimization algorithm, thus makes it possible to construct the phase-by-phase traffic light plan according to the observed traffic conditions observed in real time.

Analogy of Traffic Light Control Problem With Scheduling
Due to the properties of the problem being studied, the traffic lights regulation problem can be approached as a scheduling problem. We can model this isolated junction as a resource that can leave a certain flow of vehicles crossing the junction in parallel.
Each flow will be considered a task waiting to be processed. The flows are divided into different phases (compatible flows). Each flow has a waiting time and a queue that is proportional to the transit time of this flow (such as each task at a date rather than "release date" and a run time "processing time". For example, the flows of the intersection model shown in Figure 2 can be divided into eight phases presented in Table 2. That is, flows in the same phase are considered as tasks that can be processed in the same time in parallel. Similarly, the time lost to start a queue of the flow to cross the intersection can be considered as a preparation time "establishment time" of the resource (here the intersection).
Thus, the problem of regulating an isolated junction can be treated as a problem of scheduling a resource (green light) and where certain tasks can be treated in parallel (flow of the same phase) this system of scheduling is shown in Figure 1. The problem of scheduling several tasks in a machine with the setup time and the date of availability is studied in [26]. Other constraints have also been discussed (see [27] and [28]).
However, for our traffic light control problem, the model has properties that are different, so a resolution algorithm will be needed.
We will solve the problem of control of traffic lights using a heuristic unlike an exact method for two simple reasons. First, the actual instances of the problem to be solved are of a very large size and are too difficult to solve accurately. Secondly, the time available to optimize the light plan is very short compared to the time needed to find the exact solution, because we have to optimize in real time. The Ant colony optimization heuristic has been chosen among various other possible heuristics, particularly because of its simplicity, its flexibility and above all the speed of execution.

Related Works
Dynamic real time control of traffic lights in road intersections is an important research focus in the intelligent transportation system. This control makes it possible to respond intelligently on the instantaneous variation of the traffic. The approach proposed in the literature focuses on two major objectives that are to maximize the flow crossing the intersection during green light and minimize the waiting time of vehicles. the dynamic controller uses traffic status information that can be collected in real time by inductive loops. [13], cameras [14], [15] [16], radars, VANET (ad hoc network for vehicles) [17], [18] or wireless sensor network [4], [19], [20], [21].
In [1], a method based on fuzzy logic is employed. In this method, the authors present a table which defines the green light time according to the numbers of vehicles waiting. For example, for an intermediate flow with a number of vehicles arrives between 5/min and 10/min, we allow duration of 20s for green light.
The research work [5] proposes a light plan based on movement combinations can make simultaneously without any conflict. The authors use the same model of intersection presented in figure 4.1 with a topology of two sensors in such movement, which are separated by a variable distance that depends on the maximum green time. In this model of intersection, there are 4 lanes and 8 distinct combinations of nonconflict movements. This algorithm then selects the sequence of phases composing a cycle, according to several criteria: the presence of priority vehicles, the duration of the periods when there is no detection of new arrival, the cases of famine, the total waiting time and the length of the queues wait.
The model proposed in [5], however, is based on unrealistic assumptions, requiring vehicles to be of the same type and run at the same speed.
In [4], each lane equipped by two sensors is separated by a distance of 10 m. The authors presented each lane as an M/M /1 queue model and they use the Little law  L Q W  to give equation 2.1 to calculate the queue length in each direction.
iJIM -Vol. 14, No. 2, 2020 The algorithm proposed in [4] selects for each phase a combination of nonconflicting movements with the largest number of vehicles, in order to minimize the average queue length in the intersection.
In [6], the authors propose a study based on the GLD simulator to know the impact of the change of the wireless sensor network on the waiting time of the vehicles.
Firstly, the authors make a comparison between two topologies of the wireless sensor network, the first topology with one sensor per movement and the other with two sensors per movement. From the results of simulations with GLD simulator, the authors find that a topology with two sensors per direction gives a reduced waiting time compared to that with a sensor. After having arrived at this result, they studied the influence of the distance between the two sensors on the management of the road traffic as well as on the variation of the waiting time of the vehicles at the level of the intersection. They found that the distance between the two sensors does not have a big impact on the waiting time.
The method proposed in [19] selects the sequence of phases composing a cycle, according to several criteria: the presence of priority vehicles, the duration of the periods without detection of new arrivals, the total waiting time and the length of the queues. In [22] and [23], we have inspired the smallest job first method of task scheduling to be execute by a computer processor. We proposed the smallest phase first algorithm, which gives priority to phases with the smallest waiting line. Subsequently in [19] we introduced the waiting time in the algorithm proposed in [22].
A self-organization of traffic lights based on the historical data of the traffic status presented in [24] and [25].
In [7], the authors propose a topology of two sensors per movement. The first is just after the intersection and the other is placed before the intersection at a given distance. The data collected by these sensors are used to determine the sequence of phases for an intersection. To determine this sequence, the authors defined for each movement a score that classifies the movements according to the local score of the intersection and the state of the two neighboring intersections to this movement. The local score of a movement is defined as a weighted sum of the waiting time and the number of vehicles waiting at the level of this movement.

5
Ant Colony Optimization [8] and [9] initially proposed an ant colony optimization metaheuristic in order to solve the problem of traveling salesman. Their approach proceeds to the construction of solutions inspired by the synergy observed in the colonies of real ants ( [10], [11], [12]).
Originally, the goal of this problem is to find the shortest tour for a given set of cities. A matrix providing distances, ij d , between all pairs of cities is used to estimate the length of a tour. For the commercial traveler problem, each ant represents an agent [8] and when moving from city i to city j, it leaves a trace on the path (ij). In addition, an agent chooses the next city to visit based on the traces of pheromones and some heuristic information. At the initialization stage, all the arcs are initialized to the same amount of pheromone and each ant is placed in a randomly chosen city among all the cities. With a probability 1 -q, where An ant k chooses the next city j by being on the city J, using a probability ) (t P k ij as follows: Where, k l J presents cities that have not been visited by ant k. The coefficients α and β are parameters that make it possible to control the relative importance of the two elements. An ant k has a memory k tabou , allows it to memorize the cities already visited in order to force it to form an acceptable solution.
After each choice of a city, the amount of pheromone ) (t ij  is modified according to the following equations: iJIM -Vol. 14 Where  is the evaporation rate and 0  represent the initial amount of pheromone deposit in each arc. After all the ants have built a circuit, a global update of the pheromones is made for the arcs of the circuit, which represents the best solution (equation 5).
6) * Presents the length of the best solution of the cycle. If the total number of ants is m and the number of cities to visit is n, a cycle is realized when each of the m ants completes a tour of the n cities.

Traffic Light System
The solution proposed in this work is an intelligent real-time traffic signal management system in an isolated intersection (cf. Figure2) equipped with a wireless sensor network to collect traffic status information.
Our solution consists of three parts:  A traffic data collection unit that is provided by a wireless sensor network and which is presented in the following section.  A unit for phases scheduling of a traffic light cycle and which allows to choose the directions that will have the next green light.  And the last unit allows to specify the duration of the green light of the phase which was chosen in the part of the scheduling.

Traffic light data collection
Our system (cf. Figure2) consists mainly of four directions (N, S, E, W), each of which contains two lanes (go straight and turn left). Vehicles are always allowed to turn right without restricting traffic.
To feed traffic management support systems traffic knowledge is an essential element in real time. A wireless sensor network is responsible for collecting traffic data such as: the lengths of the queues and the waiting time in each route. The network is composed of a number of magnetic sensor nodes installed in the middle of the road.
These sensors are responsible for detecting and classifying vehicles by evaluating the distortion of the Earth's magnetic field produced by the presence of ferrous objects.

Fig. 2. Intersection model
In this work, we used a topology of two magnetic sensors per lane (cf. figure3): one located near the traffic light to count the number of vehicle departures and the other, installed at a distance from the first sensor to detect the arrival of vehicles.

Fig. 4. Example of a traffic lights cycle
In this part, we develop an algorithm that executes at the end of each cycle phase and chooses the phase that will have the next green light among the eight phases presented in figure 3.
The main objective of this algorithm is to build a dynamic traffic light cycle plan that represents an optimal solution to reduce the waiting time of the vehicles and to maximize the flow crossing the intersection during the green light.
The proposed approach is an implementation of Ant Colony Optimization metaheuristic previously presented.
For the TSP problem, the ant colony optimization algorithm allows to specify the shortest tour of the cities. For our problem, we seek to determine the sequence of phases to minimize the total waiting time of vehicles in a given intersection, hence the obligation to adapt the ACO algorithm of TSP to give an effective solution to our problem. Below, we present the OCF adaptations to the problem.
Initialization: The initiation phase is the last running phase that is produced in the last sequence planning.
Visibility matrix: For the TSP, the distance matrix represents the distance between the cities, and the visibility matrix is constructed from the inverse of the elements of the distance matrix. For our problem, we use two visibility matrices to imply the two criteria that influence the waiting time in an intersection and that are the length of the queue and the waiting time of the vehicles in each movement.
By exploiting the data collected by the wireless sensors, the waiting time and the number of vehicles (the length of the queue) can be calculated according to equations 7 and 8.

 
Where: ( iJIM -Vol. 14, No. 2, 2020 We use waiting time and queue lengths values to find the compromise that the algorithm seeks to establish between these two criteria. The coefficients β and γ allow controlling the relative importance of these two criteria.
Equations 2 and 3 that define the ACO transition rules are changed to 9 and 10, to fit our problem.
Candidates List: In the TSP problem, the candidates are the neighboring cities of the city i selected. In the traffic management problem dealt with here, the candidates are phases that can construct a traffic cycle. A phase consist two movements that can have green time at the same time without creating a conflict at the intersection.
For the intersection model shown in Figure 1, we have twelve possible movements. And if we eliminate the right turn motions that are still allowed, there will remain the following eight movements: S = {WE, WN, SN, SW, NS, NE, EW, ES} Some of these movements may have the green light at the same time without generating a blockage at the intersection and they are presented in the conflict matrix (Table 2), where 1 means that the vehicles of both movements can pass simultaneously while 0 expresses the movements that can create a conflict. To

Fig. 5. Possible cycles with the initiation phase {WE, WN}
However, these eight phases are not all candidates for the ACO algorithm that we adopted since only four phases with different movements are needed to build a cycle. Above (cf. figure 5) is an example of possible candidates for the initiation phase We will now present the ant colony optimization algorithm (cf. algorithm 1) for solving the phases scheduling problem of a signaling controller. This algorithm returns the phases sequence of the cycle with the optimal waiting time. Because of our system is dynamic and it changed in each moment we execute the algorithm to determine the phase, which will have the green light at each end of the current green light.

Simulation Results and Discussion
We use the SUMO Simulation of Urban Mobility [29] to evaluate our ASTL algorithm. We opt for a simple intersection with three movements per lane; go straight, turn left and turn right, it will not be considered in the simulation because vehicles are always allowed to go right. For each 60-second period, we calculate with the five approaches the total waiting time of the vehicles in the intersection and the average queue length.
In order to properly analyze the results, we compared our dynamic plan with the ASTL method to three other planes:  Static plan with four phases of duration of 25 or 20 seconds and which is illustrated below: <tlLogic id="0" type="static" programID="0" offset="0"> <phase duration="20" state="GrrGrrGrrGGG"/> <phase duration="25" state="GrrGGGGrrGrr"/> <phase duration="25" state="GrrGrrGGGGrr"/> <phase duration="25" state="GGGGrrGrrGrr"/> </tlLogic>  TSTMA dynamic plan presented in [4] and based on the choice of the phase with the largest queue.  And dynamic plan with the TOPIOCA algorithm presented in [7], which defines a weighted sum of the waiting time and the number of vehicles as a criterion for choosing the next phase.
Several types of traffic have been created in order to better evaluate the solution according to the variations of traffic during the day. These are summarized in the table below. We tested our algorithm and other approaches at different traffic conditions. These tests were then analyzed using performance criteria to measure the potential benefits of the proposed approach.
The program was coded in python and the tests were done on a PC equipped with Intel® Core ™ i7-4702MQ @ 2.20GHz processor.   From the results of the total vehicles waiting time for the three traffic scenarios presented in Table 5, it can be noted that it is much smaller for ASTL than with the other methods. Table 7 below shows the percentage improvement in ASTL's adjusted waiting time compared to other approaches. The time saving in the intersection is very important with ASTL for the simulations with the first two scenarios S1 and S2, saving between 88% and 94% compared to the TSTMA, SJF and the static plane. For Scenario S3, traffic conditions are much higher in intensity than other scenarios and the time savings are also important in this case. It is between 15% with SJF and TOPIOCA and 57% with a static plan.
In summary, among the methods tested in our simulations none of these methods perform well for all types of traffic as regards the reduction of queues. For each intesity of the traffic we found a method more efficient than the others and which is not the best for another intensity. Our ASTL model, which uses the ant colony optimization system, performs well by reducing average queue lengths for medium intensity traffic, and significantly improves vehicle waiting time at an isolated intersection for all types of traffic.

Conclusion
In this paper, we have developed an adaptive optimization method of controlling traffic lights at an isolated intersection using information provided by a wireless sensor network. We have used the metaheuristic ant colony optimization with several variants to solve the problem.
After testing and analyzing the simulation results, we concluded that we have a very effective method to reduce the waiting time of vehicles in the intersection. We have demonstrated that our model saves time up to 57% compared to the static plan and in dense traffic conditions with high traffic intensity. Our future research focuses on the application of this model in other types of intersections and with vehicle priority constraints.