# Intersection-Based Routing with Fuzzy Multi-Factor Decision for VANETs
## 3 Protocol Design
### Road Segment Selection
#### 3.2.3 Traffic Flow  
RSU can obtain road information under different conditions provided by the base station, such as the traffic of the road segment on a sunny day at 10 am on a Sunday, or the traffic of the road segment on a rainy day at 5 pm on a Friday. As described in the paper [28], when the traffic flow reaches 133 veh/km/lane, the road is marked as crowded. In a normal urban scenario, the speed of vehicles is limited to under 70 km/h; in this case, the vehicle density is about 20 veh/km/lane. The traffic condition is divided into  
Figure 2: An example of the direction evaluation. four types, including sparse, normal, not crowded, and crowded. The traffic of the road segment is marked as Tra and the formula is as follows:  
\[Tra=\left\{ \begin{array}{ll}\widetilde{8},&\text{free running status}\\ \widetilde{6},&\text{normal}\\ \widetilde{4},&\text{crowded}\\ \widetilde{2},&\text{\emph{sparse}}\end{array} \right.. \tag{9}\]  
After completing the quantification of the factors, the next step is to evaluate the candidate road segments. The set of candidate road segments is marked as \(\text{S}=\left\{S_{i}\ |\ i=1,\ 2\ldots n\right\}\), the set of factors is \(\text{F}=\left\{F_{j}\ |\ j=1,\ 2,\ 3\right\}\), and weights is \(\text{W}=\left\{\widetilde{w}_{j}\ |\ j=1,\ 2,\ 3\right\}\). Thus, \(\text{X}=\left\{\widetilde{x}_{ij}\ |\ i=1,\ 2\ldots n;j=1,\ 2,\ 3\right\}\) means the \(j\)th fuzzy factor score of the \(i\)th candidate road segments; \(\widetilde{w}_{j}=\left\{lw_{j},\ mw_{j},\ uw_{j}\right\}\) stands for the lower, middle, and upper values of the fuzzy weight of the \(j\)th factor. In probability theory and statistics, variance is used to measure the degree of deviation between a random variable and its mathematical expectation. The variance is larger when the data distribution is relatively dispersed (that is, the data fluctuates greatly around the mean), the sum of squares of the difference between each data and the mean is larger. On the contrary, the variance is smaller when the data distribution is more concentrated, the sum of squares of the difference between each data and the mean is smaller. Therefore, the greater the variance, the greater the fluctuation of the data; the smaller the variance, the smaller fluctuation of the data. The arithmetic square root of the variance is called the standard deviation. In this paper, we introduce the standard deviation to measure the difference of the factor between the candidate road segments. In order to get the standard deviation of each factor, the mean of each factor should be calculated first. The formula for calculating the mean is as follows:  
\[\widetilde{r_{j}}(x)=\frac{1}{n}*\sum_{i=1}^{n}\widetilde{x_{ij}},i=1,\ 2\ldots n,j=1,\ 2,\ 3. \tag{10}\]  
Then, we can calculate the standard deviation of each as following formula:  
\[\widetilde{D_{j}}=\sqrt{\frac{1}{n}*\sum_{i=1}^{n}\left[\widetilde{x_{ij}}- \widetilde{r_{j}}(x)\right]^{2}},i=1,\ 2\ldots n,j=1,\ 2,\ 3. \tag{11}\]  
The weight of each factor also reflects the importance of each factor in the candidate road segments. The weight of the \(j\)th factor can be calculated as following formula:  
\[\widetilde{w_{j}}=\widetilde{D_{j}}/\sum_{j=1}^{3}\widetilde{D_{j}},\ \text{j}=1,\ 2,\ 3. \tag{12}\]  
Before getting the optimal candidate road segment, the final total fuzzy performance score of each candidate road segment should be calculated.