Online compiling method and device, computer equipment and storage medium

Through the online compilation method, combining the difference thresholds of the road network topology data and closed opening data, the online weight chart is updated using a fast or complete compilation strategy, which solves the shortcomings of the CH algorithm in dynamic data processing and achieves efficient and stable computing updates and resource conservation.

CN119938055APending Publication Date: 2025-05-06SHENZHEN YISHIHUOLALA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411999627.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

In the prior art, shrinkage hierarchy (CH) algorithms are difficult to adapt to the dynamic changes of data when processing large-scale graph data, resulting in a long process of offline compilation plus timing push mechanisms and high cost.

Method used

Provide an online compilation method, which obtains the weight online graph by offline compiling based on the road network topology data and weight data, combines the difference threshold of the closed activation data, uses a fast compilation or full compilation strategy to generate the compiled graph, and updates the weight online graph to take effect.

Benefits of technology

It realizes that data is not required to be transmitted and loaded into memory, avoids the instability caused by offline environments and long processes, saves machine and network resources, can quickly take effect and close data, improves the computing effect experience, and does not increase the computing response time when a large amount of data is updated.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119938055A_ABST
    Figure CN119938055A_ABST
Patent Text Reader

Abstract

The invention discloses an online compiling method and device, computer equipment and a storage medium, and the method comprises the steps: carrying out the offline compiling based on road network topological data and corresponding weight data, and obtaining a weight online graph; when the difference between the closed opening data and the closed opening backup data is smaller than a preset threshold value, generating a first compiled graph with a corresponding weight through a rapid compilation strategy; when the difference is greater than or equal to a preset threshold value, generating a second compiled graph with a corresponding weight through a complete compilation strategy; and updating the weight online graph through the first compiled graph or the second compiled graph so as to take effect of the closed opening data by using the updated weight online graph. According to the method, data transmission and data loading to a memory are not needed, unstable factors caused by an offline environment and a long flow are avoided, the method is not limited by whether infrastructures are complete or not, and offline machine resources and network resources are saved. And the path calculation effect experience can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of route planning, and in particular to an online compilation method, device, computer equipment and storage medium. Background Art

[0002] In the context of the continuous development of modern transportation and network technology, path planning algorithms play a critical role in many fields, especially in traffic navigation systems and network data transmission routing selection. Among them, the Contraction Hierarchy (CH) algorithm, as an efficient path planning algorithm, has attracted much attention because it can significantly accelerate the shortest path query when processing large-scale graph data.

[0003] However, the CH algorithm also has obvious limitations. The graph it constructs is generated based on static data at a specific moment, which means that once the graph is constructed, it is difficult to adapt to dynamic changes in data during subsequent use. In order to solve the shortcomings of the CH algorithm in dealing with dynamic data, the current mainstream solution is offline compilation plus a scheduled push mechanism. Although this solution can solve the shortcomings of the CH algorithm in dealing with dynamic data. However, the offline compiled CH graph data needs to be transmitted to a fixed location for online services to load. The process of offline compilation plus scheduled push is long, and the offline environment is unstable. In addition, the scheduled push method requires a relatively sound infrastructure and requires more investment costs. In addition, the CH graph data volume is large, and the processing process consumes more machine and network resources. Summary of the invention

[0004] Based on this, it is necessary to provide an online compilation method, apparatus, computer device and storage medium for the above technical problems, so as to solve at least one problem existing in the above prior art.

[0005] In a first aspect, an online compilation method is provided, comprising the following steps:

[0006] Based on the offline compilation of the road network topology data and the corresponding weight data, a weighted online graph is obtained, wherein the weighted online graph refers to the CH graph data with different weights being stored in an online graph;

[0007] When the difference between the closed activation data and the closed activation backup data is less than a preset threshold, generating a first compilation graph of corresponding weights by a fast compilation strategy;

[0008] When the difference between the closed activation data and the closed activation backup data is greater than or equal to the preset threshold, generating a second compilation graph of corresponding weights by a full compilation strategy;

[0009] The weight online map is updated through the first compiled map or the second compiled map to use the updated weight online map to validate the closed activation data.

[0010] In one embodiment, the step of obtaining an online graph of weights based on offline compilation of the road network topology data includes:

[0011] Based on the road network topology data and corresponding weight data, generating an initial compiled graph;

[0012] Based on the initial compiled graph, determining the priority of each node;

[0013] Contracting nodes based on the priority of each node, and adding shortcut edges in the initial compiled graph during the contraction process to obtain a target compiled graph;

[0014] The target compiled graph is converted into an online graph to obtain the weighted online graph based on the online graph.

[0015] In one embodiment, the generating a first compilation graph corresponding to the weights by using a fast compilation strategy includes:

[0016] Based on the road network topology data and the penalty weights of the closed and opened data, an initial compiled graph is generated;

[0017] Construct a node contraction sequence based on the point sequence file generated by offline compilation;

[0018] The node contraction sequence is traversed, and a contraction process is performed on the current node. During the contraction process, a shortcut edge is added to the initial compiled graph to obtain the first compiled graph.

[0019] In one embodiment, the shrinking process of the current node, and adding a shortcut edge in the initial compiled graph during the shrinking process, includes:

[0020] Determine the entry point and the exit point of the current node;

[0021] Performing path calculation on the entry point and the exit point;

[0022] Based on the path calculation result, when an optimal path cannot be found or the current node is on the optimal path, a shortcut edge is added to the initial compiled graph.

[0023] In one embodiment, the generating a second compilation graph corresponding to the weights by using a full compilation strategy includes:

[0024] Based on the road network topology data and the penalty weights of the closed and opened data, an initial compiled graph is generated;

[0025] Based on the initial compiled graph, determining the priority of each node;

[0026] Contracting nodes based on the priority of each node, and adding shortcut edges in the initial compiled graph during the contraction process to obtain a new point sequence file;

[0027] The new point sequence file replaces the point sequence file generated by offline compilation to obtain the second compiled graph.

[0028] In one embodiment, shrinking nodes based on the priority of each node includes:

[0029] Add nodes with priorities to the priority node queue;

[0030] When the priority node queue is not empty, extracting a head node from the priority node queue, and recalculating the priority of the head node;

[0031] Determine whether the head node priority is higher than the current head node priority in the priority node queue;

[0032] If so, the head node of the team is shrunk.

[0033] In one embodiment, updating the weight online graph based on the first compiled graph or the second compiled graph includes:

[0034] Clearing a cached online graph, and filling the cached online graph with the first compiled graph or the second compiled graph;

[0035] The filled cache online map and the corresponding weight online map are exchanged for addresses.

[0036] In a second aspect, an online compiling device is provided, comprising:

[0037] An offline compilation unit, used for offline compilation based on the road network topology data and the corresponding weight data to obtain a weighted online graph, wherein the weighted online graph refers to CH graph data with different weights being stored in an online graph;

[0038] A fast compilation unit, configured to generate a first compilation graph of corresponding weights by a fast compilation strategy when a difference between the closed activation data and the closed activation backup data is less than a preset threshold;

[0039] a full compilation unit, configured to generate a second compilation graph of corresponding weights by a full compilation strategy when a difference between the closed activation data and the closed activation backup data is greater than or equal to the preset threshold;

[0040] The compilation completion unit is configured to update the weight online map through the first compiled map or the second compiled map, so as to use the updated weight online map to validate the closed activation data.

[0041] In a third aspect, a computer device is provided, comprising a memory, a processor, and computer-readable instructions stored in the memory and executed on the processor, wherein the processor implements the online compilation method as described above when executing the computer-readable instructions.

[0042] In a fourth aspect, a readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor, the online compilation method as described above is implemented.

[0043] The above-mentioned online compilation method, device, computer equipment and storage medium, the method of which is implemented, includes: based on the road network topology data and the corresponding weight data, offline compilation obtains the weight online graph, wherein the weight online graph refers to the CH graph data with different weights stored in the online graph; when the difference between the closed opening data and the closed opening backup data is less than the preset threshold, the first compilation graph of the corresponding weight is generated by the fast compilation strategy; when the difference between the closed opening data and the closed opening backup data is greater than or equal to the preset threshold, the second compilation graph of the corresponding weight is generated by the complete compilation strategy; the weight online graph is updated by the first compilation graph or the second compilation graph to use the updated weight online graph to make the closed opening data effective. In the embodiment of the present application, there is no need to transmit data or load data into the memory, and there will be no unstable factors due to the offline environment and the long process. It is not limited by whether the infrastructure is complete, saving offline machine resources and network resources. Moreover, full compilation or quick compilation can be realized according to the data flow of closed opening data, so that a small amount of data update in closed opening can take effect quickly, improving the experience of path calculation effect; at the same time, a large amount of data can also be updated in closed opening without increasing the path calculation response time. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0045] Figure 1 is a flow chart of an online compiling method in one embodiment of the present application;

[0046] Figure 2 is a structural diagram of an online compiling device in one embodiment of the present application;

[0047] Figure 3 It is a schematic diagram of a computer device in one embodiment of the present application. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0049] In one embodiment, if Figure 1 As shown, an online compilation method is provided, comprising the following steps:

[0050] In step S110, a weighted online graph is obtained based on the road network topology data and the corresponding weighted data through offline compilation, wherein the weighted online graph refers to CH graph data with different weights being stored in an online graph;

[0051] In the embodiment of the present application, two graphs can be defined, CompileGraph and OnlineGraph. Both CompileGraph and OnlineGraph can represent CH graphs, but each has different characteristics. Among them, CompileGraph is implemented using an adjacency list to meet the needs of shrinking and generating CH graph data on a topological graph. OnlineGraph is implemented using CSR (sparse matrix row compression), which compresses CH graph data to save memory resources.

[0052] In an embodiment of the present application, an online service based on the CH algorithm may include OnlineGraphs with different weights. For example, time weights and distance weights, wherein the weighted OnlineGraph refers to CH graph data with different weights being stored using an online graph. Buffer OnlineGraph is used to convert CompileGraph to OnlineGraph and exchange addresses with the corresponding weighted OnlineGraph. CompileGraph is used to compile CH graph data with different weights. Closed data backup is used to fill gaps in data changes.

[0053] Optionally, the topological data of the road network can be obtained through a geographic information system (GIS) database; or the road network topological data can be obtained through a map service platform; or the road network topological data can be obtained through a traffic management platform. The road network topological data can specifically include the coordinate information of nodes (which can correspond to key locations such as intersections and road endpoints) and the start and end node identifiers of edges (road sections), so as to construct a complete road network topological structure. In addition, the attribute information of each road can be obtained, such as the number of vehicles, speed and other traffic flow information of the corresponding road section, historical traffic data, road condition information, traffic restriction information, etc. Therefore, the road attributes such as the degree of traffic congestion and average travel time of different time periods and different roads can be analyzed, and corresponding weight coefficients can be assigned to different road attributes, and then the comprehensive weight of the road can be calculated, which can be used as the weight data corresponding to each edge.

[0054] Optionally, based on the road network topology data and the corresponding weight data, a weighted online graph can be obtained through offline compilation, which is used to quickly start the service to provide online route calculation functions. Exemplarily, an empty graph object can be created, the loaded road network topology data and the corresponding weight data can be traversed, and the node information therein can be added to the graph object one by one. At the same time, the edges and their weights can be added to the graph object in combination with the corresponding weight data. Thus, an initial graph CompileGraph with weights is constructed. Then the priority of each node can be calculated, and the nodes can be shrunk based on the priority. During the shrinking process, shortcut edges (Shortcut) can be added to the CompileGraph to form the graph data required by CH. The added CompileGraph can then be converted to an OnlineGraph to obtain a weighted OnlineGraph. At the same time, the shrunk point sequence can be saved, and the corresponding point sequence file can be generated for subsequent compilation processes.

[0055] Among them, the weighted online graph refers to the CH graph data with different weights being stored in an online graph.

[0056] In step S120, when the difference between the closed activation data and the closed activation backup data is less than a preset threshold, a first compilation graph of corresponding weights is generated by a fast compilation strategy;

[0057] It should be noted that closure and opening data refers to the closure and opening data generated when roads are closed due to construction (such as underground pipeline maintenance and road surface renovation in urban roads), traffic accidents (serious accidents make roads inaccessible and need to be temporarily closed for processing), natural disasters (such as floods destroying road sections, landslides burying roads, etc.) or security needs of special events (such as hosting large-scale events, the roads along the track need to be temporarily closed), prohibiting vehicles and pedestrians from passing through. It may include information such as the scope of the closed section, closure time, and opening time. The closure and opening backup data is pre-stored information such as the scope of the closed section, closure time, and opening time.

[0058] After the closed opening data is obtained, the closed opening data can be replaced with the closed opening backup data. The Gap size between the closed opening data and the closed opening backup data is calculated, such as the difference in data volume, key attribute difference, comprehensive difference score, etc. to determine the Gap size. Exemplarily, the difference between the total number of records of the closed opening data and the total number of records of the backup data is counted to reflect the change in data volume. For example, the closed opening data pulled has 100 records and the backup data has 80 records, then the Gap size of the quantity difference is 100-80=20. Alternatively, the number of inconsistencies in the key attributes corresponding to the same facility (such as the same road, the same network line, etc.) can be compared. For example, when the facility name is the same in each record, the number of records with different attributes such as status (closed or open), start time, and end time is compared. Alternatively, a certain weight can be assigned according to the importance of different attributes, and then the attribute difference of each record is scored, and finally the scores of all records are summarized to measure the overall Gap size. For example, assuming that the difference weight of the state attribute is 0.5, the difference weight of the time attribute is 0.3, and the difference weight of other attributes is 0.2, the difference score of each record is calculated according to the rules and the sum is obtained to obtain the comprehensive Gap value.

[0059] When the difference between the closed activation data and the closed activation backup data is less than a preset threshold, for example, less than 20%, a first compiled graph of corresponding weights is generated by a fast compilation strategy. The fast compilation strategy refers to using a set of existing point order to generate CH graph data, and the compiled CH graph has more edges, and the online path calculation performance is poor, but the compilation time is short.

[0060] In step S130, when the difference between the closed activation data and the closed activation backup data is greater than or equal to the preset threshold, a second compilation graph of corresponding weights is generated by a full compilation strategy;

[0061] When the difference between the closed activation data and the closed activation backup data is greater than or equal to the preset threshold, for example, greater than or equal to 20%, a second compiled graph of corresponding weights can be generated through a full compilation strategy. Wherein, full compilation refers to dynamically generating point sequence and CH graph data based on node contraction. The CH graph compiled through the full compilation strategy has fewer edges and better online path calculation performance, but the compilation time is long.

[0062] In step S140, the weight online map is updated by using the first compiled map or the second compiled map, so as to use the updated weight online map to validate the closed activation data.

[0063] Optionally, the first compiled graph or the second compiled graph may be exchanged with the corresponding weighted online graph, that is, the reference originally pointing to the first compiled graph CompileGraph or the second compiled graph CompileGraph is changed to point to the corresponding weighted online graph OnlineGraph, and the reference originally pointing to the corresponding weighted online graph OnlineGraph is changed to point to the first compiled graph CompileGraph or the second compiled graph CompileGraph. Thus, an updated weighted online graph is obtained, and then the closure and opening data may be validated based on the updated weighted online graph. For example, for a closed road, it is necessary to adjust its corresponding weight in the updated weighted online graph to a maximum value (theoretically approaching infinity) or set it to a special mark value, indicating that the road section is temporarily impassable, so that when performing subsequent operations such as path planning based on the weighted online graph, the algorithm will avoid these closed sections.

[0064] It should be noted that step 120 to step 140 may be executed cyclically to keep the online data fresh.

[0065] The above-mentioned online compilation method includes: based on the road network topology data and the corresponding weight data, offline compilation is used to obtain the weight online map, wherein the weight online map refers to the CH map data with different weights stored in the online map; when the difference between the closed opening data and the closed opening backup data is less than the preset threshold, the first compilation map of the corresponding weight is generated by the fast compilation strategy; when the difference between the closed opening data and the closed opening backup data is greater than or equal to the preset threshold, the second compilation map of the corresponding weight is generated by the full compilation strategy; the weight online map is updated by the first compilation map or the second compilation map to use the updated weight online map to take effect. In the embodiment of the present application, there is no need to transmit data or load data into the memory, and there will be no unstable factors due to the offline environment and the long process. It is not limited by whether the infrastructure is complete, and offline machine resources and network resources are saved. And according to the data flow of the closed opening data, full compilation or fast compilation can be realized, and a small amount of data update of the closed opening can be quickly effective, which improves the experience of the road calculation effect; at the same time, a large amount of data update in the closed opening does not increase the road calculation response time.

[0066] In one embodiment of the present application, the step of obtaining a weighted online graph based on offline compilation of the road network topology data includes:

[0067] Based on the road network topology data and corresponding weight data, generating an initial compiled graph;

[0068] Based on the initial compiled graph, determining the priority of each node;

[0069] Contracting nodes based on the priority of each node, and adding shortcut edges in the initial compiled graph during the contraction process to obtain a target compiled graph;

[0070] The target compiled graph is converted into an online graph to obtain the weighted online graph based on the online graph.

[0071] Optionally, an empty graph object can be created, the loaded road network topology data and the corresponding weight data can be traversed, and the node information therein can be added to the graph object one by one to ensure that each node has a unique identifier (such as node number or coordinates, etc.). Then, based on the connection relationship of the edges in the topology data and the corresponding weight data, the edges and their weights are added to the graph object. For example, if the topology data indicates that there is an edge (road section) connecting node A and node B, the weight attributes such as the length and travel time corresponding to the edge are obtained from the weight data, and the edge and weight information are added to the graph by calling the add edge function of the graph object (and passing in the corresponding weight parameter), thereby constructing an initial compiled graph CompileGraph with weights.

[0072] Then, based on the topological structure of the initial compiled graph, the priority of each node in the graph can be calculated, for example, by the number of edges connected to each node. The more edges connected, the higher the priority. Or by determining the distance from each node to a key node, such as the starting point and the end point. The shorter the distance, the higher the priority. Or by calculating the edge difference of the node, the node priority can be determined. The edge difference refers to the difference in some attributes of the edges associated with the node. These attributes can be the weights of the edges.

[0073] After obtaining the priority of each node, the nodes can be shrunk based on the priority. During the shrinking process, shortcut edges (Shortcut) can be added to the CompileGraph to form the graph data required by CH. Then the added CompileGraph can be converted to OnlineGraph to obtain the weighted OnlineGraph. At the same time, the shrunk point sequence can be saved and the corresponding point sequence file can be generated for the subsequent compilation process.

[0074] It should be noted that after obtaining the node priority, the node with the node priority can be pushed into the priority queue and arranged in order from high to low priority. Then, it can be determined whether the priority queue is empty. If not, the head node of the priority queue, that is, the node with the highest priority, is popped out, and the priority of the head node is recalculated to determine whether the priority of the head node is higher than the priority of the current head node in the priority queue. If so, the head node is shrunk. If the priority queue is empty, the step of pushing the node with the node priority into the priority queue can be executed.

[0075] It can be understood that the offline compiled files can enable the online service to quickly support path calculation requests without affecting service availability.

[0076] In an embodiment of the present application, the step of generating a first compilation graph corresponding to a weight by using a fast compilation strategy includes:

[0077] Based on the road network topology data and the penalty weights of the closed and opened data, an initial compiled graph is generated;

[0078] Construct a node contraction sequence based on the point sequence file generated by offline compilation;

[0079] The node contraction sequence is traversed, and a contraction process is performed on the current node. During the contraction process, a shortcut edge is added to the initial compiled graph to obtain the first compiled graph.

[0080] Among them, the closure and opening data reflects the real-time or phased traffic status changes of each road section in the road network. For example, a road is closed due to construction, accidents, etc., or a road that was originally closed is reopened. When a road is closed, in order to allow the path planning algorithm to avoid these sections as much as possible during calculation, a larger penalty weight will be given to the closed edge (section), for example, a value much larger than the normal road weight, to indicate that the section is currently inaccessible.

[0081] You can create an empty graph object, traverse the loaded road network topology data and the corresponding weight data, and add the node information to the graph object one by one to ensure that each node has a unique identifier (such as node number or coordinates, etc.). According to the connection relationship in the topology data and the penalty weight corresponding to the closed and opened data, add the edges and their weights to the graph object. Thus, an initial compiled graph CompileGraph with weights is constructed.

[0082] Then, the point sequence file generated by offline compilation can be loaded, and the point sequence file includes the contraction point sequence in the contraction process of offline compilation, such as arranging the contraction nodes in the order before and after contraction. A node contraction sequence can be constructed based on the point sequence file, and the node contraction sequence is traversed, and the current node is contracted, and a shortcut edge is added to the initial compiled graph during the contraction process to obtain the first compiled graph.

[0083] In an embodiment of the present application, the shrinking process of the current node, and adding a shortcut edge in the initial compiled graph during the shrinking process, includes:

[0084] Determine the entry point and exit point of the current node;

[0085] Performing path calculation on the entry point and the exit point;

[0086] Based on the path calculation result, when an optimal path cannot be found or the current node is on the optimal path, a shortcut edge is added to the initial compiled graph.

[0087] It should be noted that for the current node to be shrunk, it is connected to other nodes in the graph through edges. Those nodes with edges pointing to the current node are called entry points, and those nodes with edges pointing from the current node are called exit points. For example, in a graph representing a traffic network, if a certain intersection is regarded as the current node, then other intersections leading to this intersection are entry points, and other intersections that can be reached from this intersection are exit points.

[0088] A preset algorithm, such as the Dijkstra algorithm, can be used to take the entry point as the starting node and the exit point as the end point to perform a path calculation operation, starting from the starting node and gradually expanding the search range. Each time, the unvisited node closest to the starting node is selected for visit, and the distance information of its adjacent nodes is updated until all reachable nodes are traversed or the target node is reached. Finally, the shortest path from the starting node to all other reachable nodes in the graph and its corresponding distance (weight) can be obtained.

[0089] After performing Dijkstra path calculation on the entry and exit points, if it is found that a clear optimal route cannot be found between some entry and exit points, this means that under the current graph structure, the connectivity between these nodes may be insufficient or because the node to be shrunk currently plays a key connection role to some extent. Once it is shrunk, the original reasonable path is destroyed. At this time, it is necessary to add a shortcut edge to make up for the lack of connectivity, so that there can be a valid path between the entry and exit points, ensuring that the graph still maintains good connectivity after the node is shrunk, which is convenient for subsequent path planning, information transmission and other operations based on the graph. For example, suppose there are three nodes A (entry point), current node N, and node B (exit point). A and B were originally connected through node N. After shrinking node N, the Dijkstra algorithm is used to calculate A to B, but an optimal route cannot be found. Then it is necessary to add a shortcut edge between A and B so that connectivity from A to B can still be achieved after the graph structure changes.

[0090] After performing Dijkstra path calculation on the entry and exit points, if it is found that the node to be shrunk is on the optimal route between the entry and exit points, a Shortcut edge needs to be added. This is because once the node is shrunk, the optimal route will be interrupted. In order to ensure that the entry and exit points can still be connected through a path that is approximately optimal (try to maintain the original shortest path characteristics) after the node is shrunk, a Shortcut edge must be added to "bypass" the shrunk node and rebuild an effective path connection. For example, in a traffic network diagram, the original shortest path between node A and node B is through node C (the node to be shrunk currently). If node C is shrunk directly, the shortest path from A to B will no longer exist. Therefore, it is necessary to add a Shortcut edge between A and B. Its weight can be reasonably set according to the weight of the original optimal route when it passes through node C (such as calculating the total weight of the original route from A to C to B, and using it as the weight of the newly added Shortcut edge). In this way, after shrinking node C, through this Shortcut edge, A and B can still maintain relatively efficient connectivity, so that functions such as path planning can proceed normally.

[0091] In an embodiment of the present application, the step of generating a second compilation graph corresponding to a weight by using a complete compilation strategy includes:

[0092] Based on the road network topology data and the penalty weights of the closed and opened data, an initial compiled graph is generated;

[0093] Based on the initial compiled graph, determining the priority of each node;

[0094] Contracting nodes based on the priority of each node, and adding shortcut edges in the initial compiled graph during the contraction process to obtain a new point sequence file;

[0095] The new point sequence file replaces the point sequence file generated by offline compilation to obtain the second compiled graph.

[0096] Among them, the closure and opening data reflects the real-time or phased traffic status changes of each road section in the road network. For example, a road is closed due to construction, accidents, etc., or a road that was originally closed is reopened. When a road is closed, in order to allow the path planning algorithm to avoid these sections as much as possible during calculation, a larger penalty weight will be given to the closed edge (section), for example, a value much larger than the normal road weight, to indicate that the section is currently inaccessible.

[0097] You can create an empty graph object, traverse the loaded road network topology data and the corresponding weight data, and add the node information to the graph object one by one to ensure that each node has a unique identifier (such as node number or coordinates, etc.). According to the connection relationship in the topology data and the penalty weight corresponding to the closed and opened data, add the edges and their weights to the graph object. Thus, an initial compiled graph CompileGraph with weights is constructed.

[0098] Then, based on the topological structure of the initial compiled graph, the priority of each node in the graph can be calculated, for example, by the number of edges connected to each node. The more edges connected, the higher the priority. Or by determining the distance from each node to a key node, such as the starting point and the end point. The shorter the distance, the higher the priority. Or by calculating the edge difference of the node, the node priority can be determined. The edge difference refers to the difference in some attributes of the edges associated with the node. These attributes can be the weights of the edges.

[0099] After obtaining the priority of each node, the nodes can be shrunk based on the priority. During the shrinking process, shortcut edges (Shortcut) can be added to the CompileGraph, and the shrinking point sequence can be recorded and saved to form a new point sequence file. The new point sequence file replaces the point sequence file generated by offline compilation. Based on the graph structure after replacing the point sequence file, the second compiled graph can be obtained.

[0100] It is understandable that the online service needs to load the point sequence file generated offline first, so as to facilitate the use of the fast compilation strategy, and the point sequence generated after the full compilation is completed should replace the offline point sequence loaded before. This ensures that the graph shortcut generated by the fast compilation is accurate, the amount of edge data is small, and there is no impact on the online path calculation performance.

[0101] In an embodiment of the present application, shrinking nodes based on the priority of each node includes:

[0102] Add nodes with priorities to the priority node queue;

[0103] When the priority node queue is not empty, extracting a head node from the priority node queue, and recalculating the priority of the head node;

[0104] Determine whether the head node priority is higher than the current head node priority in the priority node queue;

[0105] If so, the head node of the team is shrunk.

[0106] Optionally, after obtaining the node priority, the node with the node priority can be pushed into the priority queue and arranged in order of priority from high to low. Then, it can be determined whether the priority queue is empty. If not, the head node of the priority queue, that is, the node with the highest priority, is popped out, and the priority of the head node is recalculated to determine whether the priority of the head node is higher than the priority of the current head node in the priority queue. If so, the head node is shrunk. If the priority queue is empty, the step of pushing the node with the node priority into the priority queue can be executed.

[0107] In an embodiment of the present application, updating the weight online graph based on the first compiled graph or the second compiled graph includes:

[0108] Clearing a cached online graph, and filling the cached online graph with the first compiled graph or the second compiled graph;

[0109] The filled cache online map and the corresponding weight online map are exchanged for addresses.

[0110] Optionally, the Buffer OnlineGraph can be cleared, and the first compiled graph data or the second compiled graph data (CompileGraph) can be transferred to the Buffer OnlineGraph. Then the addresses of the Buffer OnlineGraph and the corresponding weighted OnlineGraph can be exchanged, and the online path calculation uses the exchanged weighted OnlineGraph to make the closed opening data effective. Specifically, a temporary storage location, namely a buffer, can be created first, and the current reference to the OnlineGraph can be placed in the temporary storage for caching. Then, the reference to the compiled CompileGraph is assigned to the reference location originally used to point to the OnlineGraph, so that the subsequent access path related to the original OnlineGraph actually accesses the compiled CompileGraph, realizing the replacement of the data structure, so that subsequent operations such as online services can be based on the new compiled graph data.

[0111] It should be noted that in the above process, the Buffer OnlineGraph (the actual data is the corresponding weight OnlineGraph) cannot be cleared immediately, and a reference count needs to be maintained, because there are requests in the online service that are using this OnlineGraph data, and clearing it directly will cause path calculation errors. New requests will no longer read this OnlineGraph data, so the reference count will gradually become zero as the requests are completed, and the OnlineGraph data can be released at this time.

[0112] In the embodiment of the present application, there is no need to transmit data or load data into memory, and there will be no instability due to the offline environment and long process. It is not limited by whether the infrastructure is complete, and it saves offline machine resources and network resources. In addition, full compilation or fast compilation can be achieved according to the data flow of the closed opening data, and a small amount of closed opening data can be updated quickly to improve the experience of the calculation effect; at the same time, a large amount of data can be updated in the closed opening without increasing the calculation response time.

[0113] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0114] In one embodiment, an online compiling device is provided, and the online compiling device corresponds to the online compiling method in the above embodiment. Figure 2 As shown, the online compiling device includes an offline compiling unit 10, a fast compiling unit 20, a complete compiling unit 30 and a compiling completion unit 40. The functional modules are described in detail as follows:

[0115] An offline compiling unit 10 is used to compile offline the road network topology data and the corresponding weight data to obtain a weighted online graph, wherein the weighted online graph refers to CH graph data with different weights being stored in an online graph;

[0116] A fast compilation unit 20, configured to generate a first compilation graph of corresponding weights by a fast compilation strategy when the difference between the closed activation data and the closed activation backup data is less than a preset threshold;

[0117] A full compilation unit 30, configured to generate a second compilation graph of corresponding weights by a full compilation strategy when the difference between the closed activation data and the closed activation backup data is greater than or equal to the preset threshold;

[0118] The compilation completion unit 40 is configured to update the weight online map through the first compiled map or the second compiled map, so as to use the updated weight online map to validate the closed activation data.

[0119] In one embodiment of the present application, the offline compilation unit 10 is further used for:

[0120] Based on the road network topology data and corresponding weight data, generating an initial compiled graph;

[0121] Based on the initial compiled graph, determining the priority of each node;

[0122] Contracting nodes based on the priority of each node, and adding shortcut edges in the initial compiled graph during the contraction process to obtain a target compiled graph;

[0123] The target compiled graph is converted into an online graph to obtain the weighted online graph based on the online graph.

[0124] In one embodiment of the present application, the fast compiling unit 20 is further used for:

[0125] Based on the road network topology data and the penalty weights of the closed and opened data, an initial compiled graph is generated;

[0126] Construct a node contraction sequence based on the point sequence file generated by offline compilation;

[0127] The node contraction sequence is traversed, and a contraction process is performed on the current node. During the contraction process, a shortcut edge is added to the initial compiled graph to obtain the first compiled graph.

[0128] In one embodiment of the present application, the fast compiling unit 20 is further used for:

[0129] Determine the entry point and exit point of the current node;

[0130] Performing path calculation on the entry point and the exit point;

[0131] Based on the path calculation result, when an optimal path cannot be found or the current node is on the optimal path, a shortcut edge is added to the initial compiled graph.

[0132] In one embodiment of the present application, the complete compilation unit 30 is further configured to:

[0133] Based on the road network topology data and the penalty weights of the closed and opened data, an initial compiled graph is generated;

[0134] Based on the initial compiled graph, determining the priority of each node;

[0135] Contracting nodes based on the priority of each node, and adding shortcut edges in the initial compiled graph during the contraction process to obtain a new point sequence file;

[0136] The new point sequence file replaces the point sequence file generated by offline compilation to obtain the second compiled graph.

[0137] In one embodiment of the present application, the complete compilation unit 30 is further configured to:

[0138] Add nodes with priorities to the priority node queue;

[0139] When the priority node queue is not empty, extracting a head node from the priority node queue, and recalculating the priority of the head node;

[0140] Determine whether the head node priority is higher than the current head node priority in the priority node queue;

[0141] If so, the head node of the team is shrunk.

[0142] In one embodiment of the present application, the compiling completion unit 40 is further configured to:

[0143] Clearing a cached online graph, and filling the cached online graph with the first compiled graph or the second compiled graph;

[0144] The filled cache online map and the corresponding weight online map are exchanged for addresses.

[0145] In the embodiment of the present application, there is no need to transmit data or load data into memory, and there will be no instability due to the offline environment and long process. It is not limited by whether the infrastructure is complete, and it saves offline machine resources and network resources. In addition, full compilation or fast compilation can be achieved according to the data flow of the closed opening data, and a small amount of closed opening data can be updated quickly to improve the experience of the calculation effect; at the same time, a large amount of data can be updated in the closed opening without increasing the calculation response time.

[0146] For the specific definition of the online compilation device, please refer to the definition of the online compilation method above, which will not be repeated here. Each module in the above online compilation device can be implemented in whole or in part by software, hardware and their combination. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0147] In one embodiment, a computer device is provided. The computer device may be a terminal device, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a readable storage medium. The readable storage medium stores computer-readable instructions. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer-readable instructions are executed by the processor, an online compilation method is implemented. The readable storage medium provided in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.

[0148] In an embodiment of the present application, a computer device is provided, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the online compilation method described above when executing the computer-readable instructions.

[0149] In an embodiment of the application, a readable storage medium is provided, wherein the readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the online compilation method described above are implemented.

[0150] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through computer-readable instructions, and the computer-readable instructions can be stored in a non-volatile readable storage medium or a volatile readable storage medium. When the computer-readable instructions are executed, they may include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0151] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0152] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. An online compiling method, characterized in that: The method comprises: Based on the offline compilation of the road network topology data and the corresponding weight data, a weighted online graph is obtained, wherein the weighted online graph refers to the CH graph data with different weights being stored in an online graph; When the difference between the closed activation data and the closed activation backup data is less than a preset threshold, generating a first compilation graph of corresponding weights by a fast compilation strategy; When the difference between the closed activation data and the closed activation backup data is greater than or equal to the preset threshold, generating a second compilation graph of corresponding weights by a full compilation strategy; The weight online map is updated through the first compiled map or the second compiled map to use the updated weight online map to validate the closed activation data.

2. The online compiling method according to claim 1, characterized in that: The method of obtaining a weighted online graph based on offline compilation of the road network topology data includes: Based on the road network topology data and corresponding weight data, generating an initial compiled graph; Based on the initial compiled graph, determining the priority of each node; Contracting nodes based on the priority of each node, and adding shortcut edges in the initial compiled graph during the contraction process to obtain a target compiled graph; The target compiled graph is converted into an online graph to obtain the weighted online graph based on the online graph.

3. The online compiling method according to claim 1, characterized in that: The method of generating a first compilation graph corresponding to the weights by using a fast compilation strategy includes: Based on the road network topology data and the penalty weights of the closed and opened data, an initial compiled graph is generated; Construct a node contraction sequence based on the point sequence file generated by offline compilation; The node contraction sequence is traversed, and a contraction process is performed on the current node. During the contraction process, a shortcut edge is added to the initial compiled graph to obtain the first compiled graph.

4. The online compiling method according to claim 3, characterized in that: The shrinking process of the current node, and adding a shortcut edge in the initial compiled graph during the shrinking process, includes: Determine the entry point and exit point of the current node; Performing path calculation on the entry point and the exit point; Based on the path calculation result, when an optimal path cannot be found or the current node is on the optimal path, a shortcut edge is added to the initial compiled graph.

5. The online compiling method according to claim 1, wherein: The generating a second compilation graph corresponding to the weights by using a complete compilation strategy includes: Based on the road network topology data and the penalty weights of the closed and opened data, an initial compiled graph is generated; Based on the initial compiled graph, determining the priority of each node; Contracting nodes based on the priority of each node, and adding shortcut edges in the initial compiled graph during the contraction process to obtain a new point sequence file; The new point sequence file replaces the point sequence file generated by offline compilation to obtain the second compiled graph.

6. The online compiling method according to claim 5, characterized in that: The shrinking of nodes based on the priority of each node includes: Add nodes with priorities to the priority node queue; When the priority node queue is not empty, extracting a head node from the priority node queue, and recalculating the priority of the head node; Determine whether the head node priority is higher than the current head node priority in the priority node queue; If so, the head node of the team is shrunk.

7. The online compiling method according to claim 1, characterized in that: The updating of the weight online graph based on the first compiled graph or the second compiled graph includes: Clearing a cached online graph, and filling the cached online graph with the first compiled graph or the second compiled graph; The filled cache online map and the corresponding weight online map are exchanged for addresses.

8. An online compiling device, characterized in that: The device comprises: An offline compilation unit, used for offline compilation based on the road network topology data and the corresponding weight data to obtain a weighted online graph, wherein the weighted online graph refers to CH graph data with different weights being stored in an online graph; A fast compilation unit, configured to generate a first compilation graph of corresponding weights by a fast compilation strategy when a difference between the closed activation data and the closed activation backup data is less than a preset threshold; a full compilation unit, configured to generate a second compilation graph of corresponding weights by a full compilation strategy when a difference between the closed activation data and the closed activation backup data is greater than or equal to the preset threshold; The compilation completion unit is configured to update the weight online map through the first compiled map or the second compiled map, so as to use the updated weight online map to validate the closed activation data.

9. A computer device comprising a memory, a processor, and computer-readable instructions stored in the memory and executed on the processor, characterized in that: When the processor executes the computer-readable instructions, the online compiling method according to any one of claims 1 to 7 is implemented.

10. A readable storage medium having computer readable instructions stored thereon, characterized in that: When the computer-readable instructions are executed by a processor, the online compiling method according to any one of claims 1 to 7 is implemented.