Path planning method, electronic equipment, storage medium and computer program product
Through real -time characteristic data, real -time prediction path costs and dynamic calculation path costs solve the problem that the existing path planning method cannot effectively reflect the real -time road conditions, and achieve more accurate and adaptive path planning.
Patent Information
- Application Number
- CN202411441075.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-01-28
AI Technical Summary
The existing path planning methods cannot effectively reflect real-time road conditions and lack adaptability, especially in urban environments with rapid dynamic changes.
Through real -time characteristics data, real -time prediction path costs, dynamic calculation path costs, thereby reflecting the condition of the road in real time, and the nodes that choose the lowest path cost as the current node.
A more accurate path planning can be achieved, which can adapt to emergencies and rapidly changing traffic conditions, and improve the practicality and accuracy of path planning.
Smart Images

Figure CN119374620A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of vehicle-related technologies, and in particular to a path planning method, electronic equipment, storage medium and computer program product. Background Art
[0002] In existing traffic management systems, path planning usually relies on static data to calculate the shortest path from one point to another. The most commonly used algorithms include Dijkstra algorithm and A* algorithm, which mainly consider the distance and estimated time cost of the path when designed, and usually use pre-set, fixed road weights.
[0003] Among them, the Dijkstra algorithm is an algorithm for solving the single-source shortest path problem. It gradually expands the frontier and updates the shortest path estimate to each node until the shortest path to the destination is found. However, the main drawbacks of this method are:
[0004] 1. Static weights: The traditional Dijkstra algorithm uses static weights that are not adjusted according to real-time traffic conditions such as congestion, accidents, or weather changes. This causes the algorithm to be unable to effectively reflect current road conditions, and may result in the recommended route not being the optimal choice under real-time conditions.
[0005] 2. Lack of flexibility: Since the algorithm does not take into account changing environmental factors, such as special events or temporary road closures, its path planning results may not be the most effective, especially in a dynamic and rapidly changing urban environment. Summary of the invention
[0006] Based on this, it is necessary to provide a path planning method, electronic device, storage medium and computer program product to address the technical problems that the path planning of the existing technology cannot effectively reflect the road conditions and has poor adaptability.
[0007] The present invention provides a path planning method, comprising:
[0008] The source node is used to represent the starting position of the path, the destination node is used to represent the destination position of the path, and all other nodes are used to represent the positions passed by the path. The source node and all other nodes are initialized;
[0009] Take the source node as the current node and perform the following iterative operations:
[0010] Mark the current node as a processed node, mark neighbor nodes of the current node that are not marked as processed nodes as unprocessed nodes, and predict the path cost from the source node to the unprocessed node in real time through real-time feature data;
[0011] From all the unprocessed nodes, select the node with the lowest path cost as the current node, if the current node is the destination node, then end the iteration, otherwise continue to execute the next iteration;
[0012] After the iteration is finished, the path corresponding to the minimum path cost from the source node to the destination node is output.
[0013] Furthermore, the real-time prediction of the path cost from the source node to the unprocessed node by using the real-time feature data includes:
[0014] Through real-time feature data, the real-time road weight from the current node to each of the neighboring nodes is predicted in real time. For each of the neighboring nodes, the real-time road weight from the current node to the neighboring node is multiplied by the distance from the current node to the neighboring node, and then added to the minimum path cost from the source node to the current node to obtain the path cost from the source node to the neighboring node.
[0015] Furthermore, the real-time prediction of the real-time road weight from the current node to each of the neighboring nodes by using the real-time feature data includes:
[0016] For each neighbor node of the current node, real-time feature data on the road between the position represented by the current node and the position represented by the neighbor node is obtained, and the real-time feature data is input into the prediction model to obtain the real-time road weight returned by the prediction model.
[0017] Furthermore, the real-time prediction of the path cost from the source node to the unprocessed node by using the real-time feature data further includes:
[0018] Taking the processed nodes other than the current node as the remaining processed nodes;
[0019] Predicting in real time the real-time road weights from the remaining processed nodes to the adjacent unprocessed nodes through the real-time feature data;
[0020] For each adjacent unprocessed node of each remaining processed node, the real-time road weight from the remaining processed node to the unprocessed node is multiplied by the distance from the remaining processed node to the unprocessed node, and then added with the minimum path cost from the source node to the remaining processed nodes to obtain the path cost from the source node to the unprocessed node.
[0021] Furthermore, the real-time prediction of the real-time road weight from the remaining processed nodes to the adjacent unprocessed nodes by using the real-time feature data includes:
[0022] For each of the unprocessed nodes adjacent to the remaining processed nodes, real-time feature data on the road between the position represented by the remaining processed nodes and the position represented by the unprocessed node is obtained, and the real-time feature data is input into the prediction model to obtain the real-time road weight returned by the prediction model.
[0023] Furthermore, the method further includes: obtaining user selections, and using the user selections as real-time feature data.
[0024] Furthermore, the real-time characteristic data includes: real-time time period, real-time weather conditions, real-time traffic data, real-time special events and real-time road attributes.
[0025] The present invention provides an electronic device, comprising:
[0026] at least one processor; and,
[0027] a memory communicatively connected to at least one of the processors; wherein,
[0028] The memory stores instructions that can be executed by at least one of the processors. The instructions are executed by at least one of the processors to enable the at least one of the processors to perform the path planning method as described above.
[0029] The present invention provides a storage medium, wherein the storage medium stores computer instructions, and when a computer executes the computer instructions, it is used to execute all steps of the path planning method as described above.
[0030] The present invention provides a computer program product, comprising a computer program / instruction, which implements the path planning method as described above when executed by a processor.
[0031] In the path planning of the present invention, the path cost from the source node to the unprocessed node is predicted in real time through real-time feature data, and then the node with the lowest path cost is selected as the current node from all the unprocessed nodes. Therefore, the present invention can dynamically calculate the path cost based on the real-time feature data, thereby reflecting the road conditions in real time and providing more accurate path planning. At the same time, by updating the path cost in real time, it can adapt to emergencies and rapidly changing traffic conditions, and improve the practicality and accuracy of path planning. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A workflow diagram of a path planning method according to an embodiment of the present invention;
[0033] Figure 2 A workflow diagram of a path planning method according to another embodiment of the present invention;
[0034] Figure 3 A schematic diagram comparing the path cost of this embodiment with the path cost of the existing Dijkstra algorithm;
[0035] Figure 4 The figure is a schematic diagram of the hardware structure of an electronic device of the present invention. DETAILED DESCRIPTION
[0036] The specific embodiments of the present invention are further described below in conjunction with the accompanying drawings. The same components are represented by the same reference numerals. It should be noted that the words "front", "rear", "left", "right", "upper" and "lower" used in the following description refer to directions in the accompanying drawings, and the words "inner" and "outer" refer to directions toward or away from the geometric center of a specific component, respectively.
[0037] like Figure 1 The figure shows a workflow diagram of a path planning method according to an embodiment of the present invention, including:
[0038] Step S101, using a source node to represent the starting position of a path, using a destination node to represent the destination position of the path, using all other nodes to represent the positions that the path passes through, and initializing the source node and all other nodes;
[0039] Step S102: taking the source node as the current node, performing the following iterative operations:
[0040] Mark the current node as a processed node, mark neighbor nodes of the current node that are not marked as processed nodes as unprocessed nodes, and predict the path cost from the source node to the unprocessed node in real time through real-time feature data;
[0041] From all the unprocessed nodes, select the node with the lowest path cost as the current node, if the current node is the destination node, then end the iteration, otherwise continue to execute the next iteration;
[0042] Step S103: after the iteration ends, output the path corresponding to the minimum path cost from the source node to the destination node.
[0043] Specifically, the present invention can be applied to electronic devices with processing capabilities, such as a vehicle controller, or a cloud server.
[0044] The present invention directly applies the predicted path cost to the Dijkstra algorithm to realize the shortest path calculation of the real-time traffic management system. This dynamic adjustment method makes the path planning more accurate and practical.
[0045] First, step S101 is executed, where the source node is used to represent the starting position of the path, the destination node is used to represent the destination position of the path, and all other nodes are used to represent the positions passed by the path, and the source node and all other nodes are initialized.
[0046] Specifically, the position on the path is represented by a node, wherein the source node represents the starting position of the path, the destination node represents the destination position of the path, and all other nodes represent the positions passed by the path.
[0047] Then, initialize the source node and all other nodes.
[0048] Specifically, the path cost of the source node is set to 0, since its distance to itself is zero. The path costs of all other nodes are set to infinity, indicating that they are initially unreachable.
[0049] Then, step S102 is executed, the source node is used as the current node, and the following iterative operation is performed:
[0050] Mark the neighbor nodes of the current node that are not marked as processed nodes as unprocessed nodes, and predict the path cost from the source node to the unprocessed nodes in real time through real-time feature data;
[0051] From all the unprocessed nodes, a node with the lowest path cost is selected as the current node. If the current node is the destination node, the iteration is terminated; otherwise, the next iteration is continued.
[0052] Specifically, the source node is first used as the current node, and then an iterative operation is performed until the current node is selected as the destination node.
[0053] The iterative operations include:
[0054] Mark the current node as a processed node, mark neighbor nodes of the current node that are not marked as processed nodes as unprocessed nodes, and predict the path cost from the source node to the unprocessed node in real time through real-time feature data;
[0055] From all the unprocessed nodes, select the node with the lowest path cost as the current node. If the current node is the destination node, end the iteration, otherwise continue to the next iteration, mark the neighbor nodes of the current node that are not marked as processed nodes as unprocessed nodes again, and predict the path cost from the source node to the unprocessed node in real time through real-time feature data.
[0056] In each iteration, a current node is selected, and neighboring nodes of the current node that are not marked as processed nodes are marked as unprocessed nodes. In the next iteration, the unprocessed nodes marked by the previous iterations are retained. Therefore, from all the unprocessed nodes, the node with the lowest path cost is selected as the current node, including the unprocessed nodes marked by the current iteration and the unprocessed nodes marked by the previous iterations.
[0057] Then, the path cost from the source node to the unprocessed node is predicted in real time through the real-time feature data.
[0058] The path cost is predicted based on real-time feature data, so it can reflect road conditions and provide more accurate path planning. At the same time, since the path cost is updated in real time with each iteration, it can adapt to emergencies and rapidly changing traffic conditions, improving the practicality and accuracy of path planning.
[0059] Finally, after the iteration ends, step S103 is executed to output the path corresponding to the minimum path cost from the source node to the destination node.
[0060] Specifically, the minimum path cost from the source node to the destination node is obtained by adding the path costs of the nodes passed through. Therefore, when determining the minimum path cost from the source node to the destination node, the nodes required to generate the minimum path cost are obtained, and the nodes required to generate the minimum path cost are connected from the source node to the destination node, that is, the path corresponding to the minimum path cost from the source node to the destination node is obtained, and this path is the optimal path.
[0061] In the path planning of the present invention, the path cost from the source node to the unprocessed node is predicted in real time through real-time feature data, and then the node with the lowest path cost is selected as the current node from all the unprocessed nodes. Therefore, the present invention can dynamically calculate the path cost based on the real-time feature data, thereby reflecting the road conditions in real time and providing more accurate path planning. At the same time, by updating the path cost in real time, it can adapt to emergencies and rapidly changing traffic conditions, and improve the practicality and accuracy of path planning.
[0062] like Figure 2 The figure shows a workflow diagram of a path planning method in another embodiment of the present invention, including:
[0063] Step S201, using a source node to represent the starting position of the path, using a destination node to represent the destination position of the path, using all other nodes to represent the positions passed by the path, and initializing the source node and all other nodes.
[0064] Step S202: taking the source node as the current node, perform the following iterative operations:
[0065] Mark the current node as a processed node, mark the neighbor nodes of the current node that are not marked as processed nodes as unprocessed nodes, and predict the real-time road weight from the current node to each of the neighbor nodes in real time through real-time feature data. For each of the neighbor nodes, multiply the real-time road weight from the current node to the neighbor node by the distance from the current node to the neighbor node, and add the minimum path cost from the source node to the current node to obtain the path cost from the source node to the neighbor node. The real-time feature data includes: real-time time period, real-time weather conditions, real-time traffic data, real-time special events, and real-time road attributes;
[0066] From all the unprocessed nodes, a node with the lowest path cost is selected as the current node. If the current node is the destination node, the iteration is terminated; otherwise, the next iteration is continued.
[0067] In one embodiment, the real-time prediction of the real-time road weight from the current node to each of the neighboring nodes by using the real-time feature data includes:
[0068] For each neighbor node of the current node, real-time feature data on the road between the position represented by the current node and the position represented by the neighbor node is obtained, and the real-time feature data is input into the prediction model to obtain the real-time road weight returned by the prediction model.
[0069] In one embodiment, the real-time prediction of the path cost from the source node to the unprocessed node by using the real-time feature data further includes:
[0070] Taking the processed nodes other than the current node as the remaining processed nodes;
[0071] Predicting in real time the real-time road weights from the remaining processed nodes to the adjacent unprocessed nodes through the real-time feature data;
[0072] For each adjacent unprocessed node of each remaining processed node, the real-time road weight from the remaining processed node to the unprocessed node is multiplied by the distance from the remaining processed node to the unprocessed node, and then added with the minimum path cost from the source node to the remaining processed nodes to obtain the path cost from the source node to the unprocessed node.
[0073] In one embodiment, the real-time prediction of the real-time road weight from the remaining processed nodes to the adjacent unprocessed nodes by using the real-time feature data includes:
[0074] For each of the unprocessed nodes adjacent to the remaining processed nodes, real-time feature data on the road between the position represented by the remaining processed nodes and the position represented by the unprocessed node is obtained, and the real-time feature data is input into the prediction model to obtain the real-time road weight returned by the prediction model.
[0075] In one of the embodiments, the method further includes: obtaining user selection and using the user selection as real-time feature data.
[0076] Step S203: after the iteration ends, output the path corresponding to the minimum path cost from the source node to the destination node.
[0077] Specifically, this embodiment is an improvement on the Dijkstra algorithm.
[0078] First, step S201 is executed, where the source node is used to represent the starting position of the path, the destination node is used to represent the destination position of the path, and all other nodes are used to represent the positions passed by the path, and the source node and all other nodes are initialized.
[0079] Specifically, the position on the path is represented by a node, wherein the source node represents the starting position of the path, the destination node represents the destination position of the path, and all other nodes represent the positions passed by the path.
[0080] Then, initialize the source node and all other nodes.
[0081] Step S201 is to initialize the algorithm
[0082] Objective: Prepare the starting conditions for the algorithm, including setting the initial path cost to the source node and the path costs to all other nodes.
[0083] Method: Set the path cost of the source node to 0, since its distance to itself is zero. Set the path costs of all other nodes to infinity, indicating that they are unreachable at the beginning.
[0084] d[s]=0 (s is the source node)
[0085] d[v] = ∞ (for all other nodes v)
[0086] Then, step S202 is executed, the source node is used as the current node, and the following iterative operations are performed:
[0087] Mark the current node as a processed node, mark the neighbor nodes of the current node that are not marked as processed nodes as unprocessed nodes, and predict the real-time road weight from the current node to each of the neighbor nodes in real time through real-time feature data. For each of the neighbor nodes, multiply the real-time road weight from the current node to the neighbor node by the distance from the current node to the neighbor node, and add the minimum path cost from the source node to the current node to obtain the path cost from the source node to the neighbor node. The real-time feature data includes: real-time time period, real-time weather conditions, real-time traffic data, real-time special events, and real-time road attributes;
[0088] From all the unprocessed nodes, a node with the lowest path cost is selected as the current node. If the current node is the destination node, the iteration is terminated; otherwise, the next iteration is continued.
[0089] Specifically, step S202 first takes the source node as the current node, and then performs an iterative operation until the current node is selected as the destination node. The iterative operation includes: step one, step two, and step three.
[0090] Step 1: Update the path cost estimates of neighboring nodes
[0091] Specifically, in each iteration, a current node is selected, and neighbor nodes of the current node that are not marked as processed nodes are marked as unprocessed nodes. In the next iteration, the unprocessed nodes marked by the previous iterations are retained. Therefore, from all the unprocessed nodes, the node with the lowest path cost is selected as the current node, including the unprocessed nodes marked by the current iteration and the unprocessed nodes marked by the previous iterations.
[0092] In this embodiment, the path cost of the neighboring node is updated. The real-time road weight from the current node to each of the neighboring nodes is predicted in real time through the real-time feature data.
[0093] In one embodiment, the real-time prediction of the real-time road weight from the current node to each of the neighboring nodes by using the real-time feature data includes:
[0094] For each neighbor node of the current node, real-time feature data on the road between the position represented by the current node and the position represented by the neighbor node is obtained, and the real-time feature data is input into the prediction model to obtain the real-time road weight returned by the prediction model.
[0095] Specifically, the random forest regression model can be used as a prediction model to predict the road weight. For each neighbor node v of the current node u, the random forest regression model is called to predict the real-time road weight from the current node u to the neighbor node v based on a set of real-time feature data (such as time, weather, traffic flow, etc.).
[0096] Among them, the input features of the prediction model may include:
[0097] Current time period (e.g., peak or off-peak)
[0098] Weather conditions (sunny, rainy, snowstorm, etc.)
[0099] Real-time traffic data (road congestion, traffic volume)
[0100] Special events (such as traffic accidents, road construction)
[0101] Road attributes (e.g. road width, speed limit)
[0102] Predicted real-time road weight w uv It will be used as the edge weight from the current node u to the neighbor node v in the Dijkstra algorithm.
[0103] Then, calculate the new path cost from the source node to the neighbor node v of the current node u:
[0104] New path cost calculation formula:
[0105] d[v]=d[u]+w uv ×L uv
[0106] Where d[u] is the shortest path cost from the source node to the current node u, and w uv is the real-time road weight from node u to node v predicted by the prediction model, L uv is the path length from the current node u to the neighboring node v.
[0107] Finally, compare the new path cost to the existing path cost:
[0108] If the new path cost d[v] is less than the currently known d[v], update d[v] and set the predecessor node of node v to the current node u.
[0109] For the current node u, traverse all its neighboring nodes v and calculate the new path cost to reach v through u.
[0110] Each time a neighbor node is updated, the system calls the prediction model to predict the weight of the current road in real time. This dynamic adjustment ensures that the Dijkstra algorithm can flexibly update the path calculation results based on the current traffic conditions and environmental factors. Each re-estimation of the edge weight reflects the latest road information, allowing the path planning system to play a greater role in real-time traffic management.
[0111] In this embodiment, the path cost of the neighboring nodes is updated. In another embodiment, in addition to updating the path cost of the neighboring nodes, the path cost of other unprocessed nodes is also updated.
[0112] In one embodiment, the real-time prediction of the path cost from the source node to the unprocessed node by using the real-time feature data further includes:
[0113] Taking the processed nodes other than the current node as the remaining processed nodes;
[0114] Predicting in real time the real-time road weights from the remaining processed nodes to the adjacent unprocessed nodes through the real-time feature data;
[0115] For each adjacent unprocessed node of each remaining processed node, the real-time road weight from the remaining processed node to the unprocessed node is multiplied by the distance from the remaining processed node to the unprocessed node, and then added with the minimum path cost from the source node to the remaining processed nodes to obtain the path cost from the source node to the unprocessed node.
[0116] Specifically, for the current node, the new path cost from the source node to the neighbor node v of the current node u is calculated. For the processed nodes other than the current node, the remaining processed nodes u' are used as the new path cost from the source node to the unprocessed node v' adjacent to the remaining processed nodes u' is calculated:
[0117] New path cost calculation formula:
[0118] d[v']=d[u']+w u'v' ×L u'v'
[0119] Where d[u'] is the shortest path cost from the source node to the remaining processed nodes u', w u'v' is the real-time road weight from node u' to node v' predicted by the prediction model, L u’v’ is the path length from the current node u' to the neighboring node v'.
[0120] If the new path cost d[v'] is less than the currently known d[v'], then update d[v'] and set the predecessor of node v' to the remaining processed node u'.
[0121] This embodiment adds the path cost update of the unprocessed nodes adjacent to the remaining processed nodes other than the current node. For the processed nodes, they have been compared, so there is no need to update the path cost. However, the unprocessed nodes adjacent to the remaining processed nodes are nodes that may be selected. These unprocessed nodes need to be compared with the neighboring nodes of the current node. Therefore, in this embodiment, the path cost of these nodes is also updated to ensure that the path cost of the compared nodes can reflect the latest road information, so that the path planning system can play a greater role in real-time traffic management.
[0122] In one embodiment, the real-time prediction of the real-time road weight from the remaining processed nodes to the adjacent unprocessed nodes by using the real-time feature data includes:
[0123] For each of the unprocessed nodes adjacent to the remaining processed nodes, real-time feature data on the road between the position represented by the remaining processed nodes and the position represented by the unprocessed node is obtained, and the real-time feature data is input into the prediction model to obtain the real-time road weight returned by the prediction model.
[0124] Specifically, the random forest regression model can be used as a prediction model to predict the road weight. For each adjacent unprocessed node v' of the remaining processed node u', the random forest regression model is called to predict the real-time road weight from the remaining processed node u' to the adjacent unprocessed node v' based on a set of real-time feature data (such as time, weather, traffic flow, etc.).
[0125] Among them, the input features of the prediction model may include:
[0126] Current time period (e.g., peak or off-peak)
[0127] Weather conditions (sunny, rainy, snowstorm, etc.)
[0128] Real-time traffic data (road congestion, traffic volume)
[0129] Special events (such as traffic accidents, road construction)
[0130] Road attributes (e.g. road width, speed limit)
[0131] Predicted real-time road weight w u'v' It will be used as the edge weight from the remaining processed node u' to the adjacent unprocessed node v' in the Dijkstra algorithm.
[0132] Step 2: Select the next node to process
[0133] Goal: Select the node with the lowest cost estimate from all unprocessed nodes as the node to be processed next.
[0134] Method: Among all unprocessed nodes, select the node with the minimum path cost as the next processing node, and take the node to be processed next as the current node.
[0135] Step 3: Repeat the update and selection process
[0136] Target: Repeat steps 1 and 2 until the target node is the next processing node.
[0137] Method: Continue the iterative process, constantly updating the node cost and selecting the next node until the target node is the next processing node.
[0138] As an example, if the real-time road weight from node B to node C is 2.5, and d[B] = 3, then calculate the new value of d[C]. The new path cost is d[B] + w (B,C) =3+2.5=5.5. Since d[C] is initialized to infinity, update d[C] to 5.5 and set the predecessor node of C to B.
[0139] like Figure 3 The figure shows the path cost comparison between the present embodiment and the existing Dijkstra algorithm. The figure shows the difference in the effects of different algorithms under dynamic weight adjustment by comparing the path costs of the original Dijkstra (blue column 31) and the real-time optimized Dijkstra (orange column 32) of the present embodiment at nodes A, B, C, D, and E. It can be seen that the path cost of the real-time optimized Dijkstra of the present embodiment is significantly lower than the path cost of the existing Dijkstra algorithm.
[0140] Finally, after the iteration ends, step S203 is executed to output the path corresponding to the minimum path cost from the source node to the destination node.
[0141] This embodiment dynamically adjusts road weights using real-time data (such as traffic flow, weather conditions, and special events) to more accurately reflect current road conditions and update shortest path calculations in real time. The prior art uses a static weight system that cannot adapt to rapidly changing traffic conditions, while this embodiment uses a machine learning prediction model that can analyze and predict road weights in real time, so that the path planning system can respond to traffic changes in a timely manner, avoid congestion and accident-prone areas, and reduce travel time and costs. At the same time, this embodiment enables the path planning system to respond to emergencies (such as traffic accidents or extreme weather) and automatically adjust routes to avoid affected areas. The path planning algorithms of the prior art usually rely on preset, fixed weights and lack the ability to respond to real-time changes. The machine learning prediction model in this embodiment can integrate a variety of real-time data to provide more flexible and adaptable path selection, thereby improving the efficiency and safety of the entire transportation system.
[0142] In one of the embodiments, the method further includes: obtaining user selection and using the user selection as real-time feature data.
[0143] Specifically, user selections are added as feature data during training, and then during actual prediction, user selections are used as real-time feature data.
[0144] Among them, user selection includes: user preferences and other key factors such as energy consumption, tolls, etc.
[0145] In addition to considering time and distance, this embodiment can also optimize the route based on user preferences and other key factors (such as energy consumption and tolls). The flexibility of the machine learning prediction model and the powerful data processing capabilities enable this embodiment to integrate and process complex data inputs and achieve multi-objective optimization.
[0146] In some embodiments, it also includes: using historical data to train the prediction model.
[0147] Specifically, the training steps include:
[0148] Step 1: Data Preparation
[0149] Objective: Collect and prepare data for training machine learning models, ensuring data quality and suitability.
[0150] Methods: Data were obtained from urban traffic systems, meteorological data, and special event records. All feature data were cleaned, missing values were processed, and normalized to be on the same scale to ensure that the model can be correctly interpreted.
[0151] Among them, the data needs to be preprocessed: the numerical features are Z-score standardized so that their mean is 0 and the standard deviation is 1.
[0152] Step 2: Feature Selection
[0153] Objective: To select the most influential features for model prediction of road weight from possible candidate features.
[0154] Methods: A model-based feature importance assessment method (built-in random forest) is used to select those features that contribute most to the model’s prediction of road weight.
[0155] Feature Importance: The feature importance scores of prediction models (e.g., random forest models) revealed that time and weather conditions are the most critical factors affecting road weights.
[0156] Step 3: Model training
[0157] Objective: Based on the selected features, predict the road weight using a prediction model. Preferably, a random forest regression model is used.
[0158] Methods: The random forest model was configured to contain 100 decision trees, and each tree was trained using a different data sample and feature subset to improve the generalization ability of the model. The model was trained on 80% of the training data, and 20% of the data was used to verify the model performance.
[0159] Specifically, the prediction model adjusts the road weights according to external conditions.
[0160] For example, during peak hours, if the traffic volume on a road increases, the model will increase the weight of the road to reflect the congestion; during non-peak hours, if the traffic volume decreases, the weight will decrease accordingly.
[0161] In addition, when emergencies occur, such as traffic accidents, road construction, etc., the prediction model will also adjust the weights of related roads.
[0162] For example, if an accident occurs on a certain road, the model will significantly increase the weight of that road based on the incident, thereby guiding the algorithm to avoid that section of road.
[0163] Finally, in some cases, users may want to re-plan their routes based on specific needs (such as saving time, reducing congestion), and the prediction model can also adjust road weights based on user needs.
[0164] For example: If a user chooses the option to avoid congested routes, the system will adjust the weights of relevant roads based on real-time traffic conditions and user preferences.
[0165] Step 4: Model evaluation and optimization
[0166] Goal: Ensure that the model achieves optimal predictive performance and make any necessary adjustments to the model.
[0167] Method: The mean square error (MSE) and the coefficient of determination (R 2 ) as the main evaluation metric. If the performance is not satisfactory, consider increasing the number of decision trees or adjusting the maximum tree depth.
[0168]
[0169] Among them, y true is the actual road weight, y predicted is the road weight predicted by the model, and n is the number of road weights.
[0170] Performance evaluation: R of the model on an independent test set 2 The value reaches 0.85 and the MSE is 0.05, showing a high prediction accuracy.
[0171] 3. Single objective: Traditional algorithms usually only consider the minimization of time or distance, ignoring other possible path selection factors such as energy consumption, cost or user preference.
[0172] It should be understood that the order of execution of the steps in the above embodiment does not necessarily 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 embodiment of the present invention.
[0173] like Figure 4 The figure shows a hardware structure diagram of an electronic device of the present invention, including:
[0174] at least one processor 401; and,
[0175] A memory 402 is communicatively connected to at least one of the processors 401; wherein,
[0176] The memory 402 stores instructions that can be executed by at least one of the processors. The instructions are executed by at least one of the processors so that the at least one of the processors can perform the path planning method as described above.
[0177] Figure 4 A processor 401 is taken as an example.
[0178] The electronic device may further include: an input device 403 and a display device 404 .
[0179] The processor 401, the memory 402, the input device 403 and the display device 404 may be connected via a bus or other means, and the figure takes the connection via a bus as an example.
[0180] The memory 402 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the path planning method in the embodiment of the present application, for example, Figure 1 , Figure 2 The processor 401 executes various functional applications and data processing by running the non-volatile software programs, instructions and modules stored in the memory 402, that is, the path planning method in the above embodiment is implemented.
[0181] The memory 402 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of the path planning method, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 402 may optionally include a memory remotely arranged relative to the processor 401, and these remote memories may be connected to the device for executing the path planning method via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0182] The input device 403 can receive user clicks and generate signal inputs related to user settings and function controls of the path planning method. The display device 404 can include display devices such as a display screen.
[0183] The one or more modules are stored in the memory 402 and when executed by the one or more processors 401 , the path planning method in any of the above method embodiments is executed.
[0184] In the path planning of the present invention, the path cost from the source node to the unprocessed node is predicted in real time through real-time feature data, and then the node with the lowest path cost is selected as the current node from all the unprocessed nodes. Therefore, the present invention can dynamically calculate the path cost based on the real-time feature data, thereby reflecting the road conditions in real time and providing more accurate path planning. At the same time, by updating the path cost in real time, it can adapt to emergencies and rapidly changing traffic conditions, and improve the practicality and accuracy of path planning.
[0185] An embodiment of the present invention provides a storage medium, wherein the storage medium stores computer instructions. When a computer executes the computer instructions, the storage medium is used to execute all steps of the path planning method as described above.
[0186] In the context of the present disclosure, a storage medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or apparatus. The storage medium may be a machine-readable signal medium or a machine-readable storage medium. Alternatively, the storage medium may be a non-temporary computer-readable storage medium, for example, a non-temporary computer-readable storage medium may be a ROM, a random access memory (Random Access Memory, RAM), a compact disc read-only memory (Compact Disc ROM, CD-ROM), a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0187] An embodiment of the present invention provides a computer program product, including a computer program / instruction, which implements the path planning method as described above when executed by a processor.
[0188] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A path planning method, characterized in that: include: The source node is used to represent the starting position of the path, the destination node is used to represent the destination position of the path, and all other nodes are used to represent the positions passed by the path. The source node and all other nodes are initialized; Take the source node as the current node and perform the following iterative operations: Mark the current node as a processed node, mark neighbor nodes of the current node that are not marked as processed nodes as unprocessed nodes, and predict the path cost from the source node to the unprocessed node in real time through real-time feature data; From all the unprocessed nodes, select the node with the lowest path cost as the current node, if the current node is the destination node, then end the iteration, otherwise continue to execute the next iteration; After the iteration is finished, the path corresponding to the minimum path cost from the source node to the destination node is output.
2. The path planning method according to claim 1, characterized in that: The real-time prediction of the path cost from the source node to the unprocessed node by using the real-time feature data includes: Through real-time feature data, the real-time road weight from the current node to each of the neighboring nodes is predicted in real time. For each of the neighboring nodes, the real-time road weight from the current node to the neighboring node is multiplied by the distance from the current node to the neighboring node, and then added to the minimum path cost from the source node to the current node to obtain the path cost from the source node to the neighboring node.
3. The path planning method according to claim 2, characterized in that: The real-time prediction of the real-time road weight from the current node to each of the neighboring nodes by using the real-time feature data includes: For each neighbor node of the current node, real-time feature data on the road between the position represented by the current node and the position represented by the neighbor node is obtained, and the real-time feature data is input into the prediction model to obtain the real-time road weight returned by the prediction model.
4. The path planning method according to claim 2, characterized in that: The method of predicting the path cost from the source node to the unprocessed node in real time by using the real-time feature data further includes: Taking the processed nodes other than the current node as the remaining processed nodes; Predicting in real time the real-time road weights from the remaining processed nodes to the adjacent unprocessed nodes through the real-time feature data; For each adjacent unprocessed node of each remaining processed node, the real-time road weight from the remaining processed node to the unprocessed node is multiplied by the distance from the remaining processed node to the unprocessed node, and then added with the minimum path cost from the source node to the remaining processed nodes to obtain the path cost from the source node to the unprocessed node.
5. The path planning method according to claim 4, characterized in that: The real-time prediction of the real-time road weight from the remaining processed nodes to the adjacent unprocessed nodes by using the real-time feature data includes: For each of the unprocessed nodes adjacent to the remaining processed nodes, real-time feature data on the road between the position represented by the remaining processed nodes and the position represented by the unprocessed node is obtained, and the real-time feature data is input into the prediction model to obtain the real-time road weight returned by the prediction model.
6. The path planning method according to claim 3 or 5, characterized in that: Also includes: The user selection is obtained and used as real-time feature data.
7. The path planning method according to claim 1, characterized in that: The real-time characteristic data includes: real-time time period, real-time weather conditions, real-time traffic data, real-time special events and real-time road attributes.
8. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to at least one of the processors; wherein, The memory stores instructions that can be executed by at least one of the processors, and the instructions are executed by at least one of the processors to enable at least one of the processors to execute the path planning method according to any one of claims 1 to 7.
9. A storage medium, characterized in that: The storage medium stores computer instructions, and when a computer executes the computer instructions, it is used to execute all steps of the path planning method according to any one of claims 1 to 7.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the path planning method as claimed in any one of claims 1 to 7 is implemented.