Inergency
An online hub for emergency and natural disaster solutions

# Two-Stage Fuzzy Traffic Congestion Detector

6

In this paper, we present a two-stage fuzzy-based approach integrating a short-term predictor (first step) and a classifier (second step). The general framework of the method is given in Figure 3. We believe that a method that assesses speed values can improve the effectiveness of detection because it is better able to characterize unstable conditions when fundamental variables are affected by rapid changes that violate the relationships that hold under stationary conditions. However, in order to do so, we acknowledge that the method used must be able to successfully reflect the relationships between the fundamental variables. Because these fundamental variables are essential for traffic engineers in several stages of a project, such as planning, design and implementation . Therefore, we wanted to investigate the performance of the Mamdani-based fuzzy logic approach at modelling the relationships between fundamental variables. The best way to test this is by estimating the value of the third variable using the other two. Following this idea, we developed a method—the two-stage traffic congestion detector—that takes as input the real traffic data for each road section and identifies the relationships between the fundamental variables (f-k-v), before estimating the speed values and determining the level of congestion according to the speeds. We focused on the speed variable instead of density in general, because speed can be measured directly, and is directly related to drivers’ experiences and to the total time spent on the network, which is a frequently used performance indicator for road traffic [8,24,25,26,28,30].
In the first step, fuzzy average speed values are computed using both flow and density inputs. After calculating the average speed values, in the second step, the traffic conditions related to them are classified. The whole model is simulated in Simulink MATLAB. In a different view from [32,34,37], the average speed is applied to detect the traffic states. This is the output parameter of the first part and the input parameter of the second part. Moreover, unlike the above-mentioned papers [32,34,37], the fuzzy model is applied here to predict traffic conditions in the next time interval. Indeed, it has been demonstrated that traffic prediction models can be improved when matching them with a preliminary classification of the traffic state . The explicit speed prediction during the first step makes it possible to assess the quality of the predictions according to standard statistical methods; the final qualitative output supplies simple information that can be communicated to drivers and traffic operators. Additionally, it is expected that giving estimations resulting in a logical process between variables could enhance the quality of congestion assessment, since many works [25,26,27] have used compound measured values as inputs to determine the level of congestion.

#### 4.1. First Step: Short-Term Average Speed Prediction

The first step of the general method was built in MATLAB and run using SIMULINK, as shown in Figure 4. The fuzzy model named ‘Fuzzy Average Speed’, presented in the middle of the figure, calculates the average speed values for the next time interval by using flow and density information.
In the ‘Fuzzy Average Speed’ model, we define two input parameters (flow and density) and one output parameter (average speed), as shown in Figure 5. We set nxi (i: variable) linguistic terms for each of them.

To represent the wide range of data, we set nx1 = nx2 = nx3 = 5 linguistic terms as:

$F = F F , R F F , A F , C F , V C F$ and K =$V L D , L D , M D , H D , V H D$

The output variable is also classified as: V = $V S , S , A , F , V F$

Explanation of variables:

• FF: Free Flow, RFF: Reasonably Free Flow, AF: Average Flow, CF: Congested Flow and VCF: Very Congested Flow

• VLD: Very Low Density, LD: Low Density, MD: Medium Density, HD: High Density and VHD: Very High Density

• VS: Very Slow, S: Slow, A: Average, F: Fast and VF: Very Fast

After defining the input and output, the ‘fuzzification’ stage should be carried out. During this stage, all variables are fuzzified by transferring the crisp numerical values into membership degrees of the fuzzy set. This is done using membership functions, which give the quantity of the degree of belongingness of a numerical value to the related fuzzy set in a closed interval [0;1]. Here, 1 expresses full membership, and 0 denotes non-membership. Among the many possible functions, the most common ones are triangular , trapezoidal [33,34,37], Gaussian, generalized bell, and sigmoidal. In this paper, triangular membership functions are used (Figure 6a–c), since they are one of the most widely used examples, and they can effectively reflect the characteristics of the fuzzy sets used here.
The boundary sets of the membership functions are relevant in this regard, since they can affect the degree of belongingness of the value to the fuzzy set. Here, they are set mostly with reference to Table 1 in . For example, the density variable is classified as ‘Low Density’ in the range between 7 and 30 vehicles/km, as in , with the subjective addition of the middle value being equal to 18 vehicles/km, which is associated with LOS B, C, D.
As an example of the mathematical form, the membership function of the Low-density variable is provided in Equation (2):

For the output variable fuzzy sets, ref  was examined.
As the core of the method, the input–output relationship should be modelled to build the inference and a nonlinear surface model with specific rules, which demonstrates how input variables are reflected in the output universe. In the literature, two types of fuzzy inference system have been described: Mamdani and Sugeno types. The prime difference between them is how the outputs are determined. Currently, Mamdani’s fuzzy inference method is popular for use in complex problems, while Sugeno-type systems are effective only in cases that have either linear or constant output membership functions. In this study, Mamdani-based inference is used. The rules for section ID 740700 are given below, and they can be stated mathematically as:

$F • F ( f ) Θ m i n K • K ( k ) → A • A ( f , k ) ,$

where the symbol $•$ states the linguistic term IS, the symbol $Θ m i n$ states the logic operator AND.

• If density is ‘Very Low’ then average speed is ‘Average’.

• If density is ‘Very Low’ then average speed is ‘Fast’.

• If density is ‘Very Low’ then average speed is ‘Very Fast’.

• If density is ‘High’ then average speed is ‘Slow’.

• If density is ‘Very High’ then average speed is ‘Very Slow’.

• If flow is ‘Free’ then average speed is ‘Average’.

• If flow is ‘Free’ then average speed is ‘Fast’.

• If flow is ‘Free’ then average speed is ‘Very Fast’.

• If flow is ‘Reasonably Free’ then average speed is ‘Average’.

• If flow is ‘Reasonably Free’ then average speed is ‘Fast’.

• If flow is ‘Congested’ then average speed is ‘Fast’.

• If flow is ‘Congested’ then average speed is ‘Average’.

• If flow is ‘Congested’ then average speed is ‘Slow’.

• If flow is ‘Very Congested’ then average speed is ‘Average’.

• If density is ‘Very High’ then average speed is ‘Slow’.

• If density is ‘Very High’ then average speed is ‘Average’.

• If density is ‘High’ then average speed is ‘Very Slow’.

• If density is ‘High’ then average speed is ‘Average’.

• If flow is ‘Average’ then average speed is ‘Very Fast’.

• If flow is ‘Average’ then average speed is ‘Fast’.

• If flow is ‘Reasonably Free’ and density is ‘Very Low’ then average speed is ‘Very Fast’.

• If flow is ‘Reasonably Free’ and density is ‘Low’ then average speed is ‘Fast’.

• If flow is ‘Average’ and density is ‘Low’ then average speed is ‘Fast’.

• If density is ‘Average’ and density is ‘Very Low’ then average speed is ‘Very Fast’.

When the inputs are defined with more than one fuzzy set, as in rules 21 to 24, the membership values must be associated with obtaining a unique result. This is done by including the AND operator between linguistic information. Here, the operator provides a minimum condition that must be met in the conditional IF statement to be fulfilled. It can be formalized as:

µF∩K = MIN (µ(F), µ(K))

At this point, each IF–THEN rule refers to a fuzzy set with the corresponding belonging membership values, which must be accumulated into a single fuzzy set. The MAX operator is one of the most widely used operators for this process. After this aggregation operation, the fuzzy set must be de-fuzzified. In this study, we used the centroid method, since it is the most widely applied.