Large-scale microscopic traffic parallel simulation method based on community detection
Through the parallel simulation method based on community detection, large-scale transportation networks are divided and parallelized, which solves the problems of long calculation time and high resource consumption of traditional methods, and achieves efficient and accurate traffic simulation.
Patent Information
- Application Number
- CN202411903021.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-01
AI Technical Summary
When facing large-scale transportation networks, traditional micro-traffic simulation methods have long calculation time and high resource consumption, making it difficult to meet the needs of real-time traffic management and decision support.
A large-scale parallel simulation method of micro-traffic based on community detection is adopted, and the traffic network is divided through the Leiden algorithm and the K-Leiden algorithm to build an efficient parallel computing framework, and simulated with the micro-traffic simulation tool SUMO.
It significantly improves the computing efficiency and resource utilization of traffic simulation, ensures the simulation accuracy and reliability of results, and has good scalability and flexibility.
Smart Images

Figure CN119740388A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of traffic simulation, and in particular to a large-scale microscopic traffic parallel simulation method based on community detection. Background Art
[0002] With the acceleration of urbanization, urban transportation systems have become more complex, and problems such as traffic congestion and environmental pollution have become increasingly prominent. Microscopic traffic simulation, as an effective tool for traffic flow analysis, can study traffic flow characteristics and their changes by simulating the behavior of individual vehicles. However, traditional microscopic traffic simulation methods have long calculation times and high resource consumption when facing large-scale traffic networks, making it difficult to meet the needs of real-time traffic management and decision support.
[0003] Community detection technology can effectively identify areas of mutual influence in traffic networks and optimize traffic flow. As an advanced community detection method, the Leiden algorithm has better convergence and stability than the Louvain algorithm and can handle complex traffic networks. However, when the existing Leiden algorithm is used for community division, it is difficult to obtain the target number of division results, and the number of divided sub-communities is uncontrollable. Summary of the invention
[0004] The purpose of the present invention is to provide a large-scale microscopic traffic parallel simulation method based on community detection, to improve the Leiden algorithm, to obtain controllable road network community division results, and to combine the microscopic traffic simulation tool SUMO (Simulation of Urban MObility) to build an efficient parallel computing framework, thereby significantly improving the efficiency of traffic simulation.
[0005] The purpose of the present invention can be achieved by the following technical solutions:
[0006] A large-scale microscopic traffic parallel simulation method based on community detection includes the following steps:
[0007] S1, obtaining existing road network data and routing data;
[0008] S2, constructing a first road network topology graph according to the road network data, performing connectivity detection on the first road network topology graph, removing disconnected components therein, and retaining the largest subgraph as a second road network topology graph;
[0009] S3, according to the routing data, combined with the second road network topology, the number of vehicles passing through each lane is calculated, and the number of vehicles passing through each lane is divided by the lane length to obtain the lane flow rate as the lane weight, and the lane weight is nonlinearly amplified and assigned to the corresponding edge to obtain the third road network topology;
[0010] S4, based on the third road network topology, using Leiden community detection to achieve community division, and obtain preliminary community division results;
[0011] S5, based on the preliminary community division results, use K-Leiden community detection to merge communities, adjust the number of partitions, and obtain the final community division results;
[0012] S6, based on the final community division results, parallel simulation computing tasks are allocated to perform large-scale microscopic traffic simulation.
[0013] The road network data includes lane information, intersection information and traffic light information.
[0014] The routing data includes vehicle type, starting point, departure time and route information.
[0015] The step S2 is specifically as follows:
[0016] For the first network topology G1 = (V, E), where V is the node set and E is the edge set, the connected component algorithm is used to identify all connected subgraphs C i , where i = 1, 2, ..., N, N is the number of connected subgraphs;
[0017] Maximum connected component C max Determined by the following formula:
[0018]
[0019] Where |V(C i )| represents the connected subgraph C i The number of nodes in ;
[0020] Select the connected subgraph C with the largest number of nodes max As the second road network topology diagram G2.
[0021] The step S3 specifically comprises: combining the existing vehicle routing information with the attribute information of the road network G2, taking into account the traffic flow, length, traffic capacity and connection relationship of the road section, and calculating the weight of the edge of the road network topology graph:
[0022] S31, count the number of vehicles passing each edge, for each edge e in the road network i , count the number of times it is passed by vehicles c(e i ):
[0023]
[0024] Among them, the edge represents the lane; R is the path set of all vehicles; δ(e i ,r) is the indicator function, when edge e iWhen it appears in path r, δ(e i ,r)=1, otherwise δ(e i ,r)=0;
[0025] S32, calculate the initial weight, and calculate the initial weight w0(e i ):
[0026]
[0027] Among them, l(e i ) is the edge e i Length, i.e. lane length;
[0028] S33, nonlinearly amplify the initial weight to obtain the final weight w(e i ):
[0029] w(e i )=[w0(e i )] α
[0030] Among them, α is the amplification factor;
[0031] S34, the calculated final weight w(e i ) are assigned to the corresponding edges to obtain a weighted third road network topology graph G3=(V,E,w), where V is the node set; E is the edge set; and w is the edge weight set.
[0032] The step S4 comprises the following steps:
[0033] S41, initializing node community allocation, allocating each node in the network, i.e., the road network intersection, to a separate community to form an initial community network;
[0034] S42, perform local mobility optimization. For each node, try to move it from its community to other communities, calculate the change ΔQ of the quality function of the community after the move, and if ΔQ>0, assign the node to the community that can obtain the maximum modularity gain ΔQ; otherwise, the node remains in the current community; the quality function is represented by modularity Q, which ranges from -1 to 1. The higher the value, the more obvious the community structure. The calculation method is:
[0035]
[0036] Among them, A ij is the adjacency matrix of the network, k i and k j is the degree of nodes i and j, m is the number of edges in the network, c i and c jis the community to which nodes i and j belong, δ(c i ,c j ) is the Dirac delta function, when c i =c j When γ>1, more, smaller and tightly connected communities will be formed; when 0<γ<1, fewer, larger but relatively less tightly connected communities will be formed;
[0037] S43, after all nodes have finished moving, Leiden algorithm performs community refinement to ensure that all communities have good connectivity. It is worth noting that the refinement phase does not follow a greedy strategy, but merges nodes with randomly selected communities to increase the quality function. This randomness allows for a wider range of discovery of the partition space;
[0038] S44, performing aggregation based on the refinement in step S43, using the unrefined partitions to create an initial partition of the aggregated network, wherein each community is refined into multiple sub-partitions and aggregated into independent nodes respectively;
[0039] S45, on the network aggregated in step S44, continue to move a single node in the aggregated network to refine the network, while keeping the partition unchanged;
[0040] S46, repeat the above steps S42-S45 until the modularity does not improve further, the Leiden algorithm reaches convergence or meets the stop condition, and then outputs the preliminary community division result C init , where each community represents a road network subgraph or module.
[0041] The change ΔQ of the mass function is calculated as follows:
[0042]
[0043] Where m is the sum of all edge weights in the graph, ω i is the sum of the edge weights connecting node i, ∑ tot ω i is the sum of the weights of all nodes in the target community, is the sum of the edge weights between node i and the nodes in the target community.
[0044] The step S5 comprises the following steps:
[0045] S51, obtaining the preliminary community division result C obtained in step S4 init , which contains the community identifier and the nodes contained in the corresponding community, and its neighbor set v adjacency , v adjacencyContains the community nodes and the node's neighbor list;
[0046] S52, obtain the minimum community c from the community division result smallest and its adjacent smallest community c adjacent Two communities, merge the nodes of the two communities to form a new community c′, update the community division result, and get C′ init , delete community c smallest and c adjacent , add the newly merged community c′, where the community merging process formula is defined as follows:
[0047] Assume that community c smallest and c adjacent The nodes are:
[0048] c smallest ={n1,n2,...,n p},c adjacent ={n p+1 ,n p+2 ,...,n q}
[0049] The merged community c′ is:
[0050] c′=c smallest ∪c adjacent ={n1,n2,...,n q}
[0051] Where p is the community c smallest The number of nodes in community c, qp is adjacent , q is the number of nodes in the merged community c′;
[0052] S53, loop through step S52 to merge until the number of merged communities reaches the target number k, and output the final community division result C k .
[0053] The step S6 specifically includes: interacting with the micro traffic simulation system through the TraCI interface to automatically generate micro traffic simulation configuration parameters for different road network sub-partitions, wherein the road network sub-partitions are determined based on the final community division result;
[0054] During the loop simulation process, the current road, coordinate position, instantaneous speed, lane number, lane ID, lane position, lane length and current route index of each vehicle are monitored; when the route index is equal to the vehicle route length, the vehicle boundary transmission condition is triggered to transmit the vehicle information to the next partition, that is, teleport the vehicle to the target partition;
[0055] Use MPI's asynchronous communication mechanism to achieve inter-process communication: Use asynchronous sending and blocking receiving strategies to achieve road network partition communication, transmit vehicle instantaneous speed, lane ID, lane position and vehicle routing, and synchronize and manage data during simulation;
[0056] During the parallel simulation process, the simulation data of different road network sub-divisions are recorded separately. At the end of the simulation, the results are summarized and compared with the centralized simulation results for data analysis.
[0057] The method also includes: analyzing the acceleration ratios of real road network scenarios and synthetic road network scenarios under conditions of different numbers of vehicles to verify the effectiveness of the results of large-scale microscopic traffic parallel simulation.
[0058] Compared with the prior art, the present invention has the following beneficial effects:
[0059] (1) Improve computational efficiency: The present invention uses a community detection algorithm to divide the traffic network into multiple smaller sub-networks, and assigns them to different computing units for parallel computing. Through parallel processing, the simulation calculation time can be effectively shortened, especially when facing large-scale and complex traffic networks, which significantly improves the computational efficiency of the simulation system.
[0060] (2) Optimizing resource utilization: Achieve computational load balancing by using the improved Leiden algorithm in the community detection module to identify the community structure in the traffic network. The present invention can reasonably divide tasks and distribute data according to the actual traffic flow and network topology, thus avoiding the waste of computing resources caused by uneven data distribution in traditional methods and improving the utilization of computing resources.
[0061] (3) Ensure simulation accuracy: The division method based on community detection can ensure a higher correlation between computing units, reduce the dependency and communication overhead between different sub-networks during the calculation process, and thus improve the simulation accuracy and reliability of the results. The data exchange during the simulation process is more efficient, allowing each computing unit to complete the simulation task under the optimal conditions, ensuring the accuracy and consistency of the final results.
[0062] (4) Good scalability: The present invention is suitable for large-scale traffic network simulation and also supports simulation of road networks of different scales. It can cope with highly complex dynamic changes in traffic flow and has good scalability and flexibility. It can support simulation calculations of traffic networks of various scales and types. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 A schematic diagram of a simulation process of the parallel simulation method of the present invention;
[0064] Figure 2A road network diagram of a city in one embodiment;
[0065] Figure 3 A grid map generated by SUMO in one embodiment;
[0066] Figure 4 A diagram showing the community division result using K-Leiden in one embodiment;
[0067] Figure 5 A comparison diagram of the results of different road network division methods in an embodiment;
[0068] Figure 6 A diagram showing a parallel simulation speedup ratio in one embodiment;
[0069] Figure 7 This is a diagram for analyzing the results of parallel simulation and centralized simulation in one embodiment. DETAILED DESCRIPTION
[0070] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0071] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0072] This embodiment provides a large-scale microscopic traffic parallel simulation (LSMTS) method based on community detection (CD), such as Figure 1As shown in the figure, the Leiden method is used to partition the traffic network, and the vehicle routing information and road information are used as the constitutive factors of the node weight, so as to optimize the network partitioning process. Since the microscopic traffic simulation relies on the accurate information of the front and rear vehicles to infer the running status of the vehicle, the partitioning of the network may cause the interruption of the vehicle information flow, thereby affecting the simulation accuracy. To solve this problem, the present invention combines a boundary transmission mechanism to ensure that the vehicle information across the partition can be effectively transmitted, thereby ensuring the simulation accuracy. The present invention also proposes an improved Leiden method, namely the K-Leiden method, which is used to control the number of partitioned areas of the Leiden method to meet specific parallel computing requirements. Through the K-Leiden method, the number of sub-areas of the network partition can be accurately adjusted to further improve the computing efficiency and load balancing. The present invention experimentally verifies traffic networks of different scales and densities, and compares the proposed parallel simulation framework with the existing methods. The results show that the present invention significantly reduces the execution time of the simulation task while ensuring high load balancing and minimizing communication overhead, thereby showing significant advantages in the simulation of large-scale traffic networks.
[0073] Specifically, the method comprises the following steps:
[0074] S1, obtaining existing road network data and routing data, wherein the road network data includes lane information, intersection information and traffic light information; the routing data includes vehicle type, starting point, departure time and passing road information, etc.
[0075] S2, constructing a first road network topology graph according to the road network data, performing connectivity detection on the first road network topology graph, removing disconnected components therein, and retaining the largest subgraph (SubGraph) as the second road network topology graph to ensure the connectivity of the experimental road network.
[0076] For the first network topology G1 = (V, E), where V is the node set and E is the edge set, the connected component algorithm is used to identify all connected subgraphs C i , where i = 1, 2, ..., N, N is the number of connected subgraphs;
[0077] Maximum connected component C max Determined by the following formula:
[0078]
[0079] Where |V(C i )| represents the connected subgraph C i The number of nodes in ;
[0080] Select the connected subgraph C with the largest number of nodes max As the second road network topology diagram G2.
[0081] S3, according to the routing data, combined with the second road network topology map, calculate the number of vehicles passing through each lane, and divide it by the lane length to obtain the lane flow as the lane weight, perform nonlinear amplification on the lane weight and assign it to the corresponding edge to obtain the third road network topology map.
[0082] Based on the existing vehicle routing information and the attribute information of the road network G2, the weights of the edges of the road network topology graph are calculated by considering the traffic flow, length, capacity and connection relationship of the road section:
[0083] S31, count the number of vehicles passing each edge, for each edge e in the road network i , count the number of times it is passed by vehicles c(e i ):
[0084]
[0085] Among them, the edge represents the lane; R is the path set of all vehicles; δ(e i ,r) is the indicator function, when edge e i When it appears in path r, δ(e i ,r)=1, otherwise δ(e i ,r)=0;
[0086] S32, calculate the initial weight, and calculate the initial weight w0(e i ):
[0087]
[0088] Among them, l(e i ) is the edge e i Length, i.e. lane length;
[0089] S33, nonlinearly amplify the initial weight to increase the influence of the edge with high traffic flow, and obtain the final weight w(e i ):
[0090] w(e i )=[w0(e i )] α
[0091] Among them, α is the amplification factor;
[0092] S34, the calculated final weight w(e i ) are assigned to the corresponding edges to obtain a weighted third road network topology graph G3=(V,E,w), where V is the node set; E is the edge set; and w is the edge weight set.
[0093] S4, based on the third road network topology map, the community division is realized by using Leiden community detection to obtain the preliminary community division results.
[0094] Step S4 includes the following steps:
[0095] S41, initializing node community allocation, allocating each node in the network, that is, the road network intersection, to a separate community to form an initial community network.
[0096] S42, perform local mobility optimization. For each node, try to move it from its community to other communities, calculate the change ΔQ in the quality function of the community after the move, and if ΔQ>0, assign the node to the community that can obtain the maximum modularity gain ΔQ; otherwise, the node remains in the current community.
[0097] In this embodiment, the quality function is represented by modularity (Q), and the range of modularity Q is from -1 to 1. The higher the value, the more obvious the community structure. The calculation method is:
[0098]
[0099] Among them, A ij is the adjacency matrix of the network, k i and k j is the degree of nodes i and j, m is the number of edges in the network, c i and c j is the community to which nodes i and j belong, δ(c i ,c j ) is the Dirac delta function, when c i =c j When γ > 1, more, smaller and tightly connected communities will be formed; when 0 < γ < 1, fewer, larger but relatively less tightly connected communities will be formed;
[0100] The change in the quality function ΔQ is calculated as:
[0101]
[0102] Where m is the sum of all edge weights in the graph, ω i is the sum of the edge weights connecting node i, ∑ tot ω i is the sum of the weights of all nodes in the target community, is the sum of the edge weights between node i and the nodes in the target community.
[0103] S43, after all nodes have finished moving, Leiden's algorithm performs community refinement to ensure that all communities have good connectivity. It is worth noting that the refinement phase does not follow a greedy strategy, but merges nodes with randomly selected communities to increase the quality function. This randomness allows for a wider range of discovery of the partition space.
[0104] S44, performing aggregation based on the refinement in step S43, using the unrefined partitions to create an initial partition of the aggregated network, wherein each community is refined into multiple sub-partitions and aggregated into independent nodes respectively.
[0105] S45, on the network aggregated in step S44, continue to move a single node in the aggregated network to refine the network, while keeping the partition unchanged;
[0106] S46, repeat the above steps S42-S45 until the modularity is not further improved, the Leiden algorithm reaches convergence or meets the stopping condition, and then outputs the preliminary community division result, where each community represents a road network subgraph or module, which can be used for subsequent traffic simulation and parallel computing.
[0107] S5, based on the preliminary community division results, use K-Leiden community detection to merge communities, adjust the number of partitions, and obtain the final community division results.
[0108] Step S5 includes the following steps:
[0109] S51, obtaining the preliminary community division result C obtained in step S4 init , which contains the community identifier (i.e., community ID) and the nodes included in the corresponding community, and its neighbor set v adjacency , v adjacency Contains the community nodes and the node's neighbor list.
[0110] S52, obtain the minimum community c from the community division result smallest and its adjacent smallest community c adjacent Two communities, merge the nodes of the two communities to form a new community c′, update the community division result, and get C′ init , delete community c smallest and c adjacent , add the newly merged community c′, where the community merging process formula is defined as follows:
[0111] Assume that community c smallest and c adjacent The nodes are:
[0112] c smallest ={n1,n2,...,np},c adjacent ={n p+1 ,n p+2 ,...,n q}
[0113] The merged community c′ is:
[0114] c′=c smallest ∪c adjacent ={n1,n2,...,n q}
[0115] Where p is the community c smallest The number of nodes in community c, qp is adjacent , and q is the number of nodes in the merged community c′.
[0116] Specifically, in this embodiment, the smallest community and adjacent communities are found according to the community size, and the size of each community, that is, the number of nodes in the community, is obtained. The communities are sorted according to the community size, arranged from small to large, and the smallest community is found. All neighbor nodes of the smallest community are found, and the communities to which they belong are found from these neighbors. If the number of communities of these neighbors is not zero, the neighbor community with the smallest size is selected. If the smallest community and the smallest adjacent community are found, they are merged.
[0117] Assumption C init ={c1:{n1,n2},c2:{n3,n4},...,c k :{n 2k-1 ,n 2k The size of each community is determined by the number of nodes within the community. Sort the communities by size to get the smallest community c smallest , sort the adjacent communities by size and get the smallest neighbor community c adjacent :
[0118]
[0119] S53, loop through step S52 to merge until the number of merged communities reaches the target number k, and output the final community division result C k .
[0120] S6, based on the final community division results, parallel simulation computing tasks are allocated to perform large-scale microscopic traffic simulation.
[0121] Through the TraCI interface, it interacts with the micro-traffic simulation system SUMO to automatically generate micro-traffic simulation SUMO configuration parameters for different road network sub-partitions, where the road network sub-partitions are determined based on the final community division results.
[0122] During the cyclic simulation process, the current road, coordinate position, instantaneous speed, lane number, lane ID, lane position, lane length and current route index of each vehicle are monitored; when the route index is equal to the vehicle route length, the vehicle boundary transmission condition is triggered and the vehicle information is transmitted to the next partition, that is, the vehicle is teleported to the target partition.
[0123] In order to ensure the synchronous simulation status of each partition information, the asynchronous communication mechanism of MPI (Message Passing Interface) is used to realize inter-process communication. Specifically, the asynchronous sending and blocking receiving strategies are adopted to realize road network partition communication, transmit vehicle instantaneous speed, lane ID, lane position and vehicle routing, and synchronize and manage the data in the simulation process.
[0124] During the parallel simulation process, the simulation data of different road network sub-divisions are recorded separately. At the end of the simulation, the results are summarized and compared with the centralized simulation results for data analysis.
[0125] S7, analyzes the acceleration ratio of real road network scenarios and synthetic road network scenarios under different vehicle numbers to verify the effectiveness of the results of large-scale microscopic traffic parallel simulation.
[0126] This paper verifies the distributed traffic parallel simulation method based on the actual scenario of a city. Figure 2 It is a schematic diagram of the verification road network.
[0127] This verification selects the random routes generated by SUMO based on a city's road network, and sets 550, 3600, 7200, 14400 and 28800 vehicles for the experiment. In this verification, 550 vehicles are selected, and the interval between each vehicle is 0.5 seconds. First, the city's road network is simulated based on a single-node centralized simulation. At the same time, a distributed simulation of a city's road network is performed based on the MPI framework. Figure 3 The grid map generated by SUMO is shown, with 40 grids in both the vertical and horizontal directions. The horizontal road is 400 meters long and the vertical road is 300 meters long, both set to 3 lanes. Figure 4 This is the community division result diagram of the road network, with 6 partitions. Figure 5 The comparison chart of the results of different road network division methods shows that the K-Leiden division result adopted by the present invention is more precise and accurate. As a verification indicator, it can be calculated according to the following formula.
[0128]
[0129] where t n is the time consumed by parallel simulation of n partitions, and T is the time consumed by centralized simulation of a single node.
[0130] The empirical verification results are as follows Figure 6 As shown, it can be seen from the empirical verification results that the distributed parallel simulation acceleration effect of the present invention in the embodiment is more obvious. When the number of partitions n=2, the acceleration ratio S2≈1.78; when n=4, the acceleration ratio S4≈3.04; when n=6, the acceleration ratio S6≈3.54; when n=8, the acceleration ratio S8≈4.64; when n=10, the acceleration ratio S10≈4.70; when n=12, the acceleration ratio S12≈6.02; when n=14, the acceleration ratio S12≈6.24; when n=16, the acceleration ratio S12≈7.14; and when the number of partitions n=18 and n=20, the acceleration ratios reach S18≈8.79 and S20≈9.03 respectively. It is worth noting that with the increase in the number of partitions, the acceleration ratio shows a gradual upward trend and tends to be stable when the number of partitions is large. However, in practical applications, if the number of partitions is too large, it may lead to an increase in the boundary transmission communication overhead, which will have a certain impact on the acceleration effect. Furthermore, this validation considers a comparative study of the travel time accumulation curves, which show the probability cumulative distribution curves of vehicle travel times for the original SUMO simulation and the simulation using the parallel framework. Figure 7 The cumulative travel time curve of 7,200 vehicles on the grid map is shown.
[0131] The following are the partitioning results of N-cut, Spectral Partitioning (SP) and K-Leiden algorithms on a city road network, which are used to compare the three algorithms, as shown in Table 1.
[0132] Table 1 Comparison of road network division methods
[0133]
[0134] All communities of the K-Leiden algorithm are fully connected, showing its tendency to generate densely connected subgraphs. Some communities in N-cut and SP (such as Community1 and Community5) have connectivity issues.
[0135] The node distribution of K-Leiden is relatively balanced, for example, the number of nodes in Community0 to Community5 is between 118 and 216. N-cut and SP have large differences in the number of community nodes (for example, SP's Community2 has 305 nodes, while Community4 has only 53).
[0136] N-cut focuses more on optimizing the cutting cost, so the connectivity may be poor. SP emphasizes the mathematical simplicity of segmentation and usually leads to larger communities. K-Leiden is an algorithm based on modularity optimization, which usually generates balanced and well-connected communities.
[0137] This paper relates to a large-scale microscopic traffic parallel simulation method based on community detection, which can effectively improve the computational efficiency and accuracy of traffic simulation and has broad application prospects. Future research will further optimize the performance and flexibility of the framework to cope with more complex traffic networks and diversified traffic management needs.
[0138] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning, or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A large-scale microscopic traffic parallel simulation method based on community detection, characterized in that: The following steps are involved: S1, obtaining existing road network data and routing data; S2, constructing a first road network topology graph according to the road network data, performing connectivity detection on the first road network topology graph, removing disconnected components therein, and retaining the largest subgraph as a second road network topology graph; S3, according to the routing data, combined with the second road network topology, the number of vehicles passing through each lane is calculated, and the number of vehicles passing through each lane is divided by the lane length to obtain the lane flow rate as the lane weight, and the lane weight is nonlinearly amplified and assigned to the corresponding edge to obtain the third road network topology; S4, based on the third road network topology, using Leiden community detection to achieve community division, and obtain preliminary community division results; S5, based on the preliminary community division results, use K-Leiden community detection to merge communities, adjust the number of partitions, and obtain the final community division results; S6, based on the final community division results, parallel simulation computing tasks are allocated to perform large-scale microscopic traffic simulation.
2. According to the large-scale microscopic traffic parallel simulation method based on community detection in claim 1, it is characterized in that: The road network data includes lane information, intersection information and traffic light information.
3. According to the large-scale microscopic traffic parallel simulation method based on community detection in claim 1, it is characterized in that: The routing data includes vehicle type, starting point, departure time and route information.
4. The large-scale microscopic traffic parallel simulation method based on community detection according to claim 1 is characterized in that: The step S2 is specifically as follows: For the first network topology G1 = (V, E), where V is the node set and E is the edge set, the connected component algorithm is used to identify all connected subgraphs C i , where i = 1, 2, ..., N, N is the number of connected subgraphs; Maximum connected component C max Determined by the following formula: Where |V(C i )| represents the connected subgraph C i The number of nodes in ; Select the connected subgraph C with the largest number of nodes max As the second road network topology diagram G2.
5. The large-scale microscopic traffic parallel simulation method based on community detection according to claim 1 is characterized in that: The step S3 specifically comprises: combining the existing vehicle routing information with the attribute information of the road network G2, taking into account the traffic flow, length, traffic capacity and connection relationship of the road section, and calculating the weight of the edge of the road network topology graph: S31, count the number of vehicles passing each edge, for each edge e in the road network i , count the number of times it is passed by vehicles c(e i ): Among them, the edge represents the lane; R is the path set of all vehicles; δ(e i ,r) is the indicator function, when edge e i When it appears in path r, δ(e i ,r)=1, otherwise δ(e i ,r)=0; S32, calculate the initial weight, and calculate the initial weight w0(e i ): Among them, l(e i ) is the edge e i Length, i.e. lane length; S33, nonlinearly amplify the initial weight to obtain the final weight w(e i ): we(e i )=[w0(e i )] α Among them, α is the amplification factor; S34, the calculated final weight w(e i ) are assigned to the corresponding edges to obtain a weighted third road network topology graph G3=(V,E,w), where V is the node set; E is the edge set; and w is the edge weight set.
6. The large-scale microscopic traffic parallel simulation method based on community detection according to claim 1 is characterized in that: The step S4 comprises the following steps: S41, initializing node community allocation, allocating each node in the network, i.e., the road network intersection, to a separate community to form an initial community network; S42, perform local mobility optimization. For each node, try to move it from its community to other communities, calculate the change ΔQ of the quality function of the community after the move, and if ΔQ>0, assign the node to the community that can obtain the maximum modularity gain ΔQ; otherwise, the node remains in the current community; the quality function is represented by modularity Q, which ranges from -1 to 1. The higher the value, the more obvious the community structure. The calculation method is: Among them, A ij is the adjacency matrix of the network, k i and k j is the degree of nodes i and j, m is the number of edges in the network, c i and c j is the community to which nodes i and j belong, δ(c i ,c j ) is the Dirac delta function, when c i =c j It is equal to 1 when , otherwise it is 0; γ is the resolution parameter that adjusts the density of connections within and between communities; S43, after all nodes have completed the movement, Leiden algorithm performs community refinement to ensure that all communities have good connectivity. In the refinement stage, nodes are merged with randomly selected communities to increase the quality function; S44, performing aggregation based on the refinement in step S43, using the unrefined partitions to create an initial partition of the aggregated network, wherein each community is refined into multiple sub-partitions and aggregated into independent nodes respectively; S45, on the network aggregated in step S44, continue to move a single node in the aggregated network to refine the network, while keeping the partition unchanged; S46, repeat the above steps S42-S45 until the modularity does not improve further, the Leiden algorithm reaches convergence or meets the stop condition, and then outputs the preliminary community division result C init , where each community represents a road network subgraph or module.
7. A large-scale microscopic traffic parallel simulation method based on community detection according to claim 6, characterized in that: The change ΔQ of the mass function is calculated as follows: Where m is the sum of all edge weights in the graph, ω i is the sum of the edge weights connecting node i, ∑ tot ω i is the sum of the weights of all nodes in the target community, is the sum of the edge weights between node i and the nodes in the target community.
8. The large-scale microscopic traffic parallel simulation method based on community detection according to claim 1 is characterized in that: The step S5 comprises the following steps: S51, obtaining the preliminary community division result C obtained in step S4 init , which contains the community identifier and the nodes contained in the corresponding community, and its neighbor set v adjacency , v adjacency Contains the community nodes and the node's neighbor list; S52, obtain the minimum community c from the community division result smallest and its adjacent smallest community c adjacent Two communities, merge the nodes of the two communities to form a new community c′, update the community division result, and get C′ init , delete community c smallest and c adjacent , add the newly merged community c′, where the community merging process formula is defined as follows: Assume that community c smallest and c adjacent The nodes are: c smallest ={n1,n2,...,n p },c adjacent ={n p+1 ,n p+2 ,...,n q } The merged community c′ is: c′=c smallest ∪c adjacent ={n1,n2,...,n q } Where p is the community c smallest The number of nodes in community c, qp is adjacent , q is the number of nodes in the merged community c′; S53, loop through step S52 to merge until the number of merged communities reaches the target number k, and output the final community division result C k .
9. The large-scale microscopic traffic parallel simulation method based on community detection according to claim 1 is characterized in that: The step S6 specifically includes: interacting with the micro traffic simulation system through the TraCI interface to automatically generate micro traffic simulation configuration parameters for different road network sub-partitions, wherein the road network sub-partitions are determined based on the final community division result; During the loop simulation process, the current road, coordinate position, instantaneous speed, lane number, lane ID, lane position, lane length and current route index of each vehicle are monitored; when the route index is equal to the vehicle route length, the vehicle boundary transmission condition is triggered to transmit the vehicle information to the next partition, that is, teleport the vehicle to the target partition; Use MPI's asynchronous communication mechanism to achieve inter-process communication: Use asynchronous sending and blocking receiving strategies to achieve road network partition communication, transmit vehicle instantaneous speed, lane ID, lane position and vehicle routing, and synchronize and manage data during simulation; During the parallel simulation process, the simulation data of different road network sub-divisions are recorded separately. At the end of the simulation, the results are summarized and compared with the centralized simulation results for data analysis.
10. The large-scale microscopic traffic parallel simulation method based on community detection according to claim 1 is characterized in that: The method also includes: analyzing the acceleration ratios of real road network scenarios and synthetic road network scenarios under conditions of different numbers of vehicles to verify the effectiveness of the results of large-scale microscopic traffic parallel simulation.
Citation Information
Cited By
A dynamic partition-based distributed parallel traffic simulation method
CN121351434B