A terminal delivery route planning method for new customers entering the market in two stages
Through the two-stage entry method, new customers are quickly inserted and the distance matrix is updated, which solves the problem of new customers entering the entry in a large-scale customer group and realizes the scientificity and efficiency of path planning.
Patent Information
- Application Number
- CN202211333862.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-28
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-10-28
AI Technical Summary
The existing logistics and distribution systems are difficult to quickly respond to emergency orders from new customers in large-scale customer groups, and the existing algorithms lack scientificity and optimization in handling new customers' entry, resulting in unreasonable delivery paths.
The two-stage inbound method is adopted. The first stage is to quickly respond to new customers' emergency orders and insert the initial delivery sequence using the fast insertion point algorithm; the second stage is to update the distance matrix after the new customers are fixed, and the optimal delivery sequence is solved using an improved genetic algorithm.
It realizes reasonable path planning to quickly respond to new customers in a large-scale customer group, ensures the scientificity and efficiency of path optimization, and provides support for dynamic path planning.
Smart Images

Figure CN115689431B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of route planning and relates to a terminal delivery route planning method for two-stage entry of new customers. Background Art
[0002] In recent years, the increasing popularity of network technology and the rapid rise of e-commerce have generated enormous demand for logistics, transportation, and distribution, dramatically increasing the pressure on delivery terminals. Terminal logistics companies face a massive customer base, but due to the limitations of current computer hardware, dynamic calculations on large amounts of data are not possible. For tens of thousands of scattered customers, it's difficult to directly use the Vehicle-Resource Plan (VRP) algorithm to find the optimal delivery route. Therefore, it's necessary to divide all customers into regions. Most companies first solidify customer routes by administrative district, then implement comprehensive optimization within each region to determine the delivery route with the lowest cost, under scientific and feasible conditions.
[0003] Regarding algorithms for solving vehicle routing problems, exact algorithms can usually be used directly for smaller problems. However, when the number of customers reaches a certain scale, heuristic algorithms become necessary. Currently, the most commonly used algorithms include genetic algorithms, ant colony algorithms, particle swarm algorithms, simulated annealing algorithms, and tabu search algorithms. Genetic algorithms are well-established for use in vehicle routing problems, and numerous researchers have improved upon them. This is due to their earlier introduction and encoding methods, which are well-suited for solving vehicle routing problems. However, the variable neighborhood search algorithm, due to its relatively recent development, has been less widely used for solving vehicle routing problems. However, it exhibits excellent performance and strong optimization capabilities. Because single heuristic algorithms often have their own limitations, some researchers are combining the strengths of multiple heuristic algorithms, employing different algorithms in phases to solve vehicle routing problems.
[0004] Existing research primarily focuses on optimizing delivery routes for a few dozen customers. Few studies comprehensively consider delivery timelines and customer needs across tens of thousands of customers, nor do they consider the needs of individual customers. Most existing logistics and delivery algorithms only consider static route planning, which involves finding the shortest path among multiple fixed customer points. Only a few consider dynamic route planning, but these algorithms simply merge new customers into the route belonging to the customer point closest to the existing delivery route. This can lead to a growing number of customers on a particular route, further deviating from the original route. In real-world delivery, companies face a large customer base, with new customers constantly joining. Some customers place orders quickly, requiring urgent delivery. Existing systems struggle to handle the dynamic route planning that responds to the onboarding of new customers. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to provide a terminal delivery path planning method for new customers entering the line in two stages, and to plan a reasonable and efficient delivery route when a new customer at the express terminal enters the system. If a new customer places an urgent order after joining the system, it is considered to have entered the first stage, and it is necessary to quickly respond and output the urgent customer order delivery sequence. After all the original customers form the initial delivery sequence, the belonging line of each new customer is found through rule limitation, and then the fast insertion method is used to insert it into the initial delivery sequence to form the final delivery sequence. The delivery sequence at this stage is the optimal decision made in consideration of timeliness; if the new customer does not place an urgent order after joining the system, it is considered to have entered the second stage. After determining the line to which it belongs, the line distance matrix can be updated, and the genetic algorithm can be used again for solution. The delivery sequence obtained at this stage is better, and the database after updating the line distance matrix can provide more scientific data information for the next route planning.
[0006] In order to achieve the above object, the present invention provides the following technical solutions:
[0007] A method for planning terminal delivery routes for new customers entering the market in two stages includes the following steps:
[0008] S1: Call the map API to obtain the distance matrix of each delivery route in the original database SQL;
[0009] S2: Construct a terminal logistics vehicle routing optimization model and use an improved genetic algorithm to solve the initial delivery sequence;
[0010] S3: Query the route database to determine whether there are new customers in the order;
[0011] S4: Design rules to assign all new customers in the order to different lines according to the rules;
[0012] S5: Use the fast insertion point algorithm to insert the new customer into the route in step S4 and output the final delivery sequence of the route planning;
[0013] S6: Update the distance matrix of the line corresponding to the new user during idle time to obtain a new distance matrix in the original database SQL;
[0014] S7: Use the improved genetic algorithm in S2 again to solve the optimal delivery sequence.
[0015] Furthermore, the original database SQL stores the customer name, customer ID, address, latitude and longitude, and route information of all previous customers, which clearly and fixedly divides customers into routes. The process of calling the map API to obtain the distance matrix of each delivery route in the original database SQL is as follows:
[0016] S11: Read the order information. For the original terminal delivery customers, directly determine which route they belong to based on the route database;
[0017] S12: Query the database and call the distance matrix containing the warehouse and all customer points on each route originally built, and extract the distance matrix LineDistanceMat of the customer points contained in the order by route, and use it as the data input of the improved genetic algorithm; when a new terminal delivery customer joins the line or the original customer changes, a new distance matrix LineDistanceMat' is generated.
[0018] Each route has a distance matrix (LineDistanceMat) containing all customers and warehouses. However, in practice, not every customer on each route will place an order. Therefore, each time an order is generated, only the distance matrix (DistanceMat) between a subset of customers and warehouses is retrieved as data input for the optimization algorithm. Furthermore, due to the large number of end-point delivery customers, the algorithm needs to maintain a fixed delivery route for smooth calculations. However, customer fluctuations may occur within each route, so the system should promptly add new customers and remove lapsed customers to provide data support for the next round of route optimization algorithms.
[0019] Furthermore, in step S2, the overall optimization objective is to minimize the transport distance for each route. Constraints include truck driver work hours, vehicle capacity, no maximum distance limit, ensuring that each customer point is served only once, and that delivery vehicles depart from and return to the warehouse. When solving the problem, the nearest neighbor method and insertion method are used to generate an initial solution, and then an improved genetic algorithm is used to determine the optimal delivery path.
[0020] Furthermore, step S3 queries the line database to determine whether there is a new customer in the order, specifically including the following steps:
[0021] S31: When reading order information, if a customer point is found that is not marked in the database, that is, does not exist in any delivery route, it is considered as a new customer;
[0022] S32: Obtain the latitude and longitude information of the new customer and add it to the daily new customer list, recording the customer information, including customer ID, address, longitude and latitude, order volume and new customer joining time;
[0023] S33: Classify the new customers one by one and insert them into the initial delivery sequence described in step S2 according to certain rules.
[0024] Furthermore, the rules in step S4 include:
[0025] Rule 1: Select routes for new customers based on their distance from each route cluster center in ascending order. That is, the route to which the new customer belongs is determined by the route cluster center whose longitude and latitude have the smallest Euclidean distance.
[0026] Rule 2: Select multiple points closest to the new customer from the original customer list, calculate which route has the most points among these original customer points, and assign the new customer to that route;
[0027] Rule 3: The new customer will be merged into the line of the existing customer point closest to the new customer point;
[0028] Under each rule, the three most qualified lines are selected as alternative options for new customer entry, and then the one with the highest repetition rate is selected as the final entry option for the new customer point. If there is no repetition, the new customer will be merged into the line belonging to the point closest to him.
[0029] Furthermore, the K-center clustering algorithm is used to calculate the cluster center LineCenter of all customers on each line. The calculation method is:
[0030]
[0031] Each divided delivery route is regarded as a data set X. Each data set has a center point, that is, K = 1. The longitude and latitude of customers on each delivery route form multiple coordinate points on the map, that is, there are n data points. The cluster center of each iteration is represented by the set m; after clustering, the sum of the squares of the differences from all data points to this cluster center is represented by D, that is, the cluster sum of squares. The clustering goal is to minimize the D value and obtain the center coordinate point C* on each route, that is, the longitude and latitude coordinates of the cluster center point.
[0032] Furthermore, the K-medoid clustering algorithm specifically includes the following steps:
[0033] (1) For each data set X, the number of clusters is determined to be K = 1;
[0034] (2) Select one point in all data sets as the center point of each cluster;
[0035] (3) Calculate the distances from all other points to this center point, and take the cluster with the shortest distance from each point to this center point as the cluster to which it belongs;
[0036] (4) Select a point in each cluster in order, calculate the sum of the distances D between the point and all the points in the current cluster, and the point with the smallest sum of distances is considered the new center point;
[0037] (5) Repeat steps (2) and (3) until the center point of each cluster no longer changes, and obtain the sum of the squares of the differences between all data points and this cluster center D*, and its corresponding C* is the final cluster center.
[0038] The K-center clustering algorithm calculates the point with the smallest sum of distances from a certain point to all other points. By calculating the shortest sum of distances, the influence of some isolated data on the clustering process can be reduced, making the final effect closer to the real division.
[0039] Furthermore, in step S5, the route closest to the cluster center is inserted using a fast insertion point algorithm, and the final result of the path planning is output. The specific steps are:
[0040] S51: Adjust the initial delivery sequence of all original customers obtained in step S2, assign new customers to different routes, and update the delivery sequence and delivery mileage;
[0041] S52: Add time and load capacity restrictions, select the line to which the new customer is inserted according to the rules described in step S4, calculate the two points closest to the new customer on the line, and insert the new customer into the two adjacent points;
[0042] S53: Directly use the Euclidean mileage between the point and the two previous and next delivery customer points as the actual mileage, update the local distance matrix, and then output the final delivery sequence and delivery mileage.
[0043] Furthermore, in step S6, based on the new customer information table every day, the distance matrix is regularly updated, the update cycle and the specific update time are set, and the customers who have not updated are scanned in sequence according to the database. For each customer A who has not updated, the following processing is performed:
[0044] S61: According to the original database, the three routes L1, L2 and L3 associated with A are traversed in sequence to check the distance between A and other points on the L* route;
[0045] S62: Count all points of a certain line L* consulted by A. If all points are covered, it means that all distance data have been downloaded, and the update status in the database is updated; if not all points are covered, it means that the update is unsuccessful, and the database is not updated.
[0046] Furthermore, if the new customer does not place an urgent order after joining the system, then after updating the distance matrix LineDistanceMat' of the lines to which all new customers in the order belong in step S6, the improved genetic algorithm in S2 is used again to solve the problem. At this time, the delivery sequence obtained is better.
[0047] The beneficial effects of the present invention are:
[0048] 1. When facing a large customer base with new customers, terminal logistics companies can respond quickly in the first stage and obtain reasonable route planning results.
[0049] 2. When a new customer joins the system and does not place an urgent order, it is considered to have entered the second stage, and its scientific nature is fully considered to obtain the optimal delivery sequence.
[0050] 3. After a new customer is fixed on a certain route, updating the distance matrix of the route at leisure time can provide support for the next round of route optimization.
[0051] Other advantages, objects, and features of the present invention will be described in part in the following description and, in part, will be apparent to those skilled in the art upon examination of the following description or may be learned from practice of the present invention. The objects and other advantages of the present invention may be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below with reference to the accompanying drawings, in which:
[0053] Figure 1 Flowchart of the last-mile delivery route planning method for two-stage onboarding of new customers. DETAILED DESCRIPTION
[0054] The following describes the embodiments of the present invention by means of specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0055] Among them, the accompanying drawings are only for illustrative purposes and represent only schematic diagrams rather than actual pictures, and should not be understood as limiting the present invention. In order to better illustrate the embodiments of the present invention, some parts of the accompanying drawings may be omitted, enlarged or reduced, and do not represent the dimensions of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions may be omitted in the accompanying drawings.
[0056] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if there are terms such as "upper", "lower", "left", "right", "front", "back", etc. indicating directions or positional relationships, they are based on the directions or positional relationships shown in the drawings. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operate in a specific direction. Therefore, the terms describing the positional relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0057] According to one aspect of the present invention, a terminal delivery path planning method for two-stage entry of new customers is provided. The method quickly outputs the optimal path based on the consideration of the entry of new customers, takes into account the scientific rationality and rapid responsiveness of path optimization, and solves the problem that the existing planned path is unscientific with the entry of new customers.
[0058] Example 1: Figure 1 As shown, a method for planning the terminal delivery route for a new customer entering the market in two stages includes but is not limited to the following steps:
[0059] S1: Call the map API to obtain the distance matrix LineDistanceMat of each delivery route in the original database SQL;
[0060] S2: Construct a terminal logistics vehicle routing optimization model and use an improved genetic algorithm to solve the initial delivery sequence;
[0061] S3: Query the route database to determine whether there are new customers in the order;
[0062] S4: Design rules to assign all new customers in the order to different lines according to the rules;
[0063] S5: Use the fast insertion point algorithm to insert the new customer into the route in S4 and output the final delivery sequence of the route planning;
[0064] S6: Update the distance matrix of the line corresponding to the new user during idle time to obtain the new distance matrix LineDistanceMat' in the S1 database;
[0065] S7: Use the improved genetic algorithm in S2 again to solve the optimal delivery sequence.
[0066] The entire process of steps 1 to 7 is described as follows:
[0067] Step 1: Call the map API to obtain the distance matrix LineDistanceMat of each delivery route in the original database SQL.
[0068] The original database SQL stores all previous customer information, including customer name, customer ID, customer area, latitude and longitude, and customer line code. Since end-to-end delivery services target a large customer base, customers are divided into clear and fixed routes. The process of calling the map API to obtain the distance matrix for each delivery route in the original database SQL is as follows:
[0069] Read order information and directly determine which route the original terminal delivery customer belongs to based on the route database;
[0070] Query the database and call the distance matrix between the warehouse and all customer points on each route. Extract the distance matrix DistanceMat of the customer points included in this batch of orders by route, and use it as the data input for the improved genetic algorithm described below.
[0071] Subsequently, when new terminal delivery customers join the line or existing customers change, a new distance matrix LineDistanceMat' is generated through "incremental update".
[0072] Step 2: Use the improved genetic algorithm to solve the initial delivery sequence.
[0073] The overall optimization objective function of the terminal logistics vehicle routing optimization model is:
[0074]
[0075] Wherein, the set of warehouses and all customer points served is N = {0, 1, ..., n}, including the set of warehouse 0 and all customer points served is N' = {1, 2, ..., n}; the set of available vehicles in the warehouse is L = {1, 2, ..., k}; i, j represents a single warehouse or customer point, i, j∈N, i≠j; d ij represents the distance of the vehicle from point i to point j; is a decision 0-1 variable, which is 1 when the car goes from point i to point j and 0 otherwise.
[0076] Input parameters such as distance matrix, maximum load capacity of each vehicle, cargo load capacity corresponding to each customer point, and vehicle speed.
[0077] First, use the neighbor method and the insertion method to generate the initial solution. Input parameters such as the distance matrix, the maximum load capacity of each vehicle, the cargo load capacity corresponding to each customer point, and the vehicle speed. The initial point is the warehouse location, and then find the nearest customer points in sequence to add them to the TSP line. Use natural numbers to encode the end-to-end delivery customers, number them in sequence according to the natural number sequence, and arrange the sequence using the insertion method and the neighbor method. Such a sequence is called the initial solution. Each sequence is a chromosome, and many chromosomes constitute the initial population. Set the number of chromosomes in the population to ensure that there are enough initial solutions for subsequent iterations of the algorithm. 50% of the chromosomes in the initial population are generated using the insertion method, and the remaining chromosomes are generated using the neighbor method.
[0078] Then, an improved genetic algorithm is used to solve the problem. The initial solution is weight-constrained, and a fitness function is set to evaluate the fitness of the individuals in the population. A crossover operation is performed on the chromosomes with the smallest fitness function values. Mutation is performed on some of the initial solutions that have undergone the crossover operation or those that have not undergone the operation. After the iterations are completed, the shortest driving sequence to date is output, along with the number of customer points each vehicle needs to serve, the weight of each vehicle, and the travel time of each vehicle.
[0079] Step 3: Query the line database to determine whether there are new customers in the order. The specific process is:
[0080] When reading order information, if a customer point is found that is not marked in the database, that is, it does not exist in any delivery route, it will be regarded as a new customer.
[0081] Obtain the latitude and longitude information of these customers and add them to the daily new customer list, recording customer information such as: customer ID, address, latitude and longitude, order volume, and time when new customers joined.
[0082] For new customers, they need to be classified one by one and divided into different delivery routes, that is, inserted into the initial delivery sequence described in S2 according to certain rules.
[0083] Step 4: S3 assigns new customers to different lines according to the rules. To scientifically and rationally determine the entry of new customers, the following three rules are proposed:
[0084] In order to scientifically and rationally determine the new customer entry line, three rules are proposed:
[0085] The first method is to select a route for a new customer based on their distance from each route's cluster center in ascending order. Specifically, the route to which the new customer belongs is determined based on the route's cluster center with the smallest Euclidean distance from the new customer's longitude and latitude. The second method is to select the 20 points closest to the new customer from the existing customer list and calculate which route has the most points among these 20 customer points. This determines the route to which the new customer is assigned. The third method is to merge the new customer into the route to which the existing customer point is closest.
[0086] Under each rule, the three most qualified routes are selected as candidate routes for new customer entry. These routes are the routes belonging to the three closest cluster centers, the three routes with the most points in the top 20 closest to the new customer, and the routes belonging to the three closest customer points. The route with the highest duplication rate is then selected as the final route for the new customer point. If there are no duplications, the new customer is merged into the route belonging to the closest point.
[0087] As described in S4, the cluster center LineCenter of each line is calculated according to the longitude and latitude of all customer points in the database SQL.
[0088] The specific operation is as follows: first randomly select the first initial point, then calculate the distance between each point and the existing cluster center, find the shortest distance to each center point, and then calculate the probability of each point being selected as the next center point, select the point with the highest probability as the initial center point and add it to the center, then set the number of iterations to 10 times, divide each point into its own category, and finally iterate the center point selection to obtain the final cluster center.
[0089] Step 5: Use the fast insertion point algorithm to insert the line in S4 and output the final result of the path planning. The specific process is:
[0090] S51: Adjust the initial delivery sequence of all original customers obtained in S2, assign new customers to different routes, and update the delivery sequence and delivery mileage.
[0091] S52: Add time and load capacity limits, select the line for the new customer to be inserted according to the rules described in S4, calculate the two points closest to the new customer in the line, and insert the new customer into the two originally adjacent points.
[0092] S53: Directly use the Euclidean mileage between the point and the two previous and next delivery customer points as the actual mileage, update the local distance matrix, and then output the final delivery sequence and delivery mileage.
[0093] Step 6: Update the distance matrix of the line corresponding to the new user during idle time to obtain a new distance matrix LineDistanceMat' in the S1 database.
[0094] Specifically, based on the daily new customer information table, update the distance matrix regularly (such as every day, week or month), set the update cycle (1 week or 1 month), and set the specific update time, such as 12:00 every Saturday night.
[0095] Scan the database for customers that have not been updated (with an update status of 0) and perform the following processing for each customer A that has not been updated:
[0096] S61: According to the original database, traverse the three lines L1, L2 and L3 associated with A in turn, log in with the account and password, connect to Amap (or other maps), and check the distance between A and other points on the L* line.
[0097] S62: Count all points of a certain line L* consulted by A. If all points are covered, it means that all distance data have been downloaded, and the update status in the database is updated; if not all points are covered, it means that the update is unsuccessful, and the database is not updated.
[0098] Step 7: Use the improved genetic algorithm in S2 again to solve the optimal delivery sequence. Input parameters such as the input distance matrix, the maximum load of each vehicle, the cargo load corresponding to each customer point, and the vehicle speed, and output the optimal delivery path for each route.
[0099] In summary, the present invention provides a terminal delivery path planning method for two-stage entry of new customers. The logistics distribution problem referred to by the present invention is described as follows: the trucks of the logistics company set out from the warehouse to load, and different vehicles are assigned to different routes to deliver to the terminal customers. After passing each customer point in the route, they return to the warehouse after the delivery is completed. Among them, the truck drivers have working hours restrictions, the vehicles have capacity restrictions, and there is no maximum distance restriction. The objective function is to minimize the transportation mileage of each route, and then solve to obtain the optimal delivery path. However, new orders are generated every day, which may include new customers. How to quickly and scientifically and reasonably insert new customers into the original delivery sequence and complete the new customer entry work in two stages is a practical problem faced by terminal logistics companies.
[0100] As a further technical solution, this invention, based on the original VRP problem, considers dynamic route planning, processing newly added customers in real time, enabling the system to respond quickly and promptly output the optimal delivery route for the day. To address this problem, a two-stage terminal delivery route planning method for new customer entry is designed. First, starting from the warehouse, separate routes are planned for customer points along different routes. For orders without new customers, since the database already contains basic information about these customer points, including latitude and longitude, distance matrix, and associated routes, the system can directly identify and assign routes. The required distance matrix is then used to determine the optimal delivery sequence using an improved genetic algorithm. However, for orders with new customers, the system cannot find their information and therefore cannot assign them to routes, forcing them to be temporarily shelved. In the first stage, after all existing customers have formed an initial delivery sequence, rule-based constraints are used to identify the assigned route for each new customer. This route is then inserted into the initial delivery sequence using a rapid point insertion method to form the final delivery sequence. This delivery sequence is the optimal decision made with timeliness in mind. If a new customer does not place an urgent order after joining the system, it is considered to have entered the second stage. After determining the route to which the new customer belongs, the route distance matrix can be updated and the genetic algorithm can be used to solve the problem again. The delivery sequence obtained at this time is better.
[0101] This vehicle routing method first uses a map API to obtain a distance matrix between end-point delivery customer points (including warehouses). It then designs an improved genetic algorithm to determine the initial delivery sequence for daily system orders. The method then determines the order customer type. If there are no new customers, the initial delivery sequence becomes the final delivery sequence. If there are new customers, the method uses a fast insertion point algorithm to insert the route closest to the cluster center, locally updating the distance matrix to determine the optimal delivery sequence and delivery distance for the end-point delivery vehicles. This method effectively solves the problem of new customer onboarding, enabling the system to quickly respond to new users and output the optimal delivery route.
[0102] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solutions, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for planning terminal delivery routes for new customers in two stages, characterized by: The following steps are involved: S1: Call the map API to obtain the distance matrix of each delivery route in the original database SQL; S2: Construct a terminal logistics vehicle routing optimization model and use an improved genetic algorithm to solve the initial delivery sequence; S3: Query the route database to determine whether there are new customers in the order; S4: Design rules to assign all new customers in the order to different lines according to the rules; S5: Use the fast insertion point algorithm to insert the new customer into the route in step S4 and output the final delivery sequence of the route planning. The specific steps are: S51: Adjust the initial delivery sequence of all original customers obtained in step S2, assign new customers to different routes, and update the delivery sequence and delivery mileage; S52: Add time and load capacity restrictions, select the line to which the new customer is inserted according to the rules described in step S4, calculate the two points closest to the new customer on the line, and insert the new customer into the two adjacent points; S53: Directly use the Euclidean distance between the point and the two previous and next delivery customer points as the actual distance, update the local distance matrix, and then output the final delivery sequence and delivery distance; S6: Update the distance matrix of the lines corresponding to new users during off-peak hours to obtain a new distance matrix in the original database SQL. Regularly update the distance matrix based on the new customer information table every day, set the update cycle and specific update time, and scan the database for customers who have not been updated. For each customer A that has not been updated, perform the following processing: S61: According to the original database, the three routes L1, L2 and L3 associated with A are traversed in sequence to check the distance between A and other points on the L* route; S62: Count all points of a certain line L* consulted by A. If all points are covered, it means that all distance data have been downloaded, and the update status in the database is updated; if not all points are covered, it means that the update is unsuccessful, and the database is not updated. S7: Use the improved genetic algorithm in S2 again to solve the optimal delivery sequence.
2. The terminal delivery route planning method for two-stage new customer onboarding according to claim 1 is characterized by: The original database SQL stores the customer name, customer ID, address, latitude and longitude, and route information of all previous customers. Customers are clearly and fixedly divided into routes. The process of calling the map API to obtain the distance matrix of each delivery route in the original database SQL is as follows: S11: Read the order information. For the original terminal delivery customers, directly determine which route they belong to based on the route database; S12: Query the database and call the distance matrix containing the warehouse and all customer points on each route originally built, and extract the distance matrix LineDistanceMat of the customer points contained in the order by route, and use it as the data input of the improved genetic algorithm; when a new terminal delivery customer joins the line or the original customer changes, a new distance matrix LineDistanceMat' is generated.
3. The terminal delivery route planning method for new customer two-stage onboarding according to claim 1 is characterized by: In step S2, the overall optimization goal is to minimize the transportation mileage of each route. The constraints include truck driver working hour limit, vehicle capacity limit, no maximum distance limit, each customer point is served and only served once, and the delivery vehicle starts from the warehouse and eventually returns to the warehouse. When solving the problem, the proximity method and the insertion method are first used to generate an initial solution, and then the improved genetic algorithm is used to obtain the optimal delivery path.
4. The terminal delivery route planning method for two-stage new customer onboarding according to claim 1 is characterized by: Step S3 queries the line database to determine whether there is a new customer in the order, specifically including the following steps: S31: When reading order information, if a customer point is found that is not marked in the database, that is, does not exist in any delivery route, it is considered as a new customer; S32: Obtain the latitude and longitude information of the new customer and add it to the daily new customer list, recording the customer information, including customer ID, address, longitude and latitude, order volume and new customer joining time; S33: Classify the new customers one by one and insert them into the initial delivery sequence described in step S2 according to certain rules.
5. The terminal delivery route planning method for new customer two-stage onboarding according to claim 1 is characterized by: The rules in step S4 include: Rule 1: Select routes for new customers based on their distance from each route cluster center in ascending order. That is, the route to which the new customer belongs is determined by the route cluster center whose longitude and latitude have the smallest Euclidean distance. Rule 2: Select multiple points closest to the new customer from the original customer list, calculate which route has the most points among these original customer points, and assign the new customer to that route; Rule 3: The new customer will be merged into the line of the existing customer point closest to the new customer point; Under each rule, the three most qualified lines are selected as alternative options for new customer entry, and then the one with the highest repetition rate is selected as the final entry option for the new customer point. If there is no repetition, the new customer will be merged into the line belonging to the point closest to him.
6. The terminal delivery route planning method for two-stage new customer onboarding according to claim 5 is characterized by: Use the K-center clustering algorithm to calculate the cluster center LineCenter of all customers on each line. The calculation method is: Each divided delivery route is regarded as a data set X. Each data set has a center point, that is, K = 1. The longitude and latitude of customers on each delivery route form multiple coordinate points on the map, that is, there are n data points. The cluster center of each iteration is represented by the set m; after clustering, the sum of the squares of the differences from all data points to this cluster center is represented by D, that is, the cluster sum of squares. The clustering goal is to minimize the D value and obtain the center coordinate point C* on each route, that is, the longitude and latitude coordinates of the cluster center point.
7. The terminal delivery route planning method for two-stage new customer onboarding according to claim 6 is characterized by: The K-medoid clustering algorithm specifically includes the following steps: (1) For each data set X, the number of clusters is determined to be K = 1; (2) Select one point in all data sets as the center point of each cluster; (3) Calculate the distances from all other points to this center point, and take the cluster with the shortest distance from each point to this center point as the cluster to which it belongs; (4) Select a point in each cluster in order, calculate the sum of the distances D between the point and all the points in the current cluster, and the point with the smallest sum of distances is considered the new center point; (5) Repeat steps (2) and (3) until the center point of each cluster no longer changes, and obtain the sum of the squares of the differences between all data points and this cluster center D*, and its corresponding C* is the final cluster center.
8. The terminal delivery route planning method for new customer two-stage onboarding according to claim 1 is characterized by: If the new customer does not place an urgent order after joining the system, then after updating the distance matrix LineDistanceMat' of all the new customers' lines in the order in step S6, the improved genetic algorithm in S2 is used again to solve the problem. The delivery sequence obtained at this time is better.
Citation Information
Patent Citations
Automatic walking device and path planning method thereof
CN105511458A
Staged multi-base unmanned aerial vehicle task allocation and flight path planning method
CN113671985A