A Center-Rule-Based Neighborhood Search Algorithm for Roadside Units Deployment in Emergency Scenarios

Roadside Units Deployment (RSUD) is of great importance to smart transportation with the Internet of Things (IoT). It is believed to be not feasible for RSUD to cover and perceive the whole area due to the high installation and maintenance costs. The candidate locations set of RSUD may be huge for a future urban area with vehicle-to-everything (V2X) networks. Most of the previous studies tried to maximize the Roadside Units (RSU) coverage only and made few reports on emergency scenarios, such as accidents happening. We tried to find better candidate locations of RSUD in some grid road networks with equal length streets, and then chose some of these locations for final installation with a given budget to minimize the average reporting time of emergency messages in V2X networks. Firstly, we analyzed candidate locations of RSUD for different cases of RSUs and vehicles. Then we proposed a message dissemination model for RSUD with the V2X network, and a center-rule-based neighborhood search algorithm (CNSA for short). In this algorithm, we generated initial solutions with the center rule and then obtained better neighbor solutions. Numerical simulation results from small-scale urban streets showed that the proposed algorithm performs well on execution time. Simulation results with Veins and Simulation of Urban Mobility) (SUMO) verified the proposed model and CNSA for evaluating the RSUD scheme by distance instead of accident reporting time in urban areas with large-scale traffic flow.

the properties of the D1RD problem based on greedy strategy and dynamic programming. In [16], they continued their work considering nonuniform profit density and proposed the Dynamic Limiting (DynLim) technique, which reduced the solution search space size by adjusting search space limits dynamically. Fogue et al. [21] exploited the genetic algorithm to reduce the warning notification time. Mehar et al. [5] combined two algorithms (genetic algorithm and Dijkstra algorithm) to select the best RSU locations. It is worth mentioning that they created a new chromosome by using the Gaussian mutation [25]. Aslam et al. [14] proposed two methods: an analytical Binary Integer Programming (BIP) method and a novel Balloon Expansion Heuristic (BEH) method. The former adopted branch and bound approach and the latter utilized a balloon expansion analogy to deploy RSUs for traffic accident information dissemination. Barrachina et al. [20] presented a Density-based Roadside Unit deployment policy (D-RSU) to alert emergency information. They indicated that more resources must be deployed in areas characterized by low traffic density, and less RSUs in areas with a high density of vehicles.

Candidate Location Analysis of RSUD
In this section, we mathematically analyze the impact of RSUs candidate locations on emergency information dissemination. Then we conclude that in an urban area with high traffic density or in a region with low traffic density and less RSUs, placing RSUs along roadsides (non-intersections) to disseminate emergency information would be a waste of resources.
We assumed that RSUs have been installed at intersections due to higher traffic density, and information can be propagated in all directions. Hence, we decided to deploy RSUs along the road starting at the intersection. As shown in Figure 1, the road network consists of four two-way lanes with IDs 1, 2, 3, and 4, respectively. Let R be the communication range of RSUs. We partitioned the road into several segments with 2R length starting at the intersection, and each segment is named a Cell. Taking the road with ID 1 as an example, each Cell is numbered from 0 to K in the east direction in Figure 1, such that the first Cell (at the intersection) is numbered 0. Taking the ID information of the road into consideration, we use C 0 1 to represent the first Cell. We selectively fixed RSU at the center of each Cell and denote by R 0 1 the RSU at the first Cell following the denotation of the Cell.
Mathematics 2020, 8, 1734 4 of 27 network is just a straight line) with multiple different RSUs or several identical RSUs. They also proposed the OptGreDyn algorithm by exploiting the properties of the D1RD problem based on greedy strategy and dynamic programming. In [16], they continued their work considering nonuniform profit density and proposed the Dynamic Limiting (DynLim) technique, which reduced the solution search space size by adjusting search space limits dynamically. Fogue et al. [21] exploited the genetic algorithm to reduce the warning notification time. Mehar et al. [5] combined two algorithms (genetic algorithm and Dijkstra algorithm) to select the best RSU locations. It is worth mentioning that they created a new chromosome by using the Gaussian mutation [25]. Aslam et al. [14] proposed two methods: an analytical Binary Integer Programming (BIP) method and a novel Balloon Expansion Heuristic (BEH) method. The former adopted branch and bound approach and the latter utilized a balloon expansion analogy to deploy RSUs for traffic accident information dissemination. Barrachina et al. [20] presented a Density-based Roadside Unit deployment policy (D-RSU) to alert emergency information. They indicated that more resources must be deployed in areas characterized by low traffic density, and less RSUs in areas with a high density of vehicles.

Candidate Location Analysis of RSUD
In this section, we mathematically analyze the impact of RSUs candidate locations on emergency information dissemination. Then we conclude that in an urban area with high traffic density or in a region with low traffic density and less RSUs, placing RSUs along roadsides (non-intersections) to disseminate emergency information would be a waste of resources.
We assumed that RSUs have been installed at intersections due to higher traffic density, and information can be propagated in all directions. Hence, we decided to deploy RSUs along the road starting at the intersection. As shown in Figure 1, the road network consists of four two-way lanes with IDs 1, 2, 3, and 4, respectively. Let R be the communication range of RSUs. We partitioned the road into several segments with 2R length starting at the intersection, and each segment is named a Cell. Taking the road with ID 1 as an example, each Cell is numbered from 0 to K in the east direction in Figure 1, such that the first Cell (at the intersection) is numbered 0. Taking the ID information of the road into consideration, we use 0 1 C to represent the first Cell. We selectively fixed RSU at the center of each Cell and denote by 0 1 R the RSU at the first Cell following the denotation of the Cell. A crash occurred on C 3 1 at the time ξ, which leads to a traffic jam heading east, is shown in Figure 1. For simplicity, we assume that all vehicles travel at a constant speed. The passing car A will relay the data packet including road ID, traffic conditions, and the duration D to other vehicles within its vicinity. When R 0 1 receives this message, it will disseminate the data packet in all directions, helping vehicles heading to its destination passing by road with ID 1 to reroute. The road sequence of the packet dissemination is: C 3 1 → C 2 1 → C 1 1 → C 0 1 . We will discuss the process of message dissemination in the case of RSUs (in Section 3.1) and no RSUs (in Section 3.2) in Cells, respectively.
3.1. One RSU in C 2 1 The communication link between car A and R 2 1 is short such that the propagation delay is not taken into consideration. When the car A runs into the communication range of R 2 1 , it will transmit the message to R 2 1 . The transmission time t is: where L represents the size of the packet and R T represents the transmission rate of data. Instead of taking more details about transmission delay model into consideration, we consider that the communication is almost instantaneous in this study. The transmission time in (1)  Car B running in the same direction as car A in C 1 1 , whether there is a RSU or not in C 1 1 . As shown in Figure 2, R 2 1 can't relay the packet to car B, because car B is not in the communication range of R 2 1 . There are no vehicles in C 2 1 , but we hope that the data packet can be transmitted from A before car A runs into C 1 1 ; the data packet needs to be sent to car B during the time t 1 : From (3) to (5), we can obtain a limit on the speed of car B and the distance between A and B denoted by d AB .
Based on (4), we can conclude that car B may be slowing down or stopping at the front of the traffic light. Formula (5) represents the distance limit of the distance between A and B, and we deduced that d AB should be less than or equal to 3R according to the maximum speed of car B which should be greater than or equal to zero. In other words, car B can receive the packet only if it is in the first half of C 1 1 in the driving direction and its speed meets Equation (4). Otherwise, if the speed of car B is the same as car A, the packet will be relayed to R 0 1 when car A runs into C 0 1 .  Figure 2. Car B is running in the same direction as car A in 1 1 C .
• Car B is running in the opposite direction to car A in 1 1 C , whether there is a RSU or not in 1 1 C .
As shown in Figure 3, there is no car in the same direction as Car A in the first half of C . Thus, we need car C as a data repeater and require that the distance between B and C is less than R. We assume that B and C run at the same speed as shown in Figure 4.  • Car B is running in the opposite direction to car A in C 1 1 , whether there is a RSU or not in C 1 1 . As shown in Figure 3, there is no car in the same direction as Car A in the first half of C 1 1 in the driving direction. If car B arrives before time t 1 , it can receive the message from R 2 1 . Then the packet can be relayed by car B to R 0 1 on the premise that continuous vehicles are heading in the same direction as B, or there is a car D that runs in the same direction as A on the road ahead. Then we can obtain the following:  Figure 2. Car B is running in the same direction as car A in 1 1 C .
• Car B is running in the opposite direction to car A in 1 1 C , whether there is a RSU or not in 1 1 C .
As shown in Figure 3, there is no car in the same direction as Car A in the first half of  Figure 3. Car B is running in the opposite direction to car A in 1 1 C .
If car B and car C have the same speed as car A, the distance between car B and 2 1 C should be less than 2R. We assume that time 2 t meets (6), so car B needs car C as a data repeater to transmit the packet to car D, as shown in Figure 4. Because there is no car in the same direction as Car A in the first half of 1 1 C in the driving direction, once car B runs into 2 1 C , the packet can't be transmitted from B to D due to the limit on the communication range even if car D stops in the second half of 1 1 C . Thus, we need car C as a data repeater and require that the distance between B and C is less than R. We assume that B and C run at the same speed as shown in Figure 4.  If car B and car C have the same speed as car A, the distance between car B and C 2 1 should be less than 2R. We assume that time t 2 meets (6), so car B needs car C as a data repeater to transmit the packet to car D, as shown in Figure 4. Because there is no car in the same direction as Car A in the first half of C 1 1 in the driving direction, once car B runs into C 2 1 , the packet can't be transmitted from B to D due to the limit on the communication range even if car D stops in the second half of C 1 1 . Thus, we need car C as a data repeater and require that the distance between B and C is less than R. We assume that B and C run at the same speed as shown in Figure 4. • Car B is running in the opposite direction to car A in 1 1 C , whether there is a RSU or not in 1 1 C .
As shown in Figure 3, there is no car in the same direction as Car A in the first half of R on the premise that continuous vehicles are heading in the same direction as B, or there is a car D that runs in the same direction as A on the road ahead. Then we can obtain the following: Figure 3. Car B is running in the opposite direction to car A in 1 1 C .
If car B and car C have the same speed as car A, the distance between car B and 2 1 C should be less than 2R. We assume that time 2 t meets (6), so car B needs car C as a data repeater to transmit the packet to car D, as shown in Figure 4. Because there is no car in the same direction as Car A in the first half of 1 1 C in the driving direction, once car B runs into 2 1 C , the packet can't be transmitted from B to D due to the limit on the communication range even if car D stops in the second half of 1 1 C . Thus, we need car C as a data repeater and require that the distance between B and C is less than R. We assume that B and C run at the same speed as shown in Figure 4.  Let (X C , y C ) be the coordinate of car C, (X D , y D ) be the coordinate of car D, v C be the speed of car C, v D be the speed of car D, so the distance between C and M denoted by d CM can be expressed by d CM = (R − d BC ) + (R − d D ) + v D t 2 , and the distance between M and D denoted by d MD can be expressed by d MD = y D − y C . Next, we can obtain the limits on the speed and distance of car D: If the speed of car B is not negative, then we can obtain the following inequality, where (y D − y C ) 2 is negligible, and if there is a limit on the distance between B and C (0 < d BC ≤ R), then we can obtain the speed limit of car D: Thus, it can be seen that there must be a car D running in the same direction as A in the second half of C 1 1 relying on car B and car C. (11) indicates the speed limits of car D. If continuous vehicles are running on the road in the same direction as car B, the data packet can be relayed to R 0 1 without the help of car D. If the traffic flow in the same direction as B is interrupted, but there are vehicles in the same direction as A in some Cells, the data packet can be transmitted to these vehicles. If there are no cars on the road ahead, the dissemination of accident information needs regular broadcasts of car A. Hence RSUs fixed at the road with high traffic or low traffic didn't work.
• No vehicles in C 1 1 , whether there is a RSU or not in C 1 1 . In this case, the transmission of accident information from car A to C 1 1 at least takes t 1 . RSUs fixed at the road ahead do not play a role in ITS if the conditions of both cases above cannot be met.

1
• Car B is running in the same direction as car A in C 2 1 . R 2 1 can transmit the data packet to car B (nearest to C 1 1 ). The whole process spent time 2t (see Equation (1)).
• Car B is running in the opposite direction to car A in C 2 1 . This case is the same as the second case in Section 3.1.1. • Car B running in the same direction as car A in C 1 1 , whether there is a RSU or not in C 1 1 . As shown in Figure 5a, this case is the same as the first case in Section 3.1.1.

No RSU in C
• Car B is running in the opposite direction to car A in C 1 1 , whether there is a RSU or not in C 1 1 . Assumptions we made in this case are the same as the second case in Section 3.1.1, namely continuous vehicles running in the same direction as car B or there is a car running in the direction as car A on the road ahead. Let (X A , y A ) be the coordinate of car A, (X B , y B ) be the coordinate of car B as show in Figure 5b, so the distance between C and B denoted by d CB can be expressed by d CB = X A − X B , Mathematics 2020, 8, 1734 8 of 27 and the distance between C and D denoted by d CD can be expressed by d CD = R 2 − (y A − y B ) 2 . Then we can obtain the time t 3 as follows: • Car B is running in the opposite direction to car A in 1 1 C , whether there is a RSU or not in 1 1 C .
Assumptions we made in this case are the same as the second case in Section 3.1.1, namely continuous vehicles running in the same direction as car B or there is a car running in the direction as car A on the road ahead. Let AA (x ,y ) be the coordinate of car A, BB (x ,y ) be the coordinate of car B as show in Figure 5b, so the distance between C and B denoted by CB d can be expressed by x -x , and the distance between C and D denoted by CD d can be expressed by 2

CD
A B d = R -(y -y ) . Then we can obtain the time 3 t as follows:

•
No vehicles in This case is the same as the third case in Section 3.1.1. Taking three cases in Section 3.1.1 and these three cases above into consideration, we can conclude that the RSUs fixed at roadsides in a region with low traffic density do not work, or they can only work if some extreme conditions are met. C .

Vehicles in
If  AB vv , car A cannot transmit the data packet to car B due to the communication range. In this case, car A will continue to move forward and receive periodic beacons from vehicles to sense these vehicles within its vicinity. A beacon may contain the position, speed, direction, and timestamp of a vehicle.
• Car B is not in the communication coverage of car A, and it is running in the opposite direction to car A in 2 1 C .
This case is the same as the second case in Section 3.1.1. • No vehicles in C 1 1 , whether there is a RSU or not in C 1 1 . This case is the same as the third case in Section 3.1.1. Taking three cases in Section 3.1.1 and these three cases above into consideration, we can conclude that the RSUs fixed at roadsides in a region with low traffic density do not work, or they can only work if some extreme conditions are met.

1
• Car B is in the communication coverage of car A.
The time spent by the transmission from A to B is t.
• Car B is not in the communication coverage of car A, and it is running in the same direction as car A in C 2 1 . If v A ≤ v B , car A cannot transmit the data packet to car B due to the communication range. In this case, car A will continue to move forward and receive periodic beacons from vehicles to sense these vehicles within its vicinity. A beacon may contain the position, speed, direction, and timestamp of a vehicle.
If v A > v B , car A can run into the communication coverage of car B at time t 4 .
• Car B is not in the communication coverage of car A, and it is running in the opposite direction to car A in C 2 1 . This case is the same as the second case in Section 3.1.1. In both cases in Section 3.1.2 and these three cases above, RSUs are not needed as data repeaters to work when there is high vehicle traffic. V2V communication can meet the needs of the dissemination of accident information.
It can be seen that deploying RSUs along roadsides has a great relationship with traffic density. Let R = 250 m, V be the speed of the vehicle. De represents the vehicle density as shown in Figure 6.
In both cases in Section 3.1.2 and these three cases above, RSUs are not needed as data repeaters to work when there is high vehicle traffic. V2V communication can meet the needs of the dissemination of accident information.
It can be seen that deploying RSUs along roadsides has a great relationship with traffic density. Let R = 250 m, V be the speed of the vehicle. De represents the vehicle density as shown in Figure 6. RSUs are not required to be deployed when the vehicle density De = 1 and De 4  . Because the vehicle density in urban areas is almost 20 vehicles/km regardless of peak or off-peak in Xi'an city, China, we only considered fixing RSUs at intersections due to higher traffic density, and information can be propagated in all directions.

Model and Algorithm
Based on the analysis in Section 2, we considered deploying RSUs at intersections to help disseminate information. We assume that all RSUs are connected via a backbone network, just as Merha et al. did in [3] and Chen et al. did in [5], which can relay up-to-date information from one RSU to some RSUs in distant regions in a very short time. RSUs work together to coordinate actions and to exchange or process various types of information.
The scenario is shown in Figure 7. Once an accident occurs, a passing car will relay this accident information (street name/conditions, accident duration) to other vehicles in the communication coverage area of the car. When other vehicles receive the information, they also RSUs are not required to be deployed when the vehicle density De = 1 and De ≥ 4. Because the vehicle density in urban areas is almost 20 vehicles/km regardless of peak or off-peak in Xi'an city, China, we only considered fixing RSUs at intersections due to higher traffic density, and information can be propagated in all directions.

Model and Algorithm
Based on the analysis in Section 2, we considered deploying RSUs at intersections to help disseminate information. We assume that all RSUs are connected via a backbone network, just as Merha et al. did in [3] and Chen et al. did in [5], which can relay up-to-date information from one RSU to some RSUs in distant regions in a very short time. RSUs work together to coordinate actions and to exchange or process various types of information.
The scenario is shown in Figure 7. Once an accident occurs, a passing car will relay this accident information (street name/conditions, accident duration) to other vehicles in the communication coverage area of the car. When other vehicles receive the information, they also relay this information. When some vehicles with received information run into the communication coverage area of one RSU, they will relay this information to the RSU. This RSU will relay the information to other RSUs in a short time. This information is then disseminated via all connected RSUs so that other cars may use it for improved route planning. We model the RSUD problem with V2X network as the message dissemination RSUD model and propose the center-rule-base neighborhood search algorithm for it. relay this information. When some vehicles with received information run into the communication coverage area of one RSU, they will relay this information to the RSU. This RSU will relay the information to other RSUs in a short time. This information is then disseminated via all connected RSUs so that other cars may use it for improved route planning. We model the RSUD problem with V2X network as the message dissemination RSUD model and propose the center-rule-base neighborhood search algorithm for it.

The Proposed Information Dissemination RSUD Model
The street layout of the urban area of our interest is modeled by a perfect grid G = (V,E) , which consists of X vertical roads intersected with X horizontal roads. The grid street pattern is very common in many cities, such as Xi'an and Beijing, China. The set t ml is less than t mi without considering exceptional cases. When l R receives the packet, it will disseminate this information to other RSUs via a backbone network. Hence, if an accident occurred on one road, the accident information only needs to be transmitted to the nearest RSU. The objective of this paper is to choose some intersections to deploy RSUs with the given budget, minimizing the average reporting time of emergency messages in the road network of our interest.

The Proposed Information Dissemination RSUD Model
The street layout of the urban area of our interest is modeled by a perfect grid G = (V, E), which consists of X vertical roads intersected with X horizontal roads. The grid street pattern is very common in many cities, such as Xi'an and Beijing, China. The set V = {v 0 , v 1 , . . . v L } represents a collection of points and E = {e 0 , e 1 , . . . e M } represents a collection of edges. Let W = {ω 0 , ω 1 , . . . , ω L } be the weight set of the corresponding set of vertices V. The two vertices of one edge e k can also be denoted by v i and v j , and this edge can be denoted by e ij . Let p ij (p k ) be the probability of accidents happening on e ij (e k ), ω i be the weight of the vertice v i , it equals the sum of accident probability of four edges associated with v i , namely j p ij . The decision variable R i represents whether a RSU is fixed or not at intersection v i .
As shown in Figure 8, we assume that an accident occurred on the accident-prone road e m and the RSU R i is fixed at in v i , RSU R l is fixed at in v l . A passing car on e m will relay the data packet including road ID, traffic conditions, and the duration D to other vehicles within its vicinity. Let t mi be the time when R i received the packet, t ml be the time when R l received the packet. t ml is less than t mi without considering exceptional cases. When R l receives the packet, it will disseminate this information to other RSUs via a backbone network. Hence, if an accident occurred on one road, the accident information only needs to be transmitted to the nearest RSU. The objective of this paper is to choose some intersections to deploy RSUs with the given budget, minimizing the average reporting time of emergency messages in the road network of our interest. Other notations used are summarized in Table 1.   is not feasible to evaluate and compare all the strategies. Obtaining the optimal subset of the RSU locations is actually a difficult optimization problem. Other notations used are summarized in Table 1. Our RSUD problem can be formulated as follows: min f 1 in (14) represents the time that the accident information on e k is transmitted to the nearest RSU. f 2 in (15) indicates our objective of this paper and the second constraint represents that the RSU deployment cost cannot exceed the total budget. This RSUD problem is a combinatorial optimization problem. If we deploy T RSUs at S intersections, we can get C T S deployment strategies. If we assume that there are 20 RSUs to be selectively fixed at 100 intersections, we need to evaluate C 20 100 ≈ 5.36 × 10 20 strategies. Obviously, it is not feasible to evaluate and compare all the strategies. Obtaining the optimal subset of the RSU locations is actually a difficult optimization problem.
The vehicle density is high enough to enable V2V communication to be carried out continuously, so we can transform the time problem into the distance problem. We assume that X vertical roads are intersected with X horizontal roads with equal length and one RSU is fixed at the (M, N) intersection. Let DistMat be the distance matrix of the RSU fixed at the (M, N) intersection and its size is (2 × X + 1) 2 , then assign DistMat from row 2M, column 2N with 1, 2, 3, etc. DistMat represents the distance between each road and the RSU fixed at the (M, N) intersection like a diamond shape with (M, N) as the center. For example, there are 6 × 6 intersections as shown in Figure 9 and a RSU is deployed at the (3,4) intersection. The distance matrix DistMat is obtained as follows:  The vehicle density is high enough to enable V2V communication to be carried out continuously, so we can transform the time problem into the distance problem. We assume that X vertical roads are intersected with X horizontal roads with equal length and one RSU is fixed at the (M, N) intersection. Let DistMat be the distance matrix of the RSU fixed at the (M, N) intersection and its size is 2 × (2 X + 1) , then assign DistMat from row 2M, column 2N with 1, 2, 3, etc. DistMat represents the distance between each road and the RSU fixed at the (M, N) intersection like a diamond shape with (M, N) as the center. For example, there are 6 × 6 intersections as shown in Figure 9 and a RSU is deployed at the (3, 4) intersection. The distance matrix DistMat is obtained as follows:   For calculation convenience, let n ij (n k ) be the number of accidents happening on e ij (e k ) to replace p ij (p k ). The size of the accident matrix AcciMat is the same as DistMat as follows: · · · n 13 . . . n 72 · · · n 78 n 79 · · · n 84 However, the distance matrix changes due to the RSU combination deployment. We have to calculate the degressive distance matrix DegDistMat with the same size as DistMat. "Degressive" Now, for one RSU deployment problem, our objective is to find the minimum value of DistMat· AcciMat. For multiple RSUs deployment problems, we need to find a RSU deployment combination to minimize the outcome of DegDistMat × AcciMat.

The Proposed Center-Rule-Based Neighborhood Search Algorithm (CNSA)
Based on the model in Section 3.1, we first consider the full RSUs coverage problem. For X × X intersections, the solution of RSUD problem is definitive when deploying greater than or equal to X × X/2 RSUs. We can deploy at most X × X/2 + (X − 2)/2 × 4 + 2 RSUs at some of these intersections. For example, the locations of 18 RSUs at 6 × 6 intersections are as shown in Figure 10a, or the figure when we rotate it 90 degrees. If one more is deployed, we can choose these locations at the figure edge such as (6, 1), (1, 6), (1, 2), (1, 4), (2, 1) and so on according to the accident probability of the road associated with these locations. If we deploy one RSU at (6, 1), two roads will be covered. Namely, we need to calculate the sum of the accident probability of two roads associated with (6, 1). In Figure 10a, we can deploy at most (6 − 2)/2 × 4 = 8 RSUs. Or as shown in Figure 10b, if we deploy greater than 32 RSUs at 8 × 8 intersections, we can directly determine these RSUs locations. Based on the above discussion, we only considered deploying 1~X × X/2 RSUs. Let K be the number of RSUs with a given budget. We generated initial solutions with the center rule, which can be defined as: when K = 1-4, the whole road network is divided using the diagonal line. When K > 4, we divide the road network into equal parts by the horizontal and vertical lines, then assign Based on the above discussion, we only considered deploying 1~X × X/2 RSUs. Let K be the number of RSUs with a given budget. We generated initial solutions with the center rule, which can be defined as: when K = 1-4, the whole road network is divided using the diagonal line. When K > 4, we divide the road network into equal parts by the horizontal and vertical lines, then assign different numbers of RSUs to each part according to the sum of accident weights of each part. In each part we deploy RSUs using the rules when K = 1-4, which are detailed as follows: (1) Center rule (K = 1): Take four positions of the grids obtained by the quartering method near the center of the road network as the initial positions, as shown in Figure 9. The four positions are (3,3), (3,4), (4,3), and (4, 4) respectively.
(2) Center rule (K = 2): Divide the road network into two parts from the diagonal line and one RSU will be fixed at each part as shown in the first figure of Figure 11a. Taking the upper part as an example, we first divide the upper part into two sections from the vertical line, and then choose the center point (intersection) of the vertical line as the RSU location. Because the road network is symmetrical, we can get some combinations of positions as shown in the second figure of Figure 11a: ((2, 3), (5, 4)), ((2, 4), (5, 3)), ((3, 2), (4, 5)), ((4, 2), (3,5)). For the vertical line with odd length, the selected point should be farther away from the diagonal line than the edge. For example, in the first figure of Figure 11b, we will choose the intersection (2, 4) as the initial location, not (3,4). The reason for the above decision is as follows. As shown in two pictures in the middle of Figure 11b, the number of 3 in the left road network with two RSUs fixed at the intersection (2, 4) and intersection (7, 5) is greater than that in the right road network with two RSUs fixed at the intersection (3, 4) and intersection (6,5), 34 and 32, respectively. The distance is extended like a diamond, so the more the short distances in the road network, the better. Finally, we can obtain some candidate positions to deploy RSUs as shown in Figure 11b, they are: ((2, 4), (7, 5)), ((2, 5), (7, 4)), ((4, 2), (5, 7)), ((5, 2), (4, 7)). (3) Center rule (K = 3): The road network is divided into three parts from the diagonal line. The RSU locations selection rule of the upper part is the same as the center rule (K = 2), as shown in Figure 12. We can also obtain four solutions when K = 3.  (3) Center rule (K = 3): The road network is divided into three parts from the diagonal line. The RSU locations selection rule of the upper part is the same as the center rule (K = 2), as shown in Figure 12. We can also obtain four solutions when K = 3. (3) Center rule (K = 3): The road network is divided into three parts from the diagonal line. The RSU locations selection rule of the upper part is the same as the center rule (K = 2), as shown in Figure 12. We can also obtain four solutions when K = 3. For the deployment of  2 4 < K 4 RSUs, the road network is partitioned into four grids using the quartering method as mentioned in center rule (K = 1). Each grid will be deployed at least one RSU according to the central rule. In Section 3.1, we defined a weight   (3) Center rule (K = 3): The road network is divided into three parts from the diagonal line. The RSU locations selection rule of the upper part is the same as the center rule (K = 2), as shown in Figure 12. We can also obtain four solutions when K = 3. For the deployment of  2 4 < K 4 RSUs, the road network is partitioned into four grids using the quartering method as mentioned in center rule (K = 1). Each grid will be deployed at least one RSU according to the central rule. In Section 3.1, we defined a weight  For the deployment of 4 < K ≤ 4 2 RSUs, the road network is partitioned into four grids using the quartering method as mentioned in center rule (K = 1). Each grid will be deployed at least one RSU according to the central rule. In Section 3.1, we defined a weight ω i for each intersection v i , likewise, let WeiMat be the weight matrix of intersections with the same size as DistMat. For example, the weight ω 1 of the intersection (1, 1) in Figure 9 is (n 1 + n 7 + n 8 + n 14 ). The WeiMat is shown as follows: Calculate weights and we can get 2 × 2 GridMat as follows: When deploying five RSUs, we will deploy two RSUs in the grid with the largest ϕ. For K = 6, we deploy two RSUs in the two diagonal grids with the largest sum of ϕ(ϕ 1 + ϕ 4 > ϕ 2 + ϕ 3 ), which makes the layout of RSUs symmetrical. When K = 7, we will deploy two RSUs with largest ϕ(ϕ 2 > ϕ 3 ) in another two ϕs on the conditions of K = 6, as shown in Figure 14a.

  34
When deploying five RSUs, we will deploy two RSUs in the grid with the largest  . For K = 6, we deploy two RSUs in the two diagonal grids with the largest sum of  ( 1 4 2 3 ++      ), which makes the layout of RSUs symmetrical. When K = 7, we will deploy two RSUs with largest  ( 23   ) in another two s  on the conditions of K = 6, as shown in Figure 14a.  The average running time of calculating the objective function of one location combination of RSUD is 0.0028 s; however, the time consumed by deploying three RSUs at 10 × 10 intersections using the exhaustive method is C 3 100 × 0.0028 ≈ 0.13h. It will take 13 h to test 100 cases with different accident matrices. The time consumed by deploying 16 RSUs at 12 × 12 intersections using the exhaustive method is C 16 144 × 0.0028 ≈ 5.35 × 10 14 h, namely 6 × 10 10 years. In this case, we cannot use the exhaustive method. Hence, we only list some cases that can be calculated in a finite time. As can be seen from Table 1, when only one RSU is deployed and 10,000 cases are tested, the solutions of our method is 100% equal to the best solutions when X = 2, 4, 6, 8. When two RSUs are deployed at 16 × 16 intersections and 100 cases are tested, 80% of the solutions are still equal to the best solution, and the average difference is less than 0.02%. As the scale of the problem increases, the numerical time for deploying three RSUs was large, so only 20 cases were tested for 8 × 8 and 10 × 10 intersections, but 70% were still equal to the optimal solution with an average difference of less than 0.1%. For 8 × 8 and 12 × 12 intersections, 1-16 RSUs are deployed. The accident matrix used by our CNSA is shown in Figure 15a,b, respectively. We assumed that the distance of each road was 1. It can be seen that the average distance (only one accident happened, namely total distance/the sum of accidents) decreases as the number of RSUs increases in Figure 16. Execution time of our CNSA did not exceed 6 s in the road network with 8 × 8 intersections, and it did not exceed 35 s in the road network with 12 × 12 intersections. Figure 17 showed some RSUD schemes obtained by our CNSA.  years. In this case, we cannot use the exhaustive method. Hence, we only list some cases that can be calculated in a finite time. As can be seen from Table 1, when only one RSU is deployed and 10,000 cases are tested, the solutions of our method is 100% equal to the best solutions when X = 2, 4, 6, 8. When two RSUs are deployed at 16 × 16 intersections and 100 cases are tested, 80% of the solutions are still equal to the best solution, and the average difference is less than 0.02%. As the scale of the problem increases, the numerical time for deploying three RSUs was large, so only 20 cases were tested for 8 × 8 and 10 × 10 intersections, but 70% were still equal to the optimal solution with an average difference of less than 0.1%. For 8 × 8 and 12 × 12 intersections, 1-16 RSUs are deployed. The accident matrix used by our CNSA is shown in Figure 15a,b, respectively. We assumed that the distance of each road was 1. It can be seen that the average distance (only one accident happened, namely total distance/the sum of accidents) decreases as the number of RSUs increases in Figure 16. Execution time of our CNSA did not exceed 6 s in the road network with 8 × 8 intersections, and it did not exceed 35 s in the road network with 12 × 12 intersections. Figure 17 showed some RSUD schemes obtained by our CNSA.  In our simulation, the following factors are considered in the simulation of Internet of Vehicle (IoV): (1) Traffic simulator: road network, road traffic, trips, and routes.
(3) Bidirectionally coupled network and road traffic simulation.
In this work, we utilize Veins (Vehicles in Network Simulation) simulation framework based on OMNeT++ (Objective Modular Network Testbed in C++) network simulator and SUMO (Simulation of Urban Mobility) traffic simulator to evaluate the rationality of our model and CNSA.
Veins is an open-source framework for running vehicular network simulations and supports the simulation of wireless communication protocols in VANETs.
As shown in Figure 18, OMNET++ extracts traffic information (such as road network, traffic lights, and routes) from SUMO by TraCI (Traffic Control Interface). Each vehicle generated by SUMO is modeled as a connected car including three modules (mobility layer, application layer, and network interface card layer) in Veins. Veins also modeled RSU with the same structure as a connected car. Unlike cars, the mobility layer of RSU defines a static mobility pattern (meaning only a position, no movement). Their behaviors defined by application layer are also different. In our simulation, we changed C++ code in the application layer of car and RSU, respectively. We assume that an accident has occurred when a vehicle on a lane stopped for 300 s. The accident vehicle will send a message with lane information to other vehicles or RSUs in the communication range. Once one vehicle receives the message, it will check its route and rearrange another route when its route includes the accident lane and spreads this message only once in the communication range after 5 s plus a random time in (0.01, 0.2). RSU will spread this message after 2 s plus a random time in (0.01, 0.2). We simulated the network with 64 intersections and eight RSUs shown in Figure 17a, and the markers of intersections are shown in Figure 19. As shown in Figure 18, OMNET++ extracts traffic information (such as road network, traffic lights, and routes) from SUMO by TraCI (Traffic Control Interface). Each vehicle generated by SUMO is modeled as a connected car including three modules (mobility layer, application layer, and network interface card layer) in Veins. Veins also modeled RSU with the same structure as a connected car. Unlike cars, the mobility layer of RSU defines a static mobility pattern (meaning only a position, no movement). Their behaviors defined by application layer are also different. In our simulation, we changed C++ code in the application layer of car and RSU, respectively. We assume that an accident has occurred when a vehicle on a lane stopped for 300 s. The accident vehicle will send a message with lane information to other vehicles or RSUs in the communication range. Once one vehicle receives the message, it will check its route and rearrange another route when its route includes the accident lane and spreads this message only once in the communication range after 5 s plus a random time in (0.01, 0.2). RSU will spread this message after 2 s plus a random time in (0.01, 0.2). We simulated the network with 64 intersections and eight RSUs shown in Figure 17a, and the markers of intersections are shown in Figure 19.  We used two types of vehicles (passenger car and taxi), the difference is that the former has the biggest speed limit of 12 m/s, while the latter has a maximum speed limit of 13.89 m/s. "randomTrips.py" was used to generate a set of random trips for our network. In this procedure, we generated route files with valid vehicle routes by using the option "--route -file." This work calls the compiler "DUAROUTER" automatically to turn the random trips into routes. We added three detectors in the network to obtain output data: induction loops detectors (E1), lanearea detectors (E2), and multi-entry-exit detectors (E3). E1 and E2 were placed on each lane, while E3 was placed at each intersection. These detectors have the same frequency of 60 s, namely each detection collects traffic information every 60 s. E1 can collect the total number of vehicles that pass through the detector entirely within the interval, the average speed of these vehicles, the average length of vehicles, etc. E2 can detect the average stop time of vehicles, the average number of vehicles stopped, the length of vehicles in congestion, and so on. The vehicle's speed threshold is 1.38 m/s when the vehicle is recognized as halting. If the distance between the vehicle and its next standing vehicle is 10 m, this vehicle is described as a participant in a jam. E3 can collect the sum of the vehicles entered.  Figure 19. Road network in Simulation of Urban Mobility (SUMO).
We used two types of vehicles (passenger car and taxi), the difference is that the former has the biggest speed limit of 12 m/s, while the latter has a maximum speed limit of 13.89 m/s. "randomTrips.py" was used to generate a set of random trips for our network. In this procedure, we generated route files with valid vehicle routes by using the option "--route -file." This work calls the compiler "DUAROUTER" automatically to turn the random trips into routes. We added three detectors in the network to obtain output data: induction loops detectors (E1), lanearea detectors (E2), and multi-entry-exit detectors (E3). E1 and E2 were placed on each lane, while E3 was placed at each intersection. These detectors have the same frequency of 60 s, namely each detection collects traffic information every 60 s. E1 can collect the total number of vehicles that pass through the detector entirely within the interval, the average speed of these vehicles, the average length of vehicles, etc. E2 can detect the average stop time of vehicles, the average number of vehicles stopped, the length of vehicles in congestion, and so on. The vehicle's speed threshold is 1.38 m/s when the vehicle is recognized as halting. If the distance between the vehicle and its next standing vehicle is 10 m, this vehicle is described as a participant in a jam. E3 can collect the sum of the vehicles entered.
Other parameters are set as shown in Table 3. The parameter "period" in the table means that SUMO will generate a passenger car with equidistant departure times and period = 0.2. We did so to enable that vehicle density on each road can be 20 vehicles/km at 480 s.  Other parameters are set as shown in Table 3. The parameter "period" in the table means that SUMO will generate a passenger car with equidistant departure times and period = 0.2. We did so to enable that vehicle density on each road can be 20 vehicles/km at 480 s.  In our simulation, rsu [3] received the message at 514.10 s and sent this message at 516.12 s. Of all the RSUs, the lane E6E5 is closest to rus [3], which indicates that it is reasonable to evaluate RSUD scheme using our CNSA by distance instead of accident reporting time. Other RSUs sent the message after 2 s plus a random time in (0.01, 0.2) and specific time in different scenarios is shown in Table 4. It can be seen in Figure 20 that all RSUs have already sent the message once when the simulation time is 519 s (The vehicle icon turns green when it receives the message).  As shown in Figure 21b,c, almost all vehicles have received the message in the connected RSUs scenario when the simulation time is 543 s, while many vehicles have not received the message in the disconnected RSUs scenario when the simulation time is 622 s. As shown in Figure 21b,c, almost all vehicles have received the message in the connected RSUs scenario when the simulation time is 543 s, while many vehicles have not received the message in the disconnected RSUs scenario when the simulation time is 622 s.
In Figure 22, "speed" means the arithmetic mean of the velocities of all completely collected vehicles (−1 indicate that no vehicles were collected by the detector). "nVehEntered" means the sum of vehicles have touched the detector within the interval. "speed" and "nVehEntered" collected by E1 in three scenarios are same. It can be seen in Figures 21a and 22 that there is no space to allow vehicles to enter the lane E6E5 within the interval (300-360 s). It is obvious that no vehicle entered into the lane E6E5 until accident relief (at 800 s). Therefore, the speed and number of vehicles obtained by E1 on lane E6E5 between the simulation time 300 s and 800 s do not reveal the lane change decision of the vehicle that received the message.
In Figure 23, "vehicleSumWithin" means the number of vehicles that have entered but not yet left the area (8 lanes covered by E3 on the intersection E6). "meanDurationWithin" means the mean duration of these vehicles within the area. The sum of vehicles has entered intersection E6 after 800 s differed in three scenarios, which indicates that vehicles have received the message and made the lane change decision. The number of vehicles entered intersection E6 in our connected RSU scenario was the least of three scenarios. We verified that the connected RSU scenario achieved the extensive coverage of the message. The parameter "meanDurationWithin" could also indicate that most vehicles have rearranged their routes in the connected RSU scenario. In Figure 22, "speed" means the arithmetic mean of the velocities of all completely collected vehicles (−1 indicate that no vehicles were collected by the detector). "nVehEntered" means the sum of vehicles have touched the detector within the interval. "speed" and "nVehEntered" collected by E1 in three scenarios are same. It can be seen in Figures 21a and 22 that there is no space to allow vehicles to enter the lane E6E5 within the interval (300-360 s). It is obvious that no vehicle entered into the lane E6E5 until accident relief (at 800 s). Therefore, the speed and number of vehicles obtained by E1 on lane E6E5 between the simulation time 300 s and 800 s do not reveal the lane change decision of the vehicle that received the message.
In Figure 23, "vehicleSumWithin" means the number of vehicles that have entered but not yet left the area (8 lanes covered by E3 on the intersection E6). "meanDurationWithin" means the mean duration of these vehicles within the area. The sum of vehicles has entered intersection E6 made the lane change decision. The number of vehicles entered intersection E6 in our connected RSU scenario was the least of three scenarios. We verified that the connected RSU scenario achieved the extensive coverage of the message. The parameter "meanDurationWithin" could also indicate that most vehicles have rearranged their routes in the connected RSU scenario.   indicate that most vehicles have rearranged their routes in the connected RSU scenario.

Conclusions
In this study, we analyzed candidate locations of RSUD for different cases of RSUs and vehicles. We discussed the process of message dissemination in the case of RSUs (in Section 3.1) and no RSUs (in Section 3.2) in Cells, respectively. In Sections 3.1 and 3.2, we discussed two cases about whether there are vehicles running in cell or not and then analyzed the impact of the vehicle's position (direction/speed) on the message dissemination. According to the above analysis, we assumed that the urban area of our interest had high traffic flow and considered intersections as candidate locations to place RSUs without considering roadside. We also assumed that all RSUs were connected via a backbone network and focused on finding better RSUs locations with the given budget to minimize the average reporting time of emergency messages. To do that, we proposed a new model and algorithm to deploy RSUs in V2X urban areas with large-scale traffic flow. We tested some cases with different AcciMats and number of intersections to evaluate our algorithm. The solutions of our method were 100% equal to the best solutions when X = 2, 4, 6, 8 in 10,000 cases when we only deployed one RSU. For three RSUs on 8 × 8 and 10 × 10 intersections, 70% of solutions were still equal to the optimal solution with an average difference of less than 0.1%. For 8 × 8 and 12 × 12 intersections, we deployed 1~16 RSUs, respectively. We also verified that the connected RSU scenario achieved the extensive coverage of the message. Our approach could provide guidance for some government decisions makers to deploy RSU in smart cities. Some manufacturing enterprises or AGV workshop plants can also obtain a benefit from our approach to deploy smart devices. However, in our algorithm, we considered the grid street pattern with equal length and assigned these roads with weights 1, 2, 3 etc. for simplicity. For some streets with different lengths, we have to integrate with some complicated methods considering vehicle routes to assign weights. In future research, we will try to deal with this new problem and propose some strategies to abstract a map of the city area with different road geometry into a grid graph. Technological enablers like 5G, big data, digital transportation infrastructure, cloud computing, and mobile edge computing are expected to pave the way for a revolution in mobility of cities and inter-cities. We will study some vehicle-road coordination scenarios such as intersection coordination and ramp merging.