A method for obtaining K shortest paths in a city considering real-time traffic conditions
By introducing the concept of multi-layer labels and the method of real-time traffic updates, the K-shortest path algorithm is optimized, which solves the problems of low computational efficiency and paths that are not close to reality in the existing technology, and realizes efficient and accurate navigation path search.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HEFEI UNIV OF TECH
- Filing Date
- 2023-11-24
- Publication Date
- 2026-05-05
AI Technical Summary
Existing K-shortest path planning algorithms are computationally inefficient in large-scale networks and fail to effectively utilize real-time traffic information, resulting in wasted computing resources and navigation results that do not closely reflect actual traffic conditions.
By adopting a multi-layered labeling concept, multiple paths and their travel times are recorded for each intersection node. Through hierarchical calculation and real-time traffic updates, the search process for the K shortest paths is optimized, reducing redundant calculations and resource waste.
It improves computational efficiency and search speed, enabling it to better adapt to large-scale time-varying road networks, provide more realistic navigation route suggestions, and enhance the response speed and service quality of navigation software.
Smart Images

Figure CN117523890B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of navigation optimization of urban road networks, specifically a method for obtaining K shortest paths in a city that takes into account real-time traffic conditions. Background Technology
[0002] With the development of society and economy, the number of users of Internet-based traffic navigation is constantly increasing. More and more travelers hope to choose the optimal route according to their needs so that they can avoid congestion as much as possible and reach their destination smoothly and conveniently. However, urban traffic conditions are becoming increasingly complex, so the requirements for route navigation algorithms are also getting higher and higher.
[0003] Providing K shortest path options while ensuring solution efficiency and optimal path quality is one of the practical needs of navigation users today. However, existing K-shortest path planning algorithms have the following shortcomings: First, they involve multiple calls to the shortest path algorithm or updating the entire network to calculate the deviation path set, resulting in a large amount of repetitive computation and failing to make good use of the results of previous calculations. This leads to low computational efficiency in large-scale networks, wasting computational resources and making them unsuitable for real-time navigation, thus reducing the operational efficiency of urban traffic. Second, they rarely establish a clear connection with future real-time traffic conditions, causing the navigation results to be inconsistent with the actual situation. Summary of the Invention
[0004] The present invention addresses the shortcomings of the existing technology by proposing a method for obtaining K shortest urban paths that takes into account real-time traffic conditions. This method aims to improve computational efficiency while obtaining K optimal travel paths that better reflect actual traffic conditions, thereby ensuring the stable and efficient operation of social transportation.
[0005] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:
[0006] The present invention provides a method for obtaining K shortest paths in a city that takes into account real-time traffic conditions. The method is characterized by the following steps:
[0007] Step 1: Construct the urban road network;
[0008] Obtain real-time road network data and obtain the urban road network G = (V, A, W), where V represents the set of intersection nodes, and V = {v1, v2, v3, ..., v...}. i , ..., v N}, v i Let represent the i-th intersection node, i = 1, 2, 3, ..., N, where N is the total number of intersection nodes in the urban road network G, and A represents the set of road segments between intersection nodes, and A = {(v i v j )|i, j=1, 2, 3,...,N}, (vi v j ) represents the i-th intersection node v i To the j-th intersection node v j The directed road segments between intersection nodes, where W represents the set of travel time weights for road segments between intersection nodes, W = {w(v i v j )|i,j=1,2,3,…,N},w(v i v j ) is a directed road segment (v i v j The driving time weight of ) is determined by the i-th intersection node v. i To the j-th intersection node v j There are directed road segments (v) i v j If the k-th intersection node v is... j Let v be the i-th intersection node. i The subsequent intersection node is denoted as The i-th intersection node v i For the j-th intersection node v j The preceding intersection node is denoted as... And ω ij >0, if the i-th intersection node v i To the j-th intersection node v j There is no directed road segment (v) between them. i v j If w, then let w ij =+∞; Let pred(v i ) represents the i-th intersection node v i Let succ(v) be the set of preceding intersection nodes. i ) represents the i-th intersection node v i The set of successor intersection nodes;
[0009] Step 2: Define parameters and initialize;
[0010] Set the starting intersection node to v. start The endpoint intersection node is v end And v start v end ∈V; Let K represent the intersection node v from the starting point. start To the endpoint intersection node v end The number of shortest paths; let l(v) i ) indicates the intersection node v from the starting point. start To the i-th intersection node v i The number of feasible paths, and l(v i )≤K;
[0011] Step 2.1: Define the relevant attributes of the feasible path;
[0012] Let g l (v i ) indicates the intersection v from the starting point start To the i-th intersection node v i The travel time of the l-th feasible path, where l ≤ l(v i );
[0013] Let rhs l (v i ) indicates the intersection v from the starting point start After a length of A feasible path to the i-th intersection node v i Forward intersection node Then, from the preceding intersection node To the i-th intersection node v i The total driving time, of which, Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the a-th feasible route, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and When v i The starting intersection node, i.e., v i =v start At that time, let rhs l (v i ) = 0;
[0014] Let key l (v i ) represents the minimum time value, and key l (v i )=min(g l (v i ), rhs l (v i )); where g l (v i ) indicates the intersection v from the starting point start To the i-th intersection node v i The travel time of the lth feasible route;
[0015] Let r l (v i ) indicates the intersection v from the starting point start To the i-th intersection node v i The l-th feasible path includes the path from the starting intersection vstart To the i-th intersection node v i Forward intersection node The relevant attributes of the a-th feasible path;
[0016] Let D(v) i ) indicates the intersection node v from the starting point. start To the i-th intersection node v i The set of attribute labels for all feasible paths, and D(v i The number of attribute tags in ) is l(v i ), and l(v i )≤K;
[0017] Let D(v) i Any l-th attribute tag D in ) l (v i ) indicates the intersection node v from the starting point. start To the i-th intersection node v i The set of relevant attributes for the l-th feasible path, and D l (v i )=(g l (v i ), rhs l (v i ), key l (v i ), r l (v i )), l = 1, 2, ..., l(v i );
[0018] Define D′(v) i Let ) be any i-th intersection node v i All attribute tags by key l (v i The set after ascending order;
[0019] Let D′(v) i Any k-th attribute tag D′ in ) k (v i ) indicates the intersection node v from the starting point. start To the i-th intersection node v i The relevant attributes of the k-th shortest path, namely D′ k (v i )=(g k (v i ), rhs k (v i ), key k (v i ), r k (vi k = 1, 2, ..., l(v) i ); where g k (v i ) indicates the intersection v from the starting point start To the i-th intersection node v i The travel time of the k-th shortest path;
[0020] rhs k (v i ) indicates the intersection v from the starting point start After a length of The path reaches the i-th intersection node v i Forward intersection node Then, from the preceding intersection node To the i-th intersection node v i Total driving time Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the shortest route b, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and When v i The starting intersection node, i.e., v i =v start At that time, let rhs k (v i ) = 0;
[0021] key k (v i ) represents the minimum time value, and key k (v i )=min(g k (v i ), rhs k (v i )); where g k (v i ) indicates the intersection v from the starting point start To the i-th intersection node v i The travel time of the k-th shortest path;
[0022] r k (v i ) indicates the intersection v from the starting point start To the i-th intersection node v i The k-th shortest path includes the path from the starting intersection v. start To the i-th intersection node v i Forward intersection node The relevant properties of the b-th shortest path;
[0023] definition Let K be the set of tags to be searched for the k-th shortest path;
[0024] Define t0 as a unit time step;
[0025] Step 2.2: Initialize the relevant attributes of feasible paths;
[0026] Initialize the starting intersection node v start The set of tags D(v) start All tags in ) are For any other i-th intersection node v i The set of tags D(v) i All tags in ) are initialized to
[0027] The starting intersection node v start ordered label D′1(v start Add the tags to be searched for the k-th shortest path.
[0028] Define and initialize the timer to t. start ;
[0029] Step 3: Calculate the k shortest paths within a unit time step in layers;
[0030] Step 3.1: Calculate the k-th shortest path; initialize k = 1;
[0031] Step 3.1.1: Collect the tags to be searched The intersection node corresponding to the label with the smallest time minimum value is denoted as v. t Let D′ k (v t ) represents the starting intersection node v start To the intersection node v t The relevant attributes of the k-th shortest path, i.e., v t The corresponding attribute tag is D′ k (v t )=(g k (v t ), rhs k (v t ), key k (v t ), r k (v t k = 1, 2, ..., l(v) t ), where g k (v t) indicates the intersection v from the starting point start To the intersection node v t The travel time of the k-th shortest path;
[0032] rhs k (v t ) indicates the intersection v from the starting point start After a length of The path to the intersection node v t Forward intersection node Then, from the preceding intersection node To the intersection node v t Total driving time Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the shortest path c, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and When v t The starting intersection node, i.e., v t =v start At that time, let rhs k (v t ) = 0;
[0033] key k (v t ) represents the minimum time value, and key k (v t )=min(g k (v t ), rhs k (v t )); where g k (v t ) indicates the intersection v from the starting point start To the intersection node v t The travel time of the k-th shortest path;
[0034] r k (v t ) indicates the intersection v from the starting point start To the intersection node v t The k-th shortest path includes the path from the starting intersection v. start To the intersection node v t Forward intersection node The relevant attributes of the c-th shortest path;
[0035] l(v t ) indicates the intersection node v from the starting point. startTo the intersection node v t The number of feasible paths, and l(v t )≤K;
[0036] If key k (v t ) < key k (v end ) or rhs k (v end )≠g k (v end If the condition is met, proceed to step 3.1.2; otherwise, proceed to step 3.2.
[0037] Step 3.1.2: If g k (v t )>rhs k (v t If the condition is met, proceed to step 3.1.2a; otherwise, proceed to step 3.1.3.
[0038] Step 3.1.2a: Let g k (v t )=ths k (v t ), label D′ k (v t Remove Traverse the intersection node v t The set of successor intersection nodes succ(v t The intersection nodes in the () are such that for any intersection node and Not belonging to the intersection node v from the starting point start To the intersection node v t In the k-th shortest path:
[0039] make Indicates the starting intersection node v start To the intersection node The relevant attributes of the k-th shortest path, i.e., intersection nodes. The corresponding attribute tags are in, Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path;
[0040] Indicates the intersection v from the starting point start After a length of The path to the intersection node Forward intersection node Then, from the preceding intersection node To the intersection node Total driving time Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the m-th shortest path, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and
[0041] This represents the minimum time value, and in, Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path;
[0042] Indicates the intersection v from the starting point start To the intersection node The k-th shortest path includes the path from the starting intersection v. start To the intersection node Forward intersection node The set of attributes related to the m-th shortest path;
[0043] Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and
[0044] If it exists Then for k∈[k,K-1], starting from k=K-1, traverse in descending order. If If the result is negative, proceed to step 3.1.2b; otherwise, proceed to step 3.1.2c.
[0045] If it exists Then traverse the intersection nodes. The remaining Given a set of ordered labels, if the x-th label exists... satisfy and Then stop the traversal. For k∈[x, K-1], start the traversal in descending order from k=K-1. If the condition is met, proceed to step 3.1.2d; otherwise, proceed to step 3.1.2e.
[0046] Step 3.1.2b: Let And update the minimum time value label Add the set of tags to be searched for the (k+1)th shortest path In the meantime, we await further steps to continue the search and update, and proceed to step 3.1.2c;
[0047] Step 3.1.2c: Update the preceding label, i.e., let Again Proceed to step 4.1; where, Indicates a directed road segment Driving time weighting;
[0048] Step 3.1.2d: Let And update the minimum time value label Add the set of tags to be searched for the (k+1)th shortest path In the meantime, we await further steps to continue the search and update, and proceed to step 3.1.2e;
[0049] Step 3.1.2e: Let And update the minimum time value label Add the tags to be searched for the x-th shortest path In the meantime, we await further steps to continue the search and update, and proceed to step 4.1;
[0050] Step 3.1.3: Let g k (v t ) = ∞;
[0051] Step 3.1.4: Traverse the intersection node v t and its subsequent set of intersection nodes succ(v t The intersection nodes in the () are such that for any intersection node and Not belonging to the intersection node v from the starting point start To the intersection node v t In the k-th shortest path:
[0052] Record the intersection node Precursor intersection node set Any intersection node in the array is
[0053] make Indicates the starting intersection node v start To the intersection node The relevant attributes of the k-th shortest path, i.e., intersection nodes. The corresponding attribute tags are in, Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path;
[0054] Indicates the intersection v from the starting point start After a length of The path to the intersection node Forward intersection node Then, from the preceding intersection node To the intersection node Total driving time Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the shortest route f, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and
[0055] This represents the minimum time value, and in, Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path;
[0056] Indicates the intersection v from the starting point start To the intersection node The k-th shortest path includes the path from the starting intersection v. start To the intersection node Forward intersection node The set of attributes related to the f-th shortest path;
[0057] Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and
[0058] like Not the starting point intersection node v start and If the condition is met, proceed to step 3.1.5; otherwise, return to step 3.1.4 to continue the traversal.
[0059] Step 3.1.5: Traverse the intersection nodes All front-drive intersection nodes The record makes The smallest intersection node is in, Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path, Indicates a directed road segment Driving time weighting;
[0060] make Indicates the starting intersection node v start To the intersection node The relevant attributes of the k-th shortest path, i.e., intersection nodes. The corresponding attribute tag is D k ′(v p * )=(g k (v p * ), rhs k (v p * ), key(v p * ), r k (v p * k = 1, 2, ..., l(v) p * ),in, Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path;
[0061] Indicates the intersection v from the starting point start After a length of The path to the intersection node Forward intersection node Then, from the preceding intersection node To the intersection node Total driving time Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the shortest route e, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and
[0062] This represents the minimum time value, and in, Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path;
[0063] Indicates the intersection v from the starting point start To the intersection node The k-th shortest path includes the path from the starting intersection v. start To the intersection node Forward intersection node The set of attributes related to the e-th shortest path;
[0064] Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and
[0065] make Proceed to step 4.2, where, Indicates a directed road segment Driving time weighting;
[0066] Step 3.2: Calculate the (k+1)th shortest path;
[0067] Assign the k+1 values to k. If k > K, proceed to step 6; otherwise, return to step 3.1.
[0068] Step 4: Update the set of tags to be searched for the k-th shortest path.
[0069] Step 4.1: Update the intersection node tags and ordered labels
[0070] Step 4.1.1: If the intersection node tag value and Minimum update time Proceed to step 4.1.2; otherwise, proceed to step 4.1.3.
[0071] Step 4.1.2: Set the current intersection node Remove set succ(v) t If at this time the set succ(v) t If the value is not empty, proceed to step 3.1.2 to continue the iteration; otherwise, proceed to step 3.1.1.
[0072] Step 4.1.3: If and Minimum update time Then the intersection node tags join in Proceed to step 4.1.2;
[0073] like and Then the label Remove Proceed to step 4.1.2;
[0074] Step 4.2: Update the intersection node tag collection and ordered label set
[0075] Step 4.2.1: If the intersection node tag value and Minimum update time Proceed to step 4.2.2; otherwise, proceed to step 4.2.3.
[0076] Step 4.2.2: Set the current intersection node Remove set succ(v) t )∪{v t If at this time the set succ(v) t )∪{v t If the value is not empty, proceed to step 3.1.4 to continue the iteration; otherwise, proceed to step 3.1.1.
[0077] Step 4.2.3: If and Then the intersection node tags join in Proceed to step 4.2.2;
[0078] like and Then the label Remove Proceed to step 4.2.2;
[0079] Step 4.3: Update the intersection node v j The set of tags D k (v j and ordered label set D k ′(v j );
[0080] Step 4.3.1: If the intersection node v j The tag value g k (v j )≠rhs k (v j )and Then the minimum update time for key k (v jIf the condition is met, proceed to step 4.3.2; otherwise, proceed to step 4.3.3.
[0081] Step 4.3.2: Set the current road segment (v) i v j Remove set W ch If set W at this time ch If not empty, proceed to step 5.3 to continue iterating through the next road segment with changing travel time weights; otherwise, proceed to step 3.1.1.
[0082] Step 4.3.3 If g k (v j )≠rhs k (v j )and Then the intersection node v j The tag D k ′(v j )join in Proceed to step 4.3.2;
[0083] If g k (v j )=rhs k (v j )and Then label D k ′(v j Remove Proceed to step 4.3.2;
[0084] Step 5: Detect real-time traffic conditions and update the K shortest paths;
[0085] Step 5.1: Determine the timer t start Has t0 been reached? If so, clear the timer t. start If the condition is met, proceed to step 5.2; otherwise, continue timing.
[0086] Step 5.2: Check if the road network travel time weights have changed. If they have not changed, return to step 5.1; otherwise, denote the updated set of travel time weights for road segments between intersection nodes as W. new ={w new (v i v j If |i,j = 1, 2, 3, ..., N}, proceed to step 5.3;
[0087] Step 5.3: Let W be the set of all road segments where the travel time weight changes. ch For road segment (v) i v j )∈W ch Let D′ k (v j) represents the starting intersection node v start To the intersection node v j The relevant attributes of the k-th shortest path, i.e., v j The corresponding attribute tag is D′ k (v j )=(g k (v j ), rhs k (v j ), key k (v j ), r k (v j k = 1, 2, ..., l(v) j ), where g k (v j ) indicates the intersection v from the starting point start To the intersection node v j The travel time of the k-th shortest path;
[0088] rhs k (v j ) indicates the intersection v from the starting point start After a length of The path to the intersection node v j Forward intersection node Then, from the preceding intersection node To the intersection node v j Total driving time Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the nth shortest path, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and When v j The starting intersection node, i.e., v j =v start At that time, let rhs k (v j ) = 0;
[0089] key k (v j ) represents the minimum time value, and key k (v j )=min(g k (v j )rhs k (v j )); where g k (v j) indicates the intersection v from the starting point start To the intersection node v j The travel time of the k-th shortest path;
[0090] r k (v j ) indicates the intersection v from the starting point start To the intersection node v j The k-th shortest path includes the path from the starting intersection v. start To the intersection node v j Forward intersection node The relevant attributes of the nth shortest path;
[0091] l(v j ) indicates the intersection node v from the starting point. start To the intersection node v j The number of feasible paths, and l(v j )≤K;
[0092] If w(v) is satisfied i v j )>w new (v i v j If the condition is met, proceed to step 5.3.1; otherwise, proceed to step 5.3.2.
[0093] Step 5.3.1: If rhs k (v j )>g k (vi)+w new (v i v j Let r k (v j ) = D k ′(v i ), then let rhs k (v j ) = g k (v i )+w new (v i v j If the condition is met, proceed to step 4.3; otherwise, proceed to step 5.3 to continue iterating through the next road segment with changing travel time weights.
[0094] Step 5.3.2: If v j Not the starting point intersection node v start And r k (v j )=D′ k (v i ), Traverse the intersection node v j All front-drive intersection nodes The record makes The smallest intersection node is in Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path, Indicates a directed road segment The updated driving time weighting makes Proceed to step 5.3, where, Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path, Indicates a directed road segment Updated driving time weighting Indicates the intersection node v from the starting point. start To the intersection node Find the relevant attributes of the k-th shortest path; otherwise, proceed to step 5.3 to continue traversing the next road segment with changing travel time weights.
[0095] Step 6: Output the current time from the starting point intersection node v start To the endpoint intersection node v end Information on the K shortest paths;
[0096] Based on the endpoint intersection node v end The set of labels D′(v end The K labels in the diagram start from the endpoint intersection node v. end The k-th label D′ k (v end )=(q k (v end ), rhs k (v end ), key k (v end ), r k (v end Starting with r, continuously... k (v end Traverse back to the attribute labels corresponding to the preceding intersection nodes until traversing back to the starting intersection node v. start The tag D′ k (v start Thus, a path from v is obtained. start to v end The k-th shortest path, with a travel time of g. k (v end ), and thus obtain the value of v per unit time step. start to v endFind the K shortest paths and their travel times, then proceed to step 5 to continue searching for the K shortest paths after the traffic conditions are updated.
[0097] The present invention provides an electronic device, including a memory and a processor, characterized in that the memory is used to store a program that supports the processor in executing the method for obtaining K shortest paths to a city, and the processor is configured to execute the program stored in the memory.
[0098] The present invention discloses a computer-readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, performs the steps of the method for obtaining K shortest paths to a city.
[0099] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0100] 1. This invention introduces the concept of multi-layer labels in the calculation of K shortest paths between fixed start and end intersection nodes. For each intersection node, multiple different paths from the starting intersection node to that node and their corresponding travel times are recorded. This differs from traditional methods that only record the travel time of a single shortest path for each intersection node, significantly reducing unnecessary traversals and redundant calculations. By more comprehensively recording the results of previous iterations, this invention allows for direct reuse of these results in subsequent iterations, thereby accelerating the search speed for K shortest paths between start and end intersection nodes.
[0101] 2. In this invention, if there is only one optimal path and the road network travel time weight does not change, then the problem degenerates into a standard shortest path problem. Therefore, this invention realizes the effective use of the data obtained in solving the standard shortest path problem, improves the computational efficiency, has good compatibility, and is easy to understand and apply.
[0102] 3. The method proposed in this invention has superior search efficiency when applied to large-scale time-varying road networks. Existing navigation algorithms generate a lot of unnecessary computational resource waste when facing large-scale time-varying road networks. However, the algorithm proposed in this invention integrates LPA* re-optimization technology and multi-layer label concept, avoiding repeated recalculation, saving computational resources, ensuring computational efficiency, improving the response speed of navigation software, reducing response time, and providing people with better navigation services. Attached Figure Description
[0103] Figure 1 This is an overall flowchart of the present invention;
[0104] Figure 2 This is the network graph of the present invention's example at the current time;
[0105] Figure 3This is a flowchart illustrating the process of searching for the first shortest path at the current time in the example of this invention.
[0106] Figure 4 This is a diagram illustrating the search process for the second shortest path after obtaining the first shortest path at the current time in an example of the present invention.
[0107] Figure 5 This is the network diagram of the example of the present invention after the road condition changes in the next time step;
[0108] Figure 6 This is a flowchart illustrating the process of searching for the first shortest path after changes in road conditions in the example of this invention. Detailed Implementation
[0109] In this embodiment, as Figure 1 As shown, a method for obtaining K shortest paths in a city that takes into account real-time traffic conditions is performed as follows:
[0110] Step 1: Construct the urban road network;
[0111] Obtain real-time road network data and obtain the urban road network G = (V, A, W), where V represents the set of intersection nodes, and V = {v1, v2, v3, ..., v...}. i , ..., v N}, v i Let represent the i-th intersection node, i = 1, 2, 3, ..., N, where N is the total number of intersection nodes in the urban road network G, and A represents the set of road segments between intersection nodes, and A = {(v i v j )|i, j=1, 2, 3..., N}, (v i v j ) represents the i-th intersection node v i To the j-th intersection node v j The directed road segments between intersection nodes, where W represents the set of travel time weights for road segments between intersection nodes, W = {w(v i v j )|i,j=1,2,3,…,N},w(v i v j ) is a directed road segment (v i v j The driving time weight of ) is determined by the i-th intersection node v. i To the j-th intersection node v j There are directed road segments (v) i v j If the j-th intersection node v is... j Let v be the i-th intersection node. i The subsequent intersection node is denoted as The i-th intersection node vi For the j-th intersection node v j The preceding intersection node is denoted as... And ω ij >0, if the i-th intersection node v i To the j-th intersection node v j There is no directed road segment (v) between them. i v j If ω ij =+∞; Let pred(v i ) represents the i-th intersection node v i Let succ(v) be the set of preceding intersection nodes. i ) represents the i-th intersection node v i The set of subsequent intersection nodes; in this embodiment, the travel time weights of each road segment in the network used at the current time are as follows: Figure 2 As shown.
[0112] Step 2: Define parameters and initialize;
[0113] Set the starting intersection node to v. start The endpoint intersection node is v end And v start v end ∈V; Let K represent the intersection node v from the starting point. start To the endpoint intersection node v end The number of shortest paths; let l(v) i ) indicates the intersection node v from the starting point. start To the i-th intersection node v i The number of feasible paths, and l(v i )≤K; In this embodiment, v start =v1,v end =v6, K=3.
[0114] Step 2.1: Define the relevant attributes of the feasible path;
[0115] Let g l (v i ) indicates the intersection v from the starting point start To the i-th intersection node v i The travel time of the l-th feasible path, where l ≤ l(v i );
[0116] Let rhs l (v i ) indicates the intersection v from the starting point start After a length of A feasible path to the i-th intersection node v i Forward intersection node Then, from the preceding intersection node To the i-th intersection node v i The total driving time, of which, Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the a-th feasible route, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and When v i The starting intersection node, i.e., v i =v start At that time, let rhs l (v i ) = 0.
[0117] Let key l (v i ) represents the minimum time value, and key l (v i )=min(g l (v i ), rhs l (v i )); where g l (v i ) indicates the intersection v from the starting point start To the i-th intersection node v i The travel time of the lth feasible route;
[0118] Let r l (v i ) indicates the intersection v from the starting point start To the i-th intersection node v i The l-th feasible path includes the path from the starting intersection v start To the i-th intersection node v i Forward intersection node The relevant attributes of the a-th feasible path;
[0119] Let D(v) i ) indicates the intersection node v from the starting point. start To the i-th intersection node v i The set of attribute labels for all feasible paths, and D(v i The number of attribute tags in ) is l(v i ), and l(v i )≤K;
[0120] Let D(v) i Any l-th attribute tag D in )l (v i ) indicates the intersection node v from the starting point. start To the i-th intersection node v i The set of relevant attributes for the l-th feasible path, and D l (v i )=(g l (v i ), rhs l (v i ), key l (v i ), r l (v i )), l = 1, 2, ..., l(v i ).
[0121] Define D′(v) i Let ) be any i-th intersection node v i All attribute tags by key l (v i The set after ascending order;
[0122] Let D′(v) i Any k-th attribute tag D′ in ) k (v i ) indicates the intersection node v from the starting point. start To the i-th intersection node v i The relevant attributes of the k-th shortest path, namely D′ k (v i )=(g k (v i ), rhs k (v i ), key k (v i ), k = 1, 2, ..., l(v i ); where g k (v i ) indicates the intersection v from the starting point start To the i-th intersection node v i The travel time of the kth shortest path.
[0123] rhs k (v i ) indicates the intersection v from the starting point start After a length of The path reaches the i-th intersection node v i Forward intersection node Then, from the preceding intersection node To the i-th intersection node v i Total driving time Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the shortest route b, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and When v i The starting intersection node, i.e., v i =v start At that time, let rhs k (v i ) = 0;
[0124] key k (v i ) represents the minimum time value, and key k (v i )=min(g k (v i ), rhs k (v i )); where g k (v i ) indicates the intersection v from the starting point start To the i-th intersection node v i The travel time of the k-th shortest path;
[0125] r k (v i ) indicates the intersection v from the starting point start To the i-th intersection node v i The k-th shortest path includes the path from the starting intersection v. start To the i-th intersection node v i Forward intersection node The relevant properties of the bth shortest path.
[0126] definition Let K be the set of tags to be searched for the k-th shortest path;
[0127] Define t0 as a unit time step;
[0128] Step 2.2: Initialize the relevant attributes of feasible paths;
[0129] Initialize the starting intersection node v start The set of tags D(v) start All tags in ) are For any other i-th intersection node v i The set of tags D(v) i All tags in ) are initialized to
[0130] The starting intersection node v start ordered label D′1(v start Add the tags to be searched for the k-th shortest path.
[0131] Define and initialize the timer to t. start .
[0132] Step 3: Calculate the k shortest paths within each unit time step;
[0133] Step 3.1: Calculate the k-th shortest path; initialize k = 1;
[0134] Step 3.1.1: Collect the tags to be searched The intersection node corresponding to the label with the smallest time minimum value is denoted as v. t When k=1, it is first denoted as v. t The intersection node is v1, i.e., v t =v1, let D′ k (v t ) represents the starting intersection node v start To the intersection node v t The relevant attributes of the k-th shortest path, i.e., v t The corresponding attribute tag is D′ k (v t )=(g k (v t ), rhs k (v t ), key k (v t ), r k (v t k = 1, 2, ..., l(v) t ), where g k (v t ) indicates the intersection v from the starting point start To the intersection node v t The travel time of the kth shortest path.
[0135] rhs k (v t ) indicates the intersection v from the starting point start After a length of The path to the intersection node v t Forward intersection node Then, from the preceding intersection node To the intersection node v t Total driving time Indicates the intersection v from the starting pointstart To the front drive intersection node The travel time of the shortest path c, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and When v t The starting intersection node, i.e., v t =v start At that time, let rhs k (v t ) = 0;
[0136] key k (v t ) represents the minimum time value, and key k (v t )=min(g k (v t ), rhs k (v t )); where g k (v t ) indicates the intersection v from the starting point start To the intersection node v t The travel time of the k-th shortest path;
[0137] r k (v t ) indicates the intersection v from the starting point start To the intersection node v t The k-th shortest path includes the path from the starting intersection v. start To the intersection node v t Forward intersection node The relevant attributes of the c-th shortest path;
[0138] l(v t ) indicates the intersection node v from the starting point. start To the intersection node v t The number of feasible paths, and l(v t )≤K.
[0139] If key k (v t ) < key k (v end ) or rhs k (v end )≠g k (v end If the condition is met, proceed to step 3.1.2; otherwise, proceed to step 3.2.
[0140] Step 3.1.2: If g k(v t )>rhs k (v t If the condition is met, proceed to step 3.1.2(a); otherwise, proceed to step 3.1.3.
[0141] Step 3.1.2(a): Let g k (v t )=rhs k (v t ), label D′ k (v t Remove Traverse the intersection node v t The set of successor intersection nodes succ(v t The intersection nodes in the () are such that for any intersection node and Not belonging to the intersection node v from the starting point start To the intersection node v t In the k-th shortest path:
[0142] make Indicates the starting intersection node v start To the intersection node The relevant attributes of the k-th shortest path, i.e., intersection nodes. The corresponding attribute tags are in, Indicates the intersection v from the starting point start To the intersection node The travel time of the kth shortest path.
[0143] Indicates the intersection v from the starting point start After a length of The path to the intersection node Forward intersection node Then, from the preceding intersection node To the intersection node Total driving time Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the m-th shortest path, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and
[0144] This represents the minimum time value, and in, Indicates the intersection v from the starting point startTo the intersection node v t succ The travel time of the k-th shortest path;
[0145] Indicates the intersection v from the starting point start To the intersection node The k-th shortest path includes the path from the starting intersection v. start To the intersection node Forward intersection node The set of attributes related to the m-th shortest path;
[0146] Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and
[0147] If it exists Then for k∈[k, K-1], starting from k=K-1, traverse in descending order. If If the condition is met, proceed to step 3.1.2(b); otherwise, proceed to step 3.1.2(c).
[0148] If it exists Then traverse the intersection nodes. The remaining Given a set of ordered labels, if the x-th label exists... satisfy and Then stop the traversal. For k∈[x, K-1], start the traversal in descending order from k=K-1. If the condition is met, proceed to step 3.1.2(d); otherwise, proceed to step 3.1.2(e).
[0149] Step 3.1.2(b): Let And update the minimum time value label Add the set of tags to be searched for the (k+1)th shortest path In the meantime, we await further steps to continue the search and update, and proceed to step 3.1.2(c);
[0150] Step 3.1.2(c): Update the preceding label, i.e., let Again Proceed to step 4.1; where, Indicates a directed road segment Driving time weighting;
[0151] Step 3.1.2(d): Let And update the minimum time value label Add the set of tags to be searched for the (k+1)th shortest path In the meantime, we await further steps to continue the search and update, and proceed to step 3.1.2(e);
[0152] Step 3.1.2(e): Let And update the minimum time value label Add the tags to be searched for the x-th shortest path In the meantime, we await further steps to continue the search and update, and proceed to step 4.1;
[0153] When k = 1 and vt = v1, first let Then let After updating the corresponding labels, we get D′1(v2)=(+∞,3,3,D′1(v1)) and D′1(v3)=(+∞,2,2,D′1(v1)).
[0154] Step 3.1.3: Let g k (v t ) = ∞;
[0155] Step 3.1.4: Traverse the intersection node v t and its subsequent set of intersection nodes succ(v t The intersection nodes in the () are such that for any intersection node and Not belonging to the intersection node v from the starting point start To the intersection node v t In the k-th shortest path:
[0156] Record the intersection node Precursor intersection node set Any intersection node in the array is
[0157] make Indicates the starting intersection node v start To the intersection node The relevant attributes of the k-th shortest path, i.e., intersection nodes. The corresponding attribute tags are in, Indicates the intersection v from the starting point start To the intersection node The travel time of the kth shortest path.
[0158] Indicates the intersection v from the starting point start After a length of The path to the intersection node Forward intersection node Then, from the preceding intersection node To the intersection node Total driving time Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the shortest route f, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and
[0159] This represents the minimum time value, and in, Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path;
[0160] Indicates the intersection v from the starting point start To the intersection node The k-th shortest path includes the path from the starting intersection v. start To the intersection node Forward intersection node The set of attributes related to the f-th shortest path;
[0161] Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and
[0162] like Not the starting point intersection node v start and If the condition is met, proceed to step 3.1.5; otherwise, return to step 3.1.4 to continue the iteration.
[0163] Step 3.1.5: Traverse the intersection nodes All front-drive intersection nodes The record makes The smallest intersection node is in Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path, Indicates a directed road segment Driving time weighting.
[0164] make Indicates the starting intersection node v start To the intersection node The relevant attributes of the k-th shortest path, i.e., intersection nodes. The corresponding attribute tags are in, Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path;
[0165] Indicates the intersection v from the starting point start After a length of The path to the intersection node Forward intersection node Then, from the preceding intersection node To the intersection node Total driving time Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the shortest route e, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and
[0166] This represents the minimum time value, and in, Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path;
[0167] Indicates the intersection v from the starting point start To the intersection node The k-th shortest path includes the path from the starting intersection v. start To the intersection node Forward intersection node The set of attributes related to the e-th shortest path;
[0168] Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and
[0169] make Proceed to step 4.2, where Indicates a directed road segment Driving time weighting;
[0170] Step 3.2: Calculate the (k+1)th shortest path;
[0171] Assign k+1 values to k. If k > k, proceed to step 6; otherwise, return to step 3.1. In this embodiment, the search process when k = 2 is as follows: Figure 4 As shown.
[0172] Step 4: Update the set of tags to be searched for the k-th shortest path.
[0173] Step 4.1: Update the intersection node tags and ordered labels
[0174] Step 4.1.1: If the intersection node tag value and Minimum update time Proceed to step 4.1.2; otherwise, proceed to step 4.1.3.
[0175] Step 4.1.2: Set the current intersection node Remove set succ(v) t If at this time the set succ(v) t If k is not empty, proceed to step 3.1.2 to continue iterating; otherwise, proceed to step 3.1.1; when k = 1, v t When = v1, succ(v t After the set becomes empty, proceed to step 3.1.1 to obtain v at this point. t =v3, the subsequent search process is similar to before, the complete search process when k=1 at the current time is as follows Figure 3 As shown;
[0176] Step 4.1.3: If and Minimum update time Then the intersection node tags join in Proceed to step 4.1.2;
[0177] like and Then the label Remove Proceed to step 4.1.2.
[0178] Step 4.2: Update the intersection node tag collection and ordered label set
[0179] Step 4.2.1: If the intersection node tag value and Minimum update time Proceed to step 4.2.2; otherwise, proceed to step 4.2.3.
[0180] Step 4.2.2: Set the current intersection node Remove set succ(v) t )∪{v t If at this time the set succ(v) t )∪{v t If the value is not empty, proceed to step 3.1.4 to continue the iteration; otherwise, proceed to step 3.1.1.
[0181] Step 4.2.3: If and Then the intersection node tags join in Proceed to step 4.2.2;
[0182] like and Then the label Remove Proceed to step 4.2.2.
[0183] Step 4.3: Update the intersection node v j The set of tags D k (v j and ordered label set D k ′(v j )
[0184] Step 4.3.1: If the intersection node v j The tag value g k (v j )≠rhs k (v j )and Then the minimum update time for key k (v j If the condition is met, proceed to step 4.3.2; otherwise, proceed to step 4.3.3.
[0185] Step 4.3.2: Set the current road segment (v) i v j Remove set W ch If set W at this time ch If not empty, proceed to step 5.3 to continue iterating through the next road segment with changing travel time weights; otherwise, proceed to step 3.1.1.
[0186] Step 4.3.3 If g k (v j )≠rhs k (v j )and Then the intersection node v j The tag D′ k (v j )join in Proceed to step 4.3.2;
[0187] If g k (v j )=rhs k (v j )and Then label D′ k (v j Remove Proceed to step 4.3.2.
[0188] Step 5: Detect real-time traffic conditions and update the k shortest paths;
[0189] Step 5.1: Determine the timer t start Has t0 been reached? If so, clear the timer t. start If the condition is met, proceed to step 5.2; otherwise, continue timing.
[0190] Step 5.2: Check if the road network travel time weights have changed. If they have not changed, return to step 5.1; otherwise, denote the updated set of travel time weights for road segments between intersection nodes as W. new ={w new (v i v j )|i, j = 1, 2, 3, ..., N}, then proceed to step 5.3; In this embodiment, the network diagram after the road condition changes in the next time step is as follows Figure 5 As shown.
[0191] Step 5.3: Let W be the set of all road segments where the travel time weight changes. ch For road segment (v) i v j )∈W ch Let D′ k (v j ) represents the starting intersection node v start To the intersection node v j The relevant attributes of the k-th shortest path, i.e., v j The corresponding attribute tag is D′ k (v j )=(g k (v j), rhs k (vj ) key k (v j ), r k (v j k = 1, 2, ..., l(v) j ), where g k (v j ) indicates the intersection v from the starting point start To the intersection node v j The travel time of the k-th shortest path; rhs k (v j ) indicates the intersection v from the starting point start After a length of The path to the intersection node v j Forward intersection node Then, from the preceding intersection node To the intersection node v j Total driving time Indicates the intersection v from the starting point start To the front drive intersection node The travel time of the nth shortest path, and Indicates the intersection node v from the starting point. start To the intersection node The number of feasible paths, and When v j The starting intersection node, i.e., v j =v start At that time, let rhs k (v j ) = 0.
[0192] key k (v j ) represents the minimum time value, and key k (v j )=min(g k (v j ), rhs k (v j )); where g k (v j ) indicates the intersection v from the starting point start To the intersection node v j The travel time of the k-th shortest path;
[0193] r k (v j ) indicates the intersection v from the starting point start To the intersection node v j The k-th shortest path includes the path from the starting intersection v.start To the intersection node v j Forward intersection node The relevant attributes of the nth shortest path;
[0194] l(v j ) indicates the intersection node v from the starting point. start To the intersection node v j The number of feasible paths, and l(v j )≤K.
[0195] If w(v) is satisfied i v j )>w new (v i v j If the condition is met, proceed to step 5.3.1; otherwise, proceed to step 5.3.2.
[0196] Step 5.3.1: If rhs k (v j )>g k (v i )+w new (v i v j Let r k (v j ) = D k ′(v i ), then let rhs k (v j ) = g k (v i )+w new (v i v j If the condition is met, proceed to step 4.3; otherwise, proceed to step 5.3 to continue iterating through the next road segment with changing travel time weights.
[0197] Step 5.3.2: If v j Not the starting point intersection node v start And r k (v j )=D′ k (v i ), Traverse the intersection node v j All front-drive intersection nodes The record makes The smallest intersection node is in Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path, Indicates a directed road segment The updated driving time weighting makes Proceed to step 5.3, where, Indicates the intersection v from the starting point start To the intersection node The travel time of the k-th shortest path, Indicates a directed road segment Updated driving time weighting Indicates the intersection node v from the starting point. start To the intersection node Find the relevant attributes of the k-th shortest path; otherwise, proceed to step 5.3 to continue traversing the next road segment with changing travel time weights; when k=1, the traversal process of road segments with changing travel time weights is as follows Figure 6 As shown;
[0198] Step 6: Output the intersection node v at the current time starting point start To the endpoint intersection node v end Information on the K shortest paths;
[0199] Based on the endpoint intersection node v end The set of labels D′(v end) The K labels in the data start from the endpoint intersection node v. end The k-th label D′ k (v end )=(g k (v end ), rhs k (v end ), key k (v end ), r k (v end Starting with r, continuously... k (v end Traverse back to the attribute labels corresponding to the preceding intersection nodes until traversing back to the starting intersection node v. start The tag D′ k (v start Thus, a path from v is obtained. start to v end The k-th shortest path, with a travel time of g. k (v end ), and thus obtain from v start to v end Find the K shortest paths and their travel times, then proceed to step 5 to continue searching for the K shortest paths after the traffic update;
[0200] In this embodiment, the network graph at the current time is as follows: Figure 2As shown in Table 1, when travelers need three shortest paths, the final path planning results are obtained.
[0201] Table 1
[0202] Order k <![CDATA[Driving time gk(v end )]]> path 1 5 <![CDATA[v1-v3-v4-v6]]> 2 7 <![CDATA[v1-v3-v5-v6]]> 3 7 <![CDATA[v1-v2-v3-v4-v6]]>
[0203] In the next time step, due to changes in road conditions, the travel time weight between intersection nodes v1 and v3 decreases, while the travel time weight between intersection nodes v3 and v4 increases. This leads to the increase of the first and third short circuits obtained in Table 1 and the decrease of the second short circuit. Based on the previous calculation results, the path planning results obtained after the network graph search update are shown in Table 2.
[0204] Table 2
[0205] Order k <![CDATA[Driving time g k (v end )]]> path 1 6 <![CDATA[v1-v3-v5-v6]]> 2 7 <![CDATA[v1-v3-v2-v4-v6]]> 3 9 <![CDATA[v1-v2-v3-v5-v6]]>
[0206] In Table 2, the travel times of the first and third short circuits obtained after the search update are both greater than before the road conditions changed, while the travel time of the second short circuit remains unchanged.
[0207] In this embodiment, an electronic device includes a memory and a processor. The memory stores a program that supports the processor in executing the above-described method, and the processor is configured to execute the program stored in the memory.
[0208] In this embodiment, a computer-readable storage medium stores a computer program, which is executed by a processor to perform the steps of the above method.
Claims
1. A method for obtaining K shortest paths in a city considering real-time traffic conditions, characterized in that, The procedure is as follows: Step 1: Construct the urban road network; Obtain real-time road network data and obtain the urban road network. , Let represent the set of intersection nodes, and , Indicates the first Intersection nodes, , For the urban road network The total number of intersection nodes in the middle, Represents the set of road segments between intersection nodes, and , Indicates the first intersection nodes To the intersection nodes The directional road sections between them This represents the set of travel time weights for road segments between intersection nodes. , Directed road segment The driving time weight, if the first intersection nodes To the intersection nodes There are directed road segments. Then the first intersection nodes For the first intersection nodes The subsequent intersection node is denoted as , No. intersection nodes For the first intersection nodes The preceding intersection node is denoted as... ,and If the first intersection nodes To the intersection nodes There are no directed road segments between them. Then let ; make Indicates the first intersection nodes The set of preceding intersection nodes, let Indicates the first intersection nodes The set of successor intersection nodes; Step 2: Define parameters and initialize; Set the starting intersection node as... The endpoint intersection node is ,and ;make Indicates the intersection node from the starting point. To the final intersection node The number of shortest paths; let Indicates the intersection node from the starting point. To the intersection nodes The number of feasible paths, and ; Step 2.1: Define the relevant attributes of feasible paths; make Indicates the intersection from the starting point To the intersection nodes The The travel time for each feasible route, and ; make Indicates the intersection from the starting point After a length of The feasible path to reach the first intersection nodes Forward intersection node Then, from the preceding intersection node To the intersection nodes The total driving time, of which, Indicates the intersection from the starting point To the front drive intersection node The The travel time for each feasible route, and , Indicates the intersection node from the starting point. To the intersection node The number of feasible paths, and ,when The starting intersection node, i.e. season ; make This represents the minimum time value, and = ;in, Indicates the intersection from the starting point To the intersection nodes The Travel time for each feasible route; make Indicates the intersection from the starting point To the intersection nodes The Among the feasible paths, those from the starting intersection are included. To the intersection nodes Forward intersection node The The relevant attributes of a feasible path; make Indicates the intersection node from the starting point. To the intersection nodes The set of attribute tags for all feasible paths, and The number of attribute tags in is ,and ; make any of the first Attribute tags Indicates the intersection node from the starting point. To the intersection nodes The The set of relevant attributes for each feasible path, and ; definition For any number intersection nodes All attribute tags by The set sorted in ascending order; make any of the first Attribute tags Indicates the intersection node from the starting point. To the intersection nodes The The relevant attributes of the shortest path, namely ;in, Indicates the intersection from the starting point To the intersection nodes The The travel time for the shortest path; Indicates the intersection from the starting point After a length of The path to the first intersection nodes Forward intersection node Then, from the preceding intersection node To the intersection nodes Total driving time Indicates the intersection from the starting point To the front drive intersection node The The travel time of the shortest path, and , Indicates the intersection node from the starting point. To the intersection node The number of feasible paths, and ,when The starting intersection node, i.e. season ; This represents the minimum time value, and = ;in, Indicates the intersection from the starting point To the intersection nodes The The travel time for the shortest path; Indicates the intersection from the starting point To the intersection nodes The The shortest path includes the intersections starting from the origin. To the intersection nodes Forward intersection node The The relevant attributes of the shortest path; definition For the first The set of tags to be searched for the shortest path; definition Unit time step; Step 2.2: Initialize the relevant attributes of feasible paths; Initialize the starting intersection node tag collection All tags are any of the remaining ones intersection nodes tag collection All tags in the text are initialized to ; The starting intersection node ordered labels Join the The set of tags to be searched for the shortest path ; Define and initialize the timer as ; Step 3: Calculate the time step within each layer. The shortest path; Step 3.1: Calculate the first... Find the shortest path; initialize ; Step 3.1.1: Collect the tags to be searched The intersection node corresponding to the label with the smallest time minimum value is denoted as ,make Indicates the starting intersection node To the intersection node The The relevant attributes of the shortest path, namely The corresponding attribute tags are ,in, Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path; Indicates the intersection from the starting point After a length of The path to the intersection node Forward intersection node Then, from the preceding intersection node To the intersection node Total driving time Indicates the intersection from the starting point To the front drive intersection node The The travel time of the shortest path, and , Indicates the intersection node from the starting point. To the intersection node The number of feasible paths, and ,when The starting intersection node, i.e. season ; This represents the minimum time value, and = ;in, Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path; Indicates the intersection from the starting point To the intersection node The The shortest path includes the intersections starting from the origin. To the intersection node Forward intersection node The The relevant attributes of the shortest path; Indicates the intersection node from the starting point. To the intersection node The number of feasible paths, and ; like or If yes, proceed to step 3.1.2; otherwise, proceed to step 3.
2. Step 3.1.2: If If so, proceed to step 3.1.2a; otherwise, go to step 3.1.
3. Step 3.1.2a: Let , label Remove Traverse the intersection nodes The set of successor intersection nodes The intersection nodes in the data, for any intersection node and Not belonging to the intersection node from the starting point To the intersection node The In short circuit: make Indicates the starting intersection node To the intersection node The The relevant attributes of the shortest path, namely the intersection nodes. The corresponding attribute tags are ,in, Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path; Indicates the intersection from the starting point After a length of The path to the intersection node Forward intersection node Then, from the preceding intersection node To the intersection node Total driving time Indicates the intersection from the starting point To the front drive intersection node The The travel time of the shortest path, and , Indicates the intersection node from the starting point. To the intersection node The number of feasible paths, and ; This represents the minimum time value, and = ;in, Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path; Indicates the intersection from the starting point To the intersection node The The shortest path includes the intersections starting from the origin. To the intersection node Forward intersection node The The set of attributes related to the shortest path; Indicates the intersection node from the starting point. To the intersection node The number of feasible paths, and ; If it exists Then for ,from Begin descending order traversal, if If yes, proceed to step 3.1.2b; otherwise, proceed to step 3.1.2c. If it exists Then traverse the intersection nodes. The remaining The ordered label, if there exists the first... Tag satisfy and Then stop traversing, for ,from Begin descending order traversal, if If so, proceed to step 3.1.2d; otherwise, proceed to step 3.1.2e. Step 3.1.2b: Let , And update the minimum time value. , label Join the The set of tags to be searched for the shortest path In the meantime, we await further steps to continue the search and update, and proceed to step 3.1.2c; Step 3.1.2c: Update the preceding label, i.e., let , and then Proceed to step 4.1; where, Indicates a directed road segment Driving time weighting; Step 3.1.2d: Let , And update the minimum time value. , label Join the The set of tags to be searched for the shortest path In the meantime, we await further steps to continue the search and update, and proceed to step 3.1.2e; Step 3.1.2e: Let , And update the minimum time value. , label Join the The set of tags to be searched for the shortest path In the meantime, we await further steps to continue the search and update, and proceed to step 4.1; Step 3.1.3: Let ; Step 3.1.4: Traverse the intersection nodes and its subsequent set of intersection nodes The intersection nodes in the data, for any intersection node and Not belonging to the intersection node from the starting point To the intersection node The In short circuit: Record the intersection node Precursor intersection node set Any intersection node in the array is ; make Indicates the starting intersection node To the intersection node The The relevant attributes of the shortest path, namely the intersection nodes. The corresponding attribute tags are ,in, Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path; Indicates the intersection from the starting point After a length of The path to the intersection node Forward intersection node Then, from the preceding intersection node To the intersection node Total driving time Indicates the intersection from the starting point To the front drive intersection node The The travel time of the shortest path, and , Indicates the intersection node from the starting point. To the intersection node The number of feasible paths, and ; This represents the minimum time value, and = ;in, Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path; Indicates the intersection from the starting point To the intersection node The The shortest path includes the intersections starting from the origin. To the intersection node Forward intersection node The The set of attributes related to the shortest path; Indicates the intersection node from the starting point. To the intersection node The number of feasible paths, and ; like Not the starting point intersection node and If the result is positive, proceed to step 3.1.5; otherwise, return to step 3.1.4 to continue the traversal. Step 3.1.5: Traverse the intersection nodes All front-drive intersection nodes , make the record The smallest intersection node is ,in, Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path. Indicates a directed road segment Driving time weighting; make Indicates the starting intersection node To the intersection node The The relevant attributes of the shortest path, namely the intersection nodes. The corresponding attribute tags are ,in, Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path; Indicates the intersection from the starting point After a length of The path to the intersection node Forward intersection node Then, from the preceding intersection node To the intersection node Total driving time Indicates the intersection from the starting point To the front drive intersection node The The travel time of the shortest path, and , Indicates the intersection node from the starting point. To the intersection node The number of feasible paths, and ; This represents the minimum time value, and = ;in, Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path; Indicates the intersection from the starting point To the intersection node The The shortest path includes the intersections starting from the origin. To the intersection node Forward intersection node The The set of attributes related to the shortest path; Indicates the intersection node from the starting point. To the intersection node The number of feasible paths, and ; make , Proceed to step 4.2, where, Indicates a directed road segment Driving time weighting; Step 3.2: Calculate the first... +1 shortest path; Will +1 assignment to ,like If yes, proceed to step 6; otherwise, return to step 3.
1. Step 4: Update the The set of tags to be searched for the shortest path ; Step 4.1: Update the intersection node tags and ordered labels ; Step 4.1.1: If the intersection node tag value and Then the minimum update time Proceed to step 4.1.2 if the condition is met; otherwise, proceed to step 4.1.
3. Step 4.1.2: Set the current intersection node Remove set If the set at this time If not empty, proceed to step 3.1.2 to continue the traversal; otherwise, proceed to step 3.1.
1. Step 4.1.3: If and Then the minimum update time Then the intersection node tags join in Proceed to step 4.1.2; like and Then the label Remove Proceed to step 4.1.2; Step 4.2: Update the intersection node tag collection and ordered label set ; Step 4.2.1: If the intersection node tag value and Then the minimum update time Proceed to step 4.2.2; otherwise, proceed to step 4.2.
3. Step 4.2.2: Set the current intersection node Remove set If the set at this time If not empty, proceed to step 3.1.4 to continue the traversal; otherwise, proceed to step 3.1.
1. Step 4.2.3: If and Then the intersection node tags join in Proceed to step 4.2.2; like and Then the label Remove Proceed to step 4.2.2; Step 4.3: Update the intersection node tag collection and ordered label set ; Step 4.3.1: If the intersection node tag value and Then the minimum update time Proceed to step 4.3.2 if the condition is met; otherwise, proceed to step 4.3.
3. Step 4.3.2: Set the current road segment Remove all road segments whose travel time weights have changed. If the set at this time If not empty, proceed to step 5.3 to continue iterating through the next road segment with changing travel time weights; otherwise, proceed to step 3.1.
1. Step 4.3.3 If and Then the intersection node tags join in Proceed to step 4.3.2; like and Then the label Remove Proceed to step 4.3.2; Step 5: Detect and update real-time traffic conditions The shortest path; Step 5.1: Determine the timer Has it been achieved? If so, clear the timer. If the condition is met, proceed to step 5.2; otherwise, continue timing. Step 5.2: Check if the road network travel time weights have changed. If they have not changed, return to Step 5.1; otherwise, record the updated set of travel time weights for road segments between intersection nodes as follows. Proceed to step 5.3; Step 5.3: For road segments , make Indicates the starting intersection node To the intersection node The The relevant attributes of the shortest path, namely The corresponding attribute tags are ,in, Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path; Indicates the intersection from the starting point After a length of The path to the intersection node Forward intersection node Then, from the preceding intersection node To the intersection node Total driving time Indicates the intersection from the starting point To the front drive intersection node The The travel time of the shortest path, and , Indicates the intersection node from the starting point. To the intersection node The number of feasible paths, and ,when The starting intersection node, i.e. season ; This represents the minimum time value, and = ;in, Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path; Indicates the intersection from the starting point To the intersection node The The shortest path includes the intersections starting from the origin. To the intersection node Forward intersection node The The relevant attributes of the shortest path; Indicates the intersection node from the starting point. To the intersection node The number of feasible paths, and ; If satisfied If yes, proceed to step 5.3.1; otherwise, proceed to step 5.3.
2. Step 5.3.1: If ,make Then let If not, proceed to step 4.3; otherwise, proceed to step 5.3 to continue traversing the next road segment with changing travel time weights. Step 5.3.2: If Not the starting point intersection node and Traverse the intersection nodes All front-drive intersection nodes , make the record The smallest intersection node is ,in Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path. Indicates a directed road segment The updated driving time weighting makes , Proceed to step 5.3, where, Indicates the intersection from the starting point To the intersection node The The travel time for the shortest path. Indicates a directed road segment Updated driving time weighting Indicates the intersection node from the starting point. To the intersection node The The relevant attributes of the shortest path; Otherwise, proceed to step 5.3 to continue iterating through the next road segment with changing travel time weights; Step 6: Output the current time from the starting intersection node. To the final intersection node of Shortest path information; Based on the endpoint intersection node tag collection In A label, from the endpoint intersection node The Tag In the beginning, continuously through Traverse back to the attribute labels corresponding to the preceding intersection node until traversing back to the starting intersection node. tags Thus, a path is obtained from arrive The Shortest route, and travel time is Thus, the number of steps per unit time from arrive of Find the shortest path and its travel time, then proceed to step 5 to continue searching for updated traffic conditions. The shortest path.
2. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports the processor in executing the method for obtaining the K shortest paths to a city as described in claim 1, and the processor is configured to execute the program stored in the memory.
3. A computer-readable storage medium storing a computer program, characterized in that, The computer program, when run by the processor, executes the steps of the method for obtaining K shortest paths to a city as described in claim 1.
Citation Information
Patent Citations
Shortest path planning method for dynamic origins
CN101739817A
Measuring Quality in Optimal Navigation Routes by Navigation Systems
US20160054135A1