Micro Artiﬁcial Immune System for Trafﬁc Light Control

Featured Application: This work can be used to reduce the emission of pollutants expelled by motor vehicles in speciﬁc areas of a city


Introduction
Vehicular traffic has grown exponentially, in an excessive way, in all the big cities of the world. Developing strategies to control or at least reduce the problems associated with vehicular traffic in large cities mainly involves solutions in two areas: the modification of infrastructure and the topology of the city, but in many cases, this is not feasible. Hence, researchers have developed other strategies to deal with the problem of vehicular traffic. One of these is the control of traffic lights. It has been found that their proper programming is able to reduce congestion, improving vehicular traffic and reducing travel times as well as the levels of pollutants emitted. Properly configuring the synchronization of traffic light cycles to optimize vehicle flow is a problem with a non-polynomial computational complexity. Mexico City has a unique geographical location as well as very particular orographic conditions, such as its population of 20 million, its elevation of 2000 m above sea level, and the fact that it lies in a valley surrounded by volcanoes, so there is only a limited possibility of modifying the infrastructure of roads, streets, and avenues. The proper use of synchronization in traffic lights is a viable option to support the reduction of pollutant emissions throughout the city. Therefore, it is necessary to use computational tools that can find good solutions to the problem in a reasonable time. Bio-inspired computation has shown that it is capable of solving difficult problems in real-world applications, particularly for programming traffic light cycles, see [1][2][3][4][5][6].
In recent years, efforts have been made to seek the correct management and optimization of traffic in an automatic way without the need for human interaction. For example, the adaptive control system proposed by McKenney [7] has better results than the fixed signal control that is traditionally used. In Sanchez et al. [8] a three-element architecture was used: a genetic algorithm (GA) as a non-deterministic optimization technique, cellular automata (CA) based on the traffic simulation performed within the GA routine, and a Beowulf cluster. The simulation consists of creating many vehicles that enter and leave the network. During the process, some of them arrive at their destination and leave the network. The number of vehicles arriving at their destination is an indicator of the effectiveness of the simulation and serves as a point of comparison for another cycle of particles. A microscopic simulator is used, where the traffic is considered as a discrete collection of particles following certain rules for their interaction. Subsequently, we sought to develop a model that had the ability to learn and adapt actively. Through a neural network model, it is possible to perform this task. Nagare et al. [9] used a back propagation neural network (BPNN), which analyzes the positive and negative signals of the propagation indefinitely until the error output is reduced. However, the prediction of the algorithm becomes ineffective when there are complex crossroads. In the cities of Bahia Blanca, Argentina, and Malaga, Spain, Olivera et al. [10], carried out tests with hundreds of traffic lights to optimize traffic light cycle programs through particle swarm optimization (PSO). They used a mono-objective function based on polluting emissions to control the timing of the traffic light signals although they did not take into account the vehicular flow for sections of heavy traffic in the cities. Garcia-Nieto et al. [4] used a simulation of urban mobility (SUMO) to model the behavior of vehicular flow and traffic light changes, for Malaga and Seville in Spain. As a proposal to address the vehicular flow and the emission of pollutants, Ji proposed a system establishing a complete emission model and also using a microscopic emission simulation platform to estimate the reduction of pollutant emissions for the city of Changzhou in China [11]. A similar task was done by Damay to reduce emissions and improve vehicular flow using a multi-objective genetic algorithm and a microscopic traffic simulator optimizing the duration of the green lights in the traffic lights for a real traffic network in the city of Rouen in France [12].
Ferrer et al. [13] proposed a validation of scenarios by checking the robustness of the traffic programs. Tests were carried out in Malaga, Spain and a group of programs generated by four optimization algorithms were validated: PSO for traffic lights, differential evolution for traffic lights, random search and the SUMO cycle program generator. The tests were carried out taking into account the following factors. (1) Climate: the types of weather considered were rainy, thunderstorm, sunny, windy and cloudy. Weights were assigned to each of them taking into account the percentage of the days of the year that have these conditions. (2) Number of vehicles: the number of vehicles was established as a little or a lot. (3) Driver imperfection: this characteristic represents poor driving quality (low, medium or high). In many traffic situations, the driver makes a difference, which is why three levels of driving were defined. (4) Reaction time of the driver: time interval needed by the driver to perform an action. Three levels were considered (low, medium and fast). (5) Type of vehicle: two types of vehicles were taken into account (light and heavy). The weights were defined according to the information about the vehicles that operate in the city.
Perez used a multi objective evolutionary algorithm (MOEA) for the optimization of traffic signal control in the city of Montevideo in Uruguay for the programming of intelligent traffic lights with good results [14]. MOEA algorithms were combined with a microscopic traffic model to simulate the vehicular flow while simultaneously reducing pollutant emissions. Another approach is the one used by Leal et al. [15], applying a predictive model with time delay used in conjunction with differential evolution techniques and GAs in an urban simulator reproduction of a city in Belo Horizonte, Brazil. They achieved a 47% reduction of the delay time of the vehicles with respect to the normal programming of the traffic systems.
A study by Vidal and Olvera [16] of two neighborhoods of cities in South America, Jacinto Vera in Montevideo and the micro-center Posadas in Argentina (areas with very different topologies), performed tests of the programming of traffic light cycles with the objective of minimizing the waiting time of the vehicles and maximizing their speed. As a result, traffic flow was improved, reducing fuel consumption and therefore the emission of pollutants. They tested five metaheuristics and concluded that the one that produced the best results was differential evolution.
The present paper proposes a method, referred to as the micro artificial immune system algorithm (MAIS), for the optimization of traffic cycle programming based on an artificial immune system micro-algorithm, and analyzes it on a real urban topology in a very important avenue of Mexico City (Avenida Insurgentes) using meta-heuristic techniques combined with simulation with the objective of improving the vehicular flow and reducing the emission of pollutants into the environment. The objective is to minimize the waiting time of the vehicles flowing in the network and maximize their speed. The results obtained improve the traffic flow by reducing waiting times and increasing the speed of the vehicles, favoring a decrease in fuel consumption and environmental pollution. The MAIS demonstrates that it improves not only the flow of the vehicles but also reduces pollution and fuel consumption.
Our objective is to test MAIS as an option for the efficient programming of traffic lights, and verify whether it is equivalent to other similar algorithms and if it has some advantages. The MAIS algorithm was designed and configured in a unique way not used before by an artificial immune system with reduced population.
The main contributions of this paper are as follows.

1.
The proposed MAIS is the first to be used in a practical problem of this kind.

2.
MAIS and PSO provide the best results, better than the other tested algorithms, namely, simulated annealing (SA), the genetic algorithm (GA), and differential evolution (DE).

3.
The behavior of the MAIS is tested.

4.
The reason for the improved performance of the MAIS is its reduced population and the periodical replacement of the antibodies to introduce diversity.
The rest of this paper is organized as follows: after the Introduction, Section 2 presents the microscopic simulator and introduces the artificial immune system. Section 3 presents the algorithms that are the basis of the MAIS. The experimental setup and the results are presented in Section 4. Lastly, the conclusions are given in Section 5.

Simulation of Urban Mobility (SUMO)
SUMO is a traffic simulatorthat has been free since 2001. Its main feature is the modeling of traffic systems, specifically road vehicles, public transport, and pedestrians. SUMO has a large number of support tools that are responsible for finding transport routes, vehicle traffic visualization, and calculation of pollutant emissions. One of the main advantages of the software being open source is that it offers the opportunity to implement any algorithm to determine the programming of the traffic lights. SUMO is not software only for traffic simulation, it also offers tools that allow analyzing the performance of the programming implemented in the road network. As an essential part for the simulation of SUMO, it is necessary to represent the road network through the "netgen" application, where each of the network crossings is defined. On the other hand, it is possible to import a map of a road network that is digital from an original map view (see Figure 1a) and the SUMO network (see Figure 1b). SUMO performs the simulation microscopically, which means that the movement of the vehicles can be observed graphically, as well as the starting times and the paths they can take within the network. All the characteristics of the vehicles, such as their speed and position, can be defined. As relevant information, SUMO offers information at the end of simulation of the vehicles within the road network. For example, if you want to obtain the global travel information, you must use the tripinfo-output command. Additionally, SUMO allows several outputs to be generated for each of the simulations, such as the amount of sound emitted, the pollutants generated, and fuel consumption, among others. SUMO allows the modification of the cycles of the traffic lights, the observation of intersections, roads, directions, and vehicles moving along their routes.

Artificial Immune System
Nunes de Castro and Von Zuben proposed and developed the clonal selection algorithm (CLONALG) on the basis of the clonal selection theory of the immune system [17,18]. Human B-cells and T-cells adapt in order to match and kill foreign cells. Clonal selection is based on the way in which both of these types of cells of the immune system adapt. The algorithm is described as follows: 1.
Generate randomly a set P of antibodies (candidate solutions), composed of the memory cells M and the remaining population P r , where P = P r + M; 2.
Select the n best antibodies P n , based on affinity; 3.
Clone these n best antibodies in proportion to their affinity using where N c is the total number of clones generated for each of the antigens, like an objective function, β is a multiplying factor, where n is the total number of antibodies, and round is the operator that rounds its argument toward the closest integer. For n = 100 and β = 1, the antibody with highest affinity will produce 100 clones; the antibody with the second highest affinity produces 50 clones, and so on, giving rise to a temporary set of clones C; 4.
Apply a hyper mutation to C. The degree of mutation is inversely proportional to the affinity. The mutated antibodies generate the set C * ; 5.
Re-select the best elements from C * to compose the memory set M. Some members of P can be replaced by other improved members of C * ; 6.
Replace d antibodies with new ones to introduce the concept of diversity. The probability of being replaced is inversely proportional to the affinity of the previous remaining population Pr.

Design
The fitness function is a minimization function, and we take the fitness function designed by Ferrer et al. (see [19]), but with some changes for our particular case. The parameters to minimize of our model within the optimization of vehicle flows are as follows: • Emission of pollutants in the environment (Epe). • Waiting times in the vehicular flow (W). • The transit of one or more vehicles (V).
The decision variables used by the proposed model are continuous variables, since it yields decimal values during the entire simulation period.
where • V rem (P) refers to the vehicles with incomplete journeys and is proportional to the simulation time t rem . This is used to penalize the incomplete journeys during the simulation process. • t v (P) is the travel time of a vehicle and v is the number of simulation steps. • W v (P) is the process that involves the number of vehicles that arrive at their destination (v). • Epe v (P) refers to the emission of polluting waste during the entire simulation process. Since our main objective is the decrease in the emission of pollutants, we square the variable Epe v (P) so that this parameter is prioritized. • V(P) refers to the fact that we only consider cars that make complete tours and that arrive at their destination throughout the simulation process. Vehicles with incomplete routes and that take a long time to move are those that emit polluting waste. • The C r term (see [19]) is calculated with the following equation: where G ij is the number of green traffic lights and R ij is the number of red traffic lights. ϕ ij is the duration time of the sequence to change from one state to another, i is the number of traffic lights in general, and it must always be i = 1, to avoid dividing by 0.
The equation refers to the state of the traffic lights at each instant of time in which each vehicle must wait at a red light or continue its journey on a green light. A prolonged red light state causes road chaos at the intersection crossing.
To reduce the computational cost in the solution of population algorithms, the use of micro-algorithms is proposed, whose main characteristics are a drastically reduced population and a nominal convergence. The nature of micro-algorithms is different from the standard, so the intention is to make their performance acceptable in terms of their results and computational time. For the same reason, in this work we present the micro artificial immune system algorithm (MAIS) as an alternative to solve the problem of traffic light control and it is not the intention, at least for the moment, to compare it with other mathematical methods.
Our MAIS algorithm is based on the method proposed by Goldberg in [20], who presented experiments with different sizes of populations for GAs and showed the relation between the size and the error levels. Later, Krishnakumar designed a binary representation micro-genetic algorithm with a population of only 5 individuals [21]. By comparing the performance of this micro-AG against a simple GA of 50 individuals, Krishnakumar obtained better results on single objective functions.
Additionally he verified that the micro-GA converged faster than the simple GA. Krishnakumar reported better and faster results for the micro-GA when tested with two static functions and two control problems of the real world. Rahnamayan and Tizhoosh [22] developed a micro-DE and a micro-ODE for image thresholding, where the micro-ODE outperformed the micro-DE as well as a traditional Kittler thresholding method. Micro-algorithms have been used and have demonstrated advantages in other hard-to-optimize problems, as in [23][24][25].
The MAIS proposes applying variation operators to a small population (randomly generated) to achieve first-phase convergence. Subsequently, a new population should be generated by transferring the best individuals of the population obtained after the convergence to the new one. The remaining individuals are randomly generated.
This MAIS was specifically developed for the optimization of the traffic light program cycles (traffic lights).
In Algorithm 1, ExtGen is the current generation and Max Generations is the stop criterion for the MAIS external loop. Generation is the current generation and NominalConv is the stop criterion for the MAIS inner loop. F is the initial population, S is the selected population, and C is the cloned population. In addition, M denotes the cloned mutated population, R is the ranked population, and E is for the self regulated population. for ExtGen ← 1 to ExtGen < MaxGenerations do 4: for Generation ← 1 to Generation < NominalConv do 5: S ← Select the n best antibodies based on ranking (F) E ← Algorithm reset(F) 13: if Generation < NominalConv then 14: f ← Create 3 new random antibodies to maintain diversity(E) 15: end if 16: end for 17: end function The MAIS algorithm works as follows:

1.
A population of five antibodies (individuals) is generated randomly (Algorithm 1, line 2). The first generation of the population will contain these five antibodies. It is established that ten generations will be sufficient to achieve nominal convergence. The stop criterion (MaxGenerations for the MAIS external loop) is given as an input parameter when the algorithm is used.

2.
A selection based on ranking with respect to affinity is used (Algorithm 1, line 5), where each of the antibodies is evaluated using the objective function. In the MAIS terminology, it is called an antigen (Ag).

3.
Subsequently, the cloning of all antibodies is performed (Algorithm 1, line 6), using the following equation: where N c indicates the number of clones that will be generated for each of the antibodies, n is the total number of antibodies in the population, and i is the current antibody, starting with the one with the highest affinity (BestAb). If a population of five antibodies is considered, a population of fifteen clones will be generated: the best antibody will generate five antibodies, the second best antibody will be cloned four times, and so on, until only one clone is generated for the worst antibody.

4.
Cloning mutation (Algorithm 1, line 7). The probability of mutation is set at the beginning of the nominal convergence for each group of clones obtained from the same antibody. This probability is proportional to the affinity of the antibody that generated the clones and will decrease in each of the generations. In this way, the clone group of the best antibody will be less likely to mutate than the other clone groups that were generated from the rest of the antibodies. The clone obtained from the worst antibody will have the greatest chance of mutating.
Here, i is the antibody that will establish the probability of mutation for the group of clones that were generated from it and n is the total number of antibodies of the population. The following equation is used to uniformly decrease the probability of mutation in each of the generations.
where, prob is randomly chosen ∈ [0, 1] and Generation is the current generation within the nominal convergence. This value is divided by Generation because ProbMutation should not be divided by zero. There are two operators (for the algorithm section, that will affect the clones) that allow exploring the search space by performing modification steps of different sizes during the mutation process. The choice of which operator to apply to the solution vector is made with a probability of 0.5. or where x is the mutated variable, x is the variable to mutate, α is a random number ∈ [0, 1], g Generation is the current generation of the nominal convergence (inner loop), and N c is the total number of clones. To ensure that the values are within the delimited ranges, the following instruction is defined.
For the five clones obtained from BestAb, range ∈ [LB, UB] is a random number between the lower limit and the upper limit of the values that the decision variable can take. For the rest of the clones, range is any decision variable of the BestAb antibody and the position within the vector dimension is obtained randomly.

5.
Selection based on ranking. The 15 clones are sorted using ranking with respect to their affinity (Algorithm 1, line 8), with the best clone having the best affinity. If the nominal convergence has not been reached, the two best clones are selected and the new population is completed with another three clones randomly selected from the clone population (Algorithm 1, line 9).
The remaining clones will be eliminated, maintaining a population of five antibodies (Algorithm 1, line 10).

6.
Algorithm reset (Algorithm 1, lines 13-14). If the nominal convergence has been reached (Generation = NominalConv), the best two clones will be kept and three other antibodies will be generated randomly to be able to complete the initial population and restart the nominal convergence (Algorithm 1, lines 4 and 11) until the external cycle meets the algorithm's stop condition.

Experiments and Results
The experimental setting was as follows. For each experiment, 700 runs were executed for each algorithm (micro artificial immune system (MAIS), simulated annealing (SA), genetic algorithm (GA), particle swarm optimization (PSO), and differential evolution (DE)) with a stop criterion of one million function evaluations (FEs). Our MAIS used a population of five individuals. For the other algorithms, the size of the population was forty. The settings used for the two functions were the same (see Table 1). The MAIS and all other algorithms were programmed in C and compiled by using g++ -O3. The hardware used was a heterogeneous cluster with 16 machines using Intel Core2 Quad processors Q9400 running at 2.66 GHz and 4 GB of memory. The cluster was administrated by a HTCondor 8.2.1. The total computing time was 200 hours of cluster time. The initial solutions for optimization were defined by the initial state of all the algorithms. The cluster it is located at México City, México, and is the 3rd cluster version.
Two areas of study were taken as reference to offer a proposal as close to reality as possible. The research was done on the Avenida Revolucion area and Avenida de los Insurgentes in Mexico City, see Figure 2a  From the data obtained so far, it can be seen that the PSO (2.682) and MAIS (2.721) algorithms obtained better results, in terms of average fitness, than the rest, but PSO has a slightly bigger standard deviation, 0.060, compared to SA and MAIS (with 0.040).
However, it is important to note that the MAIS algorithm has the best average value after PSO, see Table 2, consuming less resources in carrying out operations, but with almost the same time when executing SUMO, and MAIS has a better standard deviation, meaning that it has less variation in the results, see Table 3. A second experiment was carried out, where the number of tests performed on each of the algorithms was increased. Likewise, the MAIS algorithm was modified to improve the mutation of the clones, because there were cases where very high values were assigned to the modification in the times of the traffic lights. There are two operators (for the algorithm section that will affect the clones) that allow exploring the search space by performing modification steps of different sizes during the mutation process. The choice of which of the operators to apply to the solution vector is made with a probability of 0.5.

The Kolmogorov-Smirnov test
Once the executions were carried out, the Kolmogorov-Smirnov test was applied to define whether there was a significant difference in the results obtained by the best two algorithms (MAIS and PSO), see Table 4. For this test, a positive hypothesis and a negative hypothesis are defined, with α = 0.05.  Because the asymptotic significance is less than 0.05, H1 is proven, meaning that there are significant differences between the results of both algorithms. Since the H1 hypothesis is accepted, the Z-value is 2.711 concluding that the differences are large, see Table 5, so it is concluded that both algorithms have significantly different behaviors.

ANOVA Single Factor Test
An analysis of variance (ANOVA) will help to verify the hypothesis that the population means are equal. For this, the homogeneity test of variances is performed. Because the significance is greater than 0.05 (see Table 6) the assumption of variance homogeneity is met (see Table 6). The above means that the samples used have no significant differences, so no algorithm has an advantage in the test. Once the homogeneity assumption was validated, the single-factor ANOVA test was performed, see Table 7.

Discussion
An ANOVA will help to verify the hypothesis that the population means are equal. For this, the homogeneity test of variances was performed. Because the significance was greater than 0.05, the assumption of variance homogeneity was met. Once the homogeneity assumption was validated, the single-factor ANOVA test was performed. The unifactorial ANOVA indicates that there are differences in the results of the fitness function of the algorithms, because the value of significance is less than 0.05.
This means that although both algorithms have seemingly similar performances, they are in fact algorithms with statistically different behaviors and therefore can be used with different results, see Tables 8 and 9. In this case, the proposed algorithm (MAIS) demonstrates effective behavior, is efficient and robust, and can be used in the optimization of vehicular flow through the control of lights, and with a slightly smaller standard deviation than the PSO algorithm.

Conclusions
This work experimentally studied the performance of a reduced population artificial immune system algorithm.
The simulation of a network of roads in Mexico City has been presented, where routes were added randomly, defining the behavior of 100 vehicles, obtaining results on the average waiting and journey times, the average distance traveled, and the average speed of the vehicles within the road network.
The optimal control of traffic lights is beneficial for minimizing travel times, thus reducing fuel consumption and pollution emissions. Many studies have been carried out using different techniques for the control of traffic lights, such as meta-heuristic algorithms in conjunction with fuzzy logic, obtaining good results for different cities (see [1,12,14,16,26]). As future research, we seek to implement a bio-inspired meta-heuristic for a medium-size city, in order to reduce pollution rates for a specific region through vehicle flow optimization.
The main conclusions are as follows.

1.
Our proposal, MAIS, has a better global performance than the other tested algorithms, namely simulated annealing (SA), the genetic algorithm (GA), particle swarm optimization (PSO), and differential evolution (DE), for this particular problem.

2.
By using the Kolmogorov-Smirnov test, we can say that MAIS is significantly different from the other tested algorithms.

3.
The results show that MAIS gets good results in the traffic light synchronization problem, so it can be used, just as the other tested algorithms, and can achieve competitive results.
Our future research will test MAIS on a larger urban area. We will also test MAIS on real-life problem applications, where its low computational cost could be a key advantage over other techniques.