Urban Traffic Signals Timing at Four-Phase Signalized Intersection Based on Optimized Two-Stage Fuzzy Control Scheme

This paper proposes a signal timing scheme through a two-stage fuzzy logic controller. The controller ﬁrst determines the signal phase and then adjusts the green time. At the ﬁrst stage, the adaptive membership function of vehicle arrival rate is improved to adapt to the changing traﬃc ﬂow. In addition to arrival rate and queue vehicles, a speciﬁc phase order rule is considered to avoid disordered phase selection in fuzzy control. At the second stage, the green time detection module decides whether to extend the current green time or switch phases every few seconds and the vehicle arrival rate is not required as the input to controller in real-time detection. Diﬀerential evolution algorithm with low space complexity and fast convergence is applied to optimize the fuzzy rules for avoiding artiﬁcial uncertainty. Simulation experiments are designed to compare traditional fuzzy controller, ﬁxed-time controller, and fuzzy controller without ﬂow prediction. Results show that the current proposed method in this paper can reduce vehicle delay signiﬁcantly.


Introduction
Traffic demand has greatly increased over the past decades. Many control strategies have been proposed to improve traffic capacity of an isolated intersection. Traffic signal control can be classified according to the following general operation methods [1,2]: (1) Timing control based on historical traffic data (2) Adaptive control using online real-time data e first method is easy to operate but has poor control effect. e main idea is to model the historical data, construct one or several objective functions, and find the optimal solution by optimization algorithm. For example, J. Guo proposed a particle swarm optimization to reduce vehicle delays based on Akcelik delay model [3].
is method simplifies traffic flow data but has difficulty solving congestion under traffic accident. Besides, its control efficiency is also very low in the case of traffic flow changes. e second method has good control effect but may be costly [4,5]. Chen S improved traffic efficiency through the real-time signal control algorithm based on a dynamic programming (DP) procedure [6]. ree types of loop detectors are placed to obtain the real-time data for online calculation in consideration of presignals and lane selection [7]. O. Younis and N. Moayeri [8] propose a novel framework dynamic TL control (DTLC), that is, low overhead in communication and data processing to optimize the waiting time and queue length. ese adaptive methods all need to model vehicle behavior. However, modelling the actual traffic behavior accurately is difficult, and optimization algorithms based on the aforementioned model may be ineffective. Some dynamic programming algorithms with a large amount of calculation are unsuitable for real-time control [9]. Fuzzy control does not need accurate modelling, and the design of a fuzzy controller is relatively simple. erefore, in this paper, a fuzzy controller is designed to deal with the adaptive control problem. In 1977, Pappis and Mamdani [10] introduced the fuzzy logic control method into the signal control of the city one-way intersection, thus creating a new era of fuzzy logic signal control.
Compared with the classical control algorithm, the fuzzy logic control algorithm can describe the urban traffic system more reasonably. A two-stage fuzzy logic controller is designed [11][12][13], and the phase sequence is first determined; then the green time delay is calculated. However, the phase selection is often unordered in the fuzzy controller of this structure. As a result, the busy phase is continuously selected, while some phases cannot obtain the green time [14]. us, a specific order condition is considered when the phase is selected in this paper. A type-2 fuzzy signal controller is introduced [15][16][17]. is controller can deal with the uncertainty of the traffic model effectively, but it is difficult to select suitable parameters of membership functions and fuzzy rules are difficult. e optimization is timeconsuming and may be ineffective. Azimirad [18] proposed state-space equations to formulate the average waiting time and used fuzzy logic to solve them. Modern control theory can be applied through state equations but many conditions are simplified in the modelling process. Fuzzy neural network system is applied to optimize signal timing [19,20].
is system combines fuzzy control and neural networks and needs a large amount of data for training. e structure is relatively fixed and difficult to optimize. In this paper, the proposed controller can be easily optimized to adapt to different traffic conditions. Other fuzzy controllers are available for different cases [21,22], but none of these controllers predict the traffic flow, and a forward-looking control is necessary. e design of fuzzy parameters is also a noteworthy problem because many people determine them depending on their experience without theoretical basis.
Machine learning is currently used as traffic control algorithm [23]. A deep neural network (DNN) is set up to learn the Q-function of reinforcement learning; then the appropriate signal timing policies by implicitly modelling the control actions and the change of system states can be obtained [24]. In this paper, wavelet neural network [25][26][27] is applied to predict traffic flow, and the network can reflect the time information of traffic flow. In this way, the traffic arrival rate is considered in the fuzzy controller. However, the fixed membership function cannot respond to the change in traffic flow information. In order to deal with such problem, Shahvali proposed a new cooperative adaptive neural network method based on the minimum learning parameter and the predetermined performance technique, which ensures that all the closed-loop network signals are cooperative semiglobally uniformly ultimately bounded [28,29]. us, an adaptive membership function is designed to solve the problem. Given many parameters, differential evolution (DE) algorithm [30,31] is used to optimize the fuzzy rules for avoiding artificial uncertainty. e key feature of this algorithm is the faster convergence speed compared to traditional genetic algorithm (GA). Besides, considering some incident-related traffic light control, some strategies based on the discrete event model are introduced to prevent urban traffic congestion and reduce vehicle delay [32,33]. e rest of this paper is organized as follows: Section 2 discusses the structure of the two-stage fuzzy logic controller and the evaluation index. Section 3 proposes the adaptive membership function to describe the predicted traffic volume and optimizes the fuzzy rules through DE algorithm. Section 4 describes the details of the simulation and compares the experimental results obtained in tested urban road.

Two-Stage Fuzzy Logic Controller
is paper investigates an isolated four-way intersection with straight and left-turning vehicle movements. e four phases are shown in Figure 1. Right-turning vehicle movement is not limited by the signal light. e fuzzy signal controller, including phase selection and green time detection modules, differs from traditional ones. Phase selection cannot be entirely decided by the controller because the low flow phase may never be executed, whereas the high flow phase is executed many times. In order to avoid such disordered phase selection, each phase is guaranteed to be executed once in one cycle. We add some fixed order to deal with the problem. In one direction, left turn and straight ought to be connected, and green time will be given in each phase in a cycle. Also, if each phase of north and south direction is executed, then the direction of next phase is east and west. According to the phase selection rule, turning left or going straight forward in this direction is determined by the fuzzy controller. If left-turn phase is chosen, then the next phase is straight, and vice versa. In this case, the phase selection module is executed twice in one cycle.
In the specific phase order rule, processes A and B are executed alternately (Figure 1). e module determines which phase is executed first in process A or B (p1 or p2, p3 or p4). e purpose of green time detection module is to determine whether to change the current phase. e input variables include the number of queue vehicles of current phase and average number of queue vehicles of other phases. If the fuzzy controller directly determines the green time, then vehicle arrival rate is ignored in this system and the result is unreasonable. e vehicle arrival rate also can be one of the inputs, but making fuzzy rules is difficult. One reason is that, among many fuzzy rules, few of them are beneficial to sum up and utilize the experience of artificial traffic manager.
us, the number of inputs is as low as possible. Output is a decision variable. When the threshold is reached, the current phase is changed. In this case, the fuzzy controller is adaptive and indirectly considers the vehicle arrival rate.
When a phase is selected, the controller will provide the minimum green time of the phase. e sensors collect traffic flow information, and the green time detection module decides whether to extend the current green time or to switch phases every few seconds. e minimum phase green time is introduced to ensure that the vehicle passing through the stop line can safely cross the intersection and provide pedestrians and nonmotorized vehicles some street-crossing time when the traffic flow is very light. e vehicle waiting 2 Mathematical Problems in Engineering time of each phase also cannot be too long; otherwise, the drivers cannot stand it.

Phase Selection Module.
is module is used to determine whether the vehicles turn left or go straight. e eastwest or north-south direction is determined by the previous phase. e phase selection module has two input variables. One input is the number of queue vehicles in this phase, which is defined as QL. Another is average vehicle arrival rate within 15 minutes, which is defined as AR. e same phase has traffic flow of two directions, and the mean value of the two is taken for analysis. e calculation of AR involves the prediction of traffic flow as discussed in Section 3. e output variable is traffic urgency degree defined as U. e membership functions of QL, AR, and U are defined as follows.  Figure 2 shows the triangular membership function of QL. e membership function of the output and the second input is also triangular. e triangular membership function is conducive to our modification to adapt to the changing traffic conditions. e fuzzy rules are shown in Table 1. e element of the first row and first column is VR; if QL is VL and AR is VS, then U is VR. e parameters are adjusted according to the simulation results in the phase selection module and the adjustment rules are based on the following: if the number of queue vehicles is very small and the arrival rate is quite low, then the traffic urgency degree is very light. Fuzzy rules are not made at random, and the weights of the two inputs differ.
AR has a long-term effect on vehicle delays, whereas QL has an immediate effect. us, the traffic urgency degree is mainly influenced by QL, and AR plays a regulatory role. A long signal cycle indicates a large influence of AR. A short signal cycle implies a small influence of AR. e rules of fuzzy control should be chosen flexibly on the basis of the historical experience of the isolated intersection. Optimization algorithm is unsuitable for optimizing fuzzy control table because the inputs of the fuzzy system are not exact. Compared with optimal fuzzy rules, these rules are more feasible for improving the prediction accuracy of AR.

Green Time Detection Module.
is module is used to determine whether to switch phases. Considering the potential effect of vehicle arrival rate, the fuzzy system does not directly output the green time. Unlike the phase selection, the green light time can be constantly changed; only the upper and lower limits are required. e green time detection module has two input variables and one output variable. One input is the number of queue vehicles in this phase, which is defined as MQL. Another is the average number of queue vehicles in other phases, which is defined as OQL. e output variable is a decision variable defined as J. It is fuzzed into a real value output between 0 and 1. When the value exceeds a certain threshold, the green light signal switches to the red-light phase; otherwise, the green light signal will remain unchanged. In this paper, the threshold is 0. 5 e membership function is triangular, which is of the same type as the membership function of the output. e output U represents the traffic demand of other phases. If U is large, then the current phase needs to be switched. e fuzzy rules are shown in Table 2. e element of the first row and first column is "Y"; if OQL is VL and MQL is VS, then J is Y. is rule can be described by natural language as follows: if the number of queue vehicles in the current phase is very small and the numbers in other phases are very few as well, then the current phase can be switched. Despite congestion trends in other phases, we are still inclined to evacuate the current phase car flow.
Unlike phase selection module, two inputs here can be obtained directly by the detector with no error. Optimizing the fuzzy rule table is very effective because the fuzzy rule Mathematical Problems in Engineering 3 directly determines the output. We can optimize the fuzzy rule table by setting different target functions such as vehicle delays or queue length and select a specific fuzzy rule table depending on the specific circumstances.

Evaluation Index.
Evaluation index is used to evaluate the control performance of the fuzzy controller. In this paper, traffic delay is chosen as the evaluation index, and a smaller traffic delay indicates a better control performance. e quantitative analysis of traffic delay is given below. e number of queue vehicles at time m in red-light phase is defined as Q rm ; then, where i is one of the lanes in the red light and k is the number of these lanes. Q gi represents the number of remaining vehicles at the end of previous green-light signal on the ith lane, and q gi is the number of arrival vehicles on the ith lane during jth time interval in the current red-light phase. e total traffic delays in the red phase can be calculated as where n is the number of seconds of the red light. q s denotes the number of departure vehicles in a time unit during green phase. e number of queue vehicles at time m in green-light phase is defined as Q gm . Q gm is calculated as follows: where Q ri represents the number of remaining vehicles at the end of previous red-light signal on the ith lane, q ij is the number of arrival vehicles on the ith lane during jth time interval in the current green-light phase. q s is the saturated flow rate. k is the number of lanes in the current green-light phase, and z i is used to guarantee that the number of queue vehicles is positive. z i is defined as e total traffic delays in the green phase can be calculated as follows: where g is the number of seconds of the green light. In the xth traffic light cycle, the traffic delay can be calculated as Considering the difference in vehicle arrival rate, the average vehicle delay is chosen as the evaluation index and can be calculated as where y is the number of cycles and V is the number of arrival vehicles during the observation time. e calculation of D g can be completed in one cycle, but the calculation of D r needs two cycles. e vehicle delay of the current cycle during red-light time is related to the signal timing of the previous cycle due to the different phase sequence. Here, one cycle refers to the completion of four phases. Vehicle delay can be calculated every two cycles but the vehicle delay of the last cycle during red-light time needs to be calculated separately.
is paper assumes that the two phases in the same direction are paired. e first phase direction is initialized. e control algorithms include the following steps: (1) Choose the given direction and determine the phase depending on the phase selection module of this direction.
Mathematical Problems in Engineering

Optimization Design
Two strategies are used to optimize the fuzzy controller.
After the prediction accuracy is improved, the adaptive membership function is constructed for a better phase switching. DE algorithm is also used to optimize the fuzzy control table of green time detection module. Both are devoted to solving artificial randomness in fuzzy control.

Traffic Flow Prediction Using Wavelet Neural Network.
Traffic flow seems to be very random in the short term but in the long term it has a close connection with time information. In this paper, wavelet neural network is used to predict traffic flow time sequence. e traditional s-function of hidden node is replaced in wavelet neural network by wavelet function. e basic structure is shown in Figure 3. In Figure 3, ρ 1 , ρ 2 , . . . , ρ M are the input of the wavelet neural network. o 1 , o 2 , . . . , o L are the predicted output. e corresponding weight from input layer to hidden layer and weight from hidden layer to output layer are, respectively, denoted as w ij and w jk . en the output of hidden layer y j can be obtained by the equation: where N denotes the number of the nodes in hidden layers, Ψ represents the wavelet basis function, and a j and b j are the scaling factor and the translation factor of the wavelet basis function, respectively. en the output can be obtained as e wavelet analysis improves the Fourier transform that is most widely used in the signal processing field, but it has a serious limitation. e transformation abandons time information and is unable to determine the time of signal occurrence. at is, Fourier transformation does not have distinguishing ability in the time domain.
We collect traffic data for 3 days and record the traffic flow every 15 minutes. e wavelet neural network is trained by the data of 2 days. Finally, the trained wavelet neural network is used to predict traffic flow on the third day. e four previous points can be used as input and the fifth time point is used as output. e results are shown in Figure 4. As shown in Figure 4, the predicted traffic flow can basically fit the actual traffic flow, but some points are inaccurately predicted. e predicted curve can reflect the trend of traffic flow and the average value of predicted results is similar to that of actual results. erefore, the proposed method is verified.
Considering the change in traffic flow, a single membership function may have misleading effect on phase selection. An adaptive membership function needs to be constructed, and a general membership function is defined as e values of the three parameters (x i−1 , x i , x i+1 ) can be adjusted to change the membership function in accordance with the predicted traffic flow. If traffic flow is increasing, then new x i+1 is where k is a ratio coefficient and η is the increased traffic flow compared with the average traffic flow. x i−1 and x i do not change. For example, the average traffic flow is 0.125 veh/s, while the current traffic flow is 0.2 veh/s and η is 0.3. e membership function before and after the change is shown in Figure 5. e real line represents the changed membership function. We only make a conservative change; if necessary, x i−1 can also be changed as If traffic flow is decreasing, similarly new x i−1 and x i+1 are e coefficients can be adjusted depending on the actual situation.
e arrival rate of traffic flow plays an important role in vehicle queuing. e membership function is changed to avoid the small or large effect of the arrival rate of traffic flow on fuzzy control under low or high flow rate situations. Table Optimization Using DE. DE was first proposed by Storn and Price in 1995. is algorithm is mainly used to solve the problem of real number Mathematical Problems in Engineering optimization. Similar to GA, the initial population is randomly generated, and selection criteria are fitness values for each individual in a population. e main process also includes three steps: mutation, crossover, and selection. However, differences exist between them. GA is based on fitness value to control the probability value of the offspring generated by the parent crosses, and the probability of the selected individuals with larger fitness value will also be larger. e mutation vector of DE is generated by the parent differential vector and crossovers with the parent individual vector to generate new vector and is directly selected with the parent vector. is selection process embodies the idea of greedy algorithm. us, the approximation effect of DE is more significant than that of GA. We choose DE as the optimization algorithm because the fuzzy control table has many variables and the convergence speed of GA is slow.

Fuzzy Control
Consider a parameter set X � (x 1 , x 2 , . . . , x n ), x i ∈ R, and a cost function f(X): R n ⟶ R.
e value of each parameter x i is limited to a given scope . . , n. e purpose of the algorithm is to minimize the values of parameter sets by optimizing their values and the N p individuals (chromosomes) of the initial population of candidate solutions are randomly initialized within the given boundaries as where r represents a randomly generated number with uniform probability distribution within the range [0, 1]. e change of the population is mainly based on differential mutation, where a new chromosome is generated by adding the weighted difference between two individuals of the triad to the third individual (donor). Finally, the perturbed individual and the current population member (parent) are recombined in this way: where x (G) C k ,i denotes the "donor," G is the current generation, and i * is a randomly selected integer within the interval [1, n], under the computation for all members of the population. e random number r is seeded for each chromosome parameter, while, for the mutation and crossover operations, the DE control parameters F ∈ [0, 1] and C r ∈ [0, 1] remain unchanged during the search process. en, at the selection stage, each trial vector X ′(G+1) k,i competes only against its counterpart (parent) in the current population X (G) k . e survivors of the N p competitions being better fitted than the corresponding final candidates move to the next generation. e DE selection strategy ensures the survival of the elitists, described as follows: e main control parameters of the DE algorithm include population size (M), scaling factor (F), and crossover probability (cr). We need to choose suitable values depending on the actual situation. In this paper, the fitness function is the average traffic delay. However, the parameters of the fuzzy control table are integers and DE mainly solves the problem of real number optimization.

Simulation
Data used in the simulation are collected from a single intersection in Huagang Road, Nanjing, Jiangsu Province, China. We collect data for four consecutive days at the same time period to facilitate the prediction of wavelet neural network. e simulation is conducted on MATLAB and vehicle delay. Parameters a j , b j , ω ij , ω jk of wavelet neural network can be obtained from MAT-LAB neural network toolbox. e saturated flow rate q s � 0.5 veh/s and the range of green time is [15,51].
For comparison, another traditional fuzzy controller without phase selection module is designed. e green time detection module directly decides the green time delay of current green-light phase. Figure 6 shows the traffic delay of fixed-time controller, the proposed fuzzy controller in this paper, and traditional fuzzy controller. e average traffic delay is recalculated every cycle. e traffic delay of the proposed controller is evidently decreased compared with those of fixed-time and traditional fuzzy controllers. Fixed-time controller is a conservative control and has parameters obtained on the basis of people's experience and knowledge. e control effect of the traditional fuzzy controller is not much better than that of the fixed-time controller because considering the number of queues in the current time only is insufficient. Phase selection also plays an important role. en we verify the effectiveness of vehicle prediction in phase selection. Figure 7 shows the queue vehicles in the straight phase of north direction in the two cases. One cycle includes four phases and 84 time periods. In the beginning, the controller without prediction can control the queue vehicles well. As time goes on, queuing vehicles increase gradually, and the control effect becomes poor. On the contrary, the number of queue vehicles has been kept at a lower level under the proposed controller.
At last, we also verify the effectiveness of DE algorithm in green time detection module. e optimized fuzzy control table is shown in Table 3. In the optimization process, the speed of convergence is fast, which conforms to the characteristics of the DE algorithm. e average vehicle delay results are shown in Figure 8. Figure 8 shows that DE algorithm is effective, and the control performance of the optimized green time decision is evidently better. e control performance differs in different cases. In practical application, we need to optimize the rules in different circumstances and compare the results to obtain the final fuzzy control table. e results of DE algorithm can be used as a reference to reduce the interference of human factors when making fuzzy rules.

Conclusion
e simulation results show that the proposed fuzzy controller can effectively reduce vehicle delay. e traditional fuzzy and fixed-time controllers ignore the influence of vehicle arrival rate, which leads to their poor control effect. e predicted traffic flow input is added to the signal control to adapt to the sudden change of traffic flow. en traffic flow prediction and adaptive membership function are designed for a long-term control, and the results show that the phase selection is also more accurate for a short term. Aiming at solving the problem that the subjectivity of fuzzy rules is too strong, the fuzzy control rules are optimized by DE algorithm. Also, the single-time optimization is insufficient, and the best fuzzy control table can be obtained by comparing the optimization results in different cases. However, this method is suitable for isolated intersections rather than for multiple intersections because the green time is not fixed.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that they have no conflicts of interest.    Mathematical Problems in Engineering