A route generation method for take-out delivery process
Patent Information
- Application Number
- CN202311463141.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-06
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-11-06
AI Technical Summary
虽然此类方法具有更强的搜索能力,但是由于其需要不断的对解进行改进,此类方法具有搜索效率较低、收敛速度较慢等缺点,难以在实际应用场景中及时地返回外卖订单配送路线
[0089]1、本发明应用了一种基于数据驱动的优化框架,利用历史数据构建抽象路径,从而能够快速地构建出较高质量的外卖订单配送路线。具体地,本发明通过将商家服务范围所在区域等比例划分为多个网格,并将每个网格看成待配送订单客户来构造出一组抽象路径,根据抽象路径在历史订单数据上的表现,利用进化算法不断的对抽象路径进行优化和改进,直至进化算法种群收敛。之后,根据不同抽象路径在历史订单数据上的表现,选择一组抽象路径,指导生成当前外卖订单配送路线。由于客户订单具有一定的周期性,利用历史订单数据构造出的抽象路径与当前订单配送问题的配送路线通常具有较大的相似性,因此,利用抽象路径指导生成当前外卖订单配送路线,便能够在较短的时间内获得高质量的外卖订单配送路线。
Smart Images

Figure CN117474431B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of vehicle route optimization, specifically a data-driven route planning method applicable to food delivery tasks. Background Technology
[0002] Delivery of takeout orders is a crucial part of a restaurant's online marketing strategy. Planning a reasonable delivery route can effectively reduce delivery distance and time, improve customer satisfaction, and ultimately increase restaurant sales, which has significant economic and environmental benefits.
[0003] Similar to traditional vehicle routing optimization problems, food delivery route planning is an NP-hard problem, with the difficulty increasing dramatically with the complexity of the problem. Furthermore, to provide a better customer experience, food delivery route planning methods need to generate delivery routes within a very short time, further increasing the difficulty. Currently, route planning methods for food delivery tasks can be mainly divided into two categories: constructive methods and iterative methods. Constructive methods utilize heuristic information to gradually determine the order of different orders until a complete solution is constructed. While these methods can provide delivery routes in a short time, they are prone to getting trapped in local optima because they only consider local heuristic information. Iterative methods start with an initial solution and continuously improve it using search operators, aiming to gradually approach the optimal solution in the target space. Although these methods have stronger search capabilities, they suffer from low search efficiency and slow convergence speed due to the need for continuous solution improvement, making it difficult to return delivery routes in a timely manner in practical applications. Summary of the Invention
[0004] To address the shortcomings of the existing technology, this invention proposes a route generation method for food delivery processes. This method aims to construct food delivery routes that satisfy time window constraints and capacity constraints in a short time while minimizing the total travel distance, thereby reducing the delivery distance and time of food orders and improving the satisfaction of users who place orders.
[0005] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:
[0006] The method for route generation in the food delivery process of this invention is characterized by its application in a food delivery scenario consisting of a single restaurant, M riders, and N customers, and is carried out according to the following steps:
[0007] Step 1: Build a food delivery route model;
[0008] Step 1.1: Denote the outer rectangle of the restaurant's delivery range as the delivery area S, and divide S into n×n grids proportionally, thus forming a grid set B = {b}. w w = 1, 2, ..., n 2}, b w Let w represent any w-th grid, and n represent the precision of the grid division;
[0009] In the delivery area S, there exists a set V = {v0, v1, ..., v...} consisting of restaurant nodes and N customer nodes. i ,…,v N}, where v0 represents the restaurant node, v i Let the i-th customer node be represented by the path set E = {e_i} formed by the nodes in the set V. ij |i=0,1,…,N;j=0,1,…,N;i≠j},e ij Represents the i-th node v i To the j-th node v j The path;
[0010] Let b0 represent the grid where restaurant node v0 is located;
[0011] Define a scene set consisting of P1 historical scenes. in, Let α represent the α-th historical scene, and It contains K1 time slices, that is Represents the α-th historical scene The βth time slice below, and It contains n1 orders;
[0012] Step 1.2: Construct the objective function cost of the food delivery route model using equation (1):
[0013]
[0014] In equation (1), c ij Indicates path e ij The distance, x ij Represents the i-th node v i To the j-th node v j Is there a path; if the i-th node v i To the j-th node v j If there is a path, then let x ij =1, otherwise, let x =1. ij =0;
[0015] Step 1.3: Construct the constraints for the food delivery route model using equations (2)-(8):
[0016]
[0017]
[0018]
[0019]
[0020] u i -u j +Qx ij ≤Qd j ,i,j=1,2,…,N,i≠j (6)
[0021] d i ≤u i ≤Q (7)
[0022] x ij ∈{0,1},0≤i,j≤N (8)
[0023] In equations (2)-(8), M represents the number of riders, u i This indicates that the rider visited the i-th node v. i The amount of takeout food carried at that time, u j This indicates that the rider visited the j-th node v. j The maximum amount of food delivery a rider can carry at any given time, Q represents the maximum capacity of food deliveries a rider can carry, and d represents the maximum capacity of food deliveries a rider can carry. i Represents the i-th node v i Demand;
[0024] Step 2: Define the current algebra as μ and initialize μ = 0;
[0025] Randomly generate the μth generation population Pop μ Let the population size be PopSize, and let p μ,τ Pop represents the μth generation population. μ The τth individual in the array, and each individual is composed of multiple grid paths. Each grid path is a grid sequence that starts from the grid b0 where the restaurant node v0 is located, passes through the grids where multiple customer nodes are located, and returns to b0. Initialize τ = 1.
[0026] Step 2.1: Generate the τth individual p from the grid set B. μ,τ ;
[0027] Step 2.2: Assign τ+1 to τ. If τ≤PopSize, return to step 2.1; otherwise, it means that the population Pop of generation μ has been obtained. μ And proceed to step 3;
[0028] Step 3: Based on the path cost generated from historical order data and the structural indicators of individuals, analyze the Pop population of the μth generation. μ Evaluation of individuals;
[0029] Step 3.1: Construct the objective function of the grid path evaluation model using equation (9):
[0030]
[0031] In equation (9), f1 represents the objective function for minimizing the ranking, and Randk μ,τ p μ,τ The ranking, and Represents the τ-th individual p μ,τ The ranking in the α-th scenario is calculated by plotting the τ-th individual p. μ,τ Delivery route cost in scenario α We obtain; where cost μ,τ,β Represents the τ-th individual p μ,v The delivery path cost in the βth time slice under the αth scenario is obtained using equation (1);
[0032] f2 represents the objective function for density, and AreaRate represents the value of the τ-th individual p. μ,τ The sum of the ratios between the grid area occupied by each grid path and the bounding rectangle of the corresponding grid path;
[0033] f3 represents the objective function for the degree of discreteness, and Dis represents the τ-th individual p. μ,τ The difference between the circumscribed rectangles of any two grid paths and the grid area occupied by the corresponding two grid paths, and the ratio between the circumscribed rectangles of the corresponding two grid paths, and summing all ratios.
[0034] Step 3.2: Use equation (9) to analyze Pop of the μth generation population. μ Each individual is evaluated to obtain three target values for each individual, which are used as evaluation indicators for each individual;
[0035] Step 3.2.1: Initialize τ = 1;
[0036] Step 3.2.2: Initialize α = 1;
[0037] Step 3.2.3, record individual p. μ,τ The length is len μ,τ , using p μ,τ Generate the αth historical scene Delivery routes for K1 time-slice orders;
[0038] Step 3.2.4: Use formula (9) to calculate individual p. μ,τ The three target values;
[0039] Step 3.2.5: After assigning τ+1 to τ, if τ≤PopSize, return to step 3.2.2; otherwise, it indicates that the population Pop of generation μ has been obtained. μ Three target values for each individual;
[0040] Step 4: Based on the Pop of the μth generation population μ The evaluation criteria for each individual were used to generate the μth generation mating pool using the binary tournament method. Then, PopSize individuals in the μth generation mating pool were crossovered to obtain PopSize offspring individuals, which constitute the μth generation child population. μ ;
[0041] Step 5: Following the process in Step 3.2, process the μth generation child population. μ Each offspring individual is evaluated to obtain three target values for each offspring individual;
[0042] Step 6: Pop of the μth generation population μ With the μth generation child population μ Merging yields the μth generation merged population. And based on environmental selection strategies, the populations were merged from the μth generation. Select PopSize individuals and form the μ+1 generation population Pop. μ+1 ;
[0043] Step 7: Assign μ+1 to μ, if μ <gen max If the iteration terminates, return to step 4 and continue execution; otherwise, the iteration terminates and the result is compared to the gen-th iteration. max Generation population As the final population Among them, gen max Indicates the maximum number of iterations;
[0044] Step 8: Based on the final population For each individual, three target values are selected, and the ω individuals with the smallest first target value are chosen to form the guidance path. And used to generate new scene sets The delivery routes, among which, This indicates the use of Scene to guide the creation of new scene sets. new The s'th grid path; Let α' be the α'-th online delivery scenario, and It contains K2 time slices, that is This represents the α'th online delivery scenario. The β'th time slice and It contains n2 orders;
[0045] Step 9: Create a new scene set. new Generate delivery routes for each scenario;
[0046] Step 9.1: Generate the α'th online delivery scenario. The delivery routes for each time slice are initialized with α' = 1;
[0047] Step 9.1.1: Generate the β'-th time slice The delivery route is initialized with β' = 1;
[0048] Step 9.1.2: Initialize the α'th online delivery scenario. The β'th time slice Delivery route set
[0049] Step 9.1.3: Initialize s' = 1;
[0050] Step 9.1.4, Use Generate the s'-th delivery route R' according to step 3.2. α'β's' and R' α'β's' insert
[0051] Step 9.1.5: Assign s'+1 to s'. If s'≤ω, return to step 9.1.4; otherwise, it indicates that the guiding path R is used. π The α'th online delivery scenario was generated. The β'th time slice The ω delivery routes for the order;
[0052] Step 9.1.6: Calculate according to formula (1) The cost of each delivery route is calculated, and the delivery route with the lowest cost is selected as the time slice. Delivery routes in the middle;
[0053] Step 9.1.7: Assign β'+1 to β'. If β'≤K2, return to step 9.1.2 and execute sequentially; otherwise, it indicates that the α'th online delivery scenario has been obtained. For the delivery routes of each time slot, proceed to step 9.2;
[0054] Step 9.2: Assign α'+1 to α'. If α'≤P2, return to step 9.1.1 and execute sequentially, indicating that a new scene set, Scene, is obtained. newDelivery routes are generated for each scenario.
[0055] The method for generating routes in the food delivery process described in this invention is also characterized in that step 2.1 includes:
[0056] Step 2.1.1: Initialize p μ,τ ={b0}, let p μ,τ The last grid in the array is denoted as b. end Initialize b end =b0;
[0057] Randomly select n grids from grid set B as cluster centers. in, Indicates the first The cluster center will be connected with the first cluster center. Distance between cluster centers The most recent grid structure Class Indicates the relationship with the first Distance between cluster centers The most recent j'-th grid, Indicates the first The number of grids in each class;
[0058] Step 2.1.2, Initialization
[0059] Step 2.1.3, from the first Class Choose with b end The minth nearest grid And insert p μ,τ The end;
[0060] Step 2.1.4, from Delete And update like If not empty, return to step 2.1.3; otherwise, insert b0 into p. μ,τ At the end, and update b end =b0, thus obtaining p μ,τ The Middle Grid paths;
[0061] Step 2.1.5, Assign to like Then return to step 2.1.3; otherwise, it means that p has been obtained. μ,τ All grid paths in the array are processed, and step 2.2 is executed.
[0062] Step 4 includes:
[0063] Step 3.2.3.1: Let the τ-th individual p μ,τ Let b be the w'th grid in the grid path. μ,τ,w’ Initialize β = 1;
[0064] Step 3.2.3.2: Define and initialize the αth historical scene. Delivery path R in the βth time slice α,β It is an empty set;
[0065] Step 3.2.3.3: Initialize w' = 1, define and initialize the temporary delivery path R' = {v0};
[0066] Step 3.2.3.4, if b w' If b≠b0, proceed to step 3.2.3.5; otherwise, proceed to step 3.2.3.6.
[0067] Step 3.2.3.5, if grid b μ,τ,w’ There exist orders that satisfy equations (2)-(8) from grid b. μ,τ,w’ Select the order closest to the last node in R' from grid b. μ,τ,w’ After deleting and inserting at the end of R', repeat step 3.2.3.5; otherwise, proceed to step 3.2.3.6.
[0068] Step 3.2.3.6: Assign w'+1 to w', if w'≤len μ,τ If the result is positive, return to step 3.2.3.4; otherwise, insert v0 at the end of R', indicating that a delivery route R' has been obtained and will be inserted into R. α,β middle;
[0069] Step 3.2.3.7: Determine individual p μ,τ If any unprocessed orders exist in each grid, return to step 3.2.3.3; otherwise, the α-th historical scene has been obtained. Determine the delivery route for the order placed in the βth time slice; and execute step 3.2.3.8;
[0070] Step 3.2.3.8: Assign β+1 to β. If β≤K1, return to step 3.2.3.3; otherwise, obtain the α-th historical scene. individual p μ,τ Delivery routes for orders placed in time slot K1;
[0071] Step 3.2.3.9: Assign α+1 to α. If α≤P1, return to step 3.2.3; otherwise, it means using p. μ,τ Delivery routes for K1 time-slice orders across all scenarios were generated, and step 3.2.3 was executed.
[0072] Step 4 includes:
[0073] Step 4.1: Generate the μth generation mating pool;
[0074] Step 4.1.1: Initialize the μ-th generation mating pool (MatingPool) μ ={}, τ=1;
[0075] Step 4.1.2, from Pop μ Two individuals are randomly selected, and their Pareto dominance is determined based on evaluation indicators. The dominant individual is then placed into the MatingPool. μ If neither of the two entities is dominant, then an individual is randomly selected and placed into the MatingPool. μ middle;
[0076] Step 4.1.3: After assigning τ+1 to τ, if τ≤PopSize, return to step 4.1.2; otherwise, it indicates that the μ-th generation mating pool, MatingPool, has been obtained. μ ;
[0077] Step 4.2: Initialize the crossover mutation count q = 1, and initialize the offspring population Child of the μth generation. μ ={};
[0078] Step 4.3, from MatingPool μ Select two adjacent individuals p μ,2q-1 With p μ,2q And use the crossover operator to generate two offspring individuals. and
[0079] Step 4.4: Assign q+1 to q, if the condition is met. Then return to step 4.3 and execute sequentially; otherwise, it indicates that the μ-th generation offspring population (Child) has been obtained. μ .
[0080] Step 4.3 includes:
[0081] Step 4.3.1: Let the 2q-1th individual... The 2qth individual in and They represent p respectively μ,2q-1 With p μ,2q The h-th visited grid, H 2q-1 With H 2q Let p represent the 2q-1th individual. μ,2q-1 With the 2qth individual p μ,2q The sequence length;
[0082] Step 4.3.2, from p μ,2q-1 With p μ,2q Two temporary grid sets are formed by randomly selecting k grids from each grid. and From p μ,2q-1 Delete In the grid, generate the 2q-1th temporary individual p' μ,2q-1 From p μ,2q Delete In the grid, generate the 2qth temporary individual p' μ,2q ;
[0083] Step 4.3.3, will Grid insertion p' μ,2q Generate the 2qth offspring individual Will Grid insertion p' μ,2q-1 Generate the 2q-1th offspring individual.
[0084] Step 4.3.4: Randomly generate a value P. If P > P c If so, proceed to step 4.3.5; otherwise, proceed to step 4.3.5. and Place in Child μ , where P c It is the mutation probability, and P∈[0,1],P c ∈[0,1];
[0085] Step 4.3.5, for and Perform a mutation operation to obtain the 2qth offspring individual after the mutation. With the 2q-1th offspring And put it into Child gen .
[0086] The present invention provides an electronic device, including a memory and a processor, wherein the memory is used to store a program that supports the processor in executing the route generation method, and the processor is configured to execute the program stored in the memory.
[0087] The present invention discloses a computer-readable storage medium on which a computer program is stored, wherein the computer program is executed by a processor to perform the steps of the route generation method.
[0088] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0089] 1. This invention employs a data-driven optimization framework that utilizes historical data to construct abstract paths, thereby enabling the rapid generation of high-quality food delivery routes. Specifically, this invention constructs a set of abstract paths by proportionally dividing the service area of a merchant into multiple grids and treating each grid as a customer with an order to be delivered. Based on the performance of these abstract paths on historical order data, an evolutionary algorithm is used to continuously optimize and improve the abstract paths until the algorithm population converges. Then, based on the performance of different abstract paths on historical order data, a set of abstract paths is selected to guide the generation of the current food delivery route. Since customer orders have a certain periodicity, the abstract paths constructed using historical order data usually have a high degree of similarity to the delivery routes for the current order. Therefore, using abstract paths to guide the generation of the current food delivery route can yield high-quality food delivery routes in a relatively short time.
[0090] 2. This invention employs an abstract path construction model that guides an evolutionary algorithm to continuously adjust and optimize the abstract paths in the population based on historical order data. This leads to the discovery of a diverse set of high-quality abstract paths, improving the guidance effect of abstract paths on current food delivery routes. Specifically, this invention first samples historical order data at different time intervals to construct multiple historical order datasets for testing the quality of abstract paths. Then, this invention measures the quality of abstract paths based on three objectives: the minimum delivery cost ranking of the abstract path within the historical order dataset, the density of customers within the abstract path, and the degree of customer separation within the abstract path. An evolutionary algorithm is then used to continuously optimize and adjust the abstract paths. Since these three objectives evaluate the quality of abstract paths from both delivery cost and structural perspectives, they effectively guide the evolutionary computation population to find a diverse set of high-quality abstract paths. This allows for the generation of order delivery routes using a single set of abstract paths, saving on delivery route costs.
[0091] 3. This invention employs an abstract path-guided delivery route method, capable of quickly generating delivery routes that satisfy time window and capacity constraints using abstract paths. Specifically, all current orders are assigned to different grids based on distance. Then, the delivery route is constructed by sequentially traversing the orders in different grids according to the grid order in the abstract path. For each order in a grid, it is judged sequentially based on its distance to the last inserted order in the current path, and orders that do not violate the capacity and time window constraints are inserted at the end of the path. If there are still orders not inserted into the delivery route after traversing all grids, the remaining orders are traversed again and inserted into the new path. Since only the distance between orders within the same grid needs to be calculated when constructing the delivery route, rather than the distance between all orders, this invention can quickly generate delivery routes that satisfy time window and capacity constraints based on abstract paths when a new delivery problem arises. Attached Figure Description
[0092] Figure 1 This forms the overall framework of the method of the present invention;
[0093] Figure 2 This is an example diagram of mesh division according to the present invention;
[0094] Figure 3 This is an example diagram illustrating the calculation of the closeness of customers along the abstract path in this invention.
[0095] Figure 4 This is an example diagram illustrating the calculation of the separation degree of the abstract path customer in this invention. Detailed Implementation
[0096] In this embodiment, a data-driven route planning method for vehicle delivery tasks aims to solve the task of planning delivery routes for online restaurant takeout orders. First, this invention applies a data-driven optimization framework, using historical order data to construct abstract paths to guide the generation of current takeout order delivery routes. Second, this invention applies an abstract path construction model, measuring the quality of abstract paths from both delivery cost and route structure perspectives, effectively guiding the algorithm to find a diverse set of high-quality abstract paths. Finally, this invention applies a method for using abstract paths to guide the current order delivery route. When a new takeout order delivery problem arises, it can effectively utilize abstract paths to quickly generate takeout delivery routes that meet time window and capacity constraints, exhibiting high timeliness. Specifically, as... Figure 1 As shown, this order delivery route planning method is applied to a food delivery scenario consisting of a single restaurant, M riders, and N customers, and is performed according to the following steps:
[0097] Step 1: Build a food delivery route model;
[0098] Step 1.1: Denote the outer rectangle of the restaurant's delivery range as the delivery area S, and divide S into n×n grids proportionally, thus forming a grid set B = {b}. w w = 1, 2, ..., n 2}, b w Let w represent any w-th grid, and n represent the precision of the grid division, such as... Figure 2 As shown, the black triangle represents the location of the restaurant, and the elliptical area enclosed by the dashed line represents the restaurant's delivery range. The outer rectangle of the restaurant's delivery range is divided into 8×8 grids in the figure.
[0099] In the delivery area S, there exists a set V = {v0, v1, ..., vn} consisting of restaurant nodes and N customer nodes. i ,…,v N}, where v0 represents the restaurant node, v i Let the i-th customer node be represented by the path set E = {e_i} formed by the nodes in the set V. ij |i=0,1,…,N;j=0,1,…,N;i≠j},e ij Represents the i-th node v i To the j-th node v j The path;
[0100] Let b0 represent the grid where restaurant node v0 is located;
[0101] Define a scene set consisting of P1 historical scenes. in, Let α be the α-th historical scene, and It contains K1 time slices, that is Represents the α-th historical scene The βth time slice below, and It contains n1 orders, that is Represents the α-th historical scene Next β time slice The γth order.
[0102] Step 1.2: Construct the objective function cost of the food delivery route model using equation (1):
[0103]
[0104] In equation (1), c ij Indicates path e ij The distance, x ij Represents the i-th node v iTo the j-th node v j Is there a path; if the i-th node v i To the j-th node v j If there is a path, then let x ij =1, otherwise, let x =1. ij =0.
[0105] Step 1.3: Construct the constraints for the food delivery route model using equations (2)-(8):
[0106]
[0107]
[0108]
[0109]
[0110] u i -u j +Qx ij ≤Qd j ,i,j=1,2,…,N,i≠j (6)
[0111] d i ≤u i ≤Q (7)
[0112] x ij ∈{0,1},0≤i,j≤N (8)
[0113] In equations (2)-(8), M represents the number of riders, u i This indicates that the rider visited the i-th node v. i The amount of takeout food carried at that time, u j This indicates that the rider visited the j-th node v. j The maximum amount of food delivery a rider can carry at any given time, Q represents the maximum capacity of food deliveries a rider can carry, and d represents the maximum capacity of food deliveries a rider can carry. i Represents the i-th node v i The demand is expressed in equations (2) and (3), which indicate that each vertex can only be visited once. Equation (6) is the sub-loop elimination constraint, and equation (7) is the capacity constraint.
[0114] Step 2: Define the current algebra as μ and initialize μ = 0;
[0115] Randomly generate the μth generation population Pop μ Let the population size be PopSize, and let p μ,τ Pop represents the μth generation population. μThe τth individual in the array, and each individual is composed of multiple grid paths. Each grid path is a grid sequence that starts from the grid b0 where the restaurant node v0 is located, passes through the grids where multiple customer nodes are located, and returns to b0. Initialize v = 1.
[0116] Step 2.1: Generate the v-th individual p μ,v ;
[0117] Step 2.1.1: Initialize p μ,τ ={b0}, let p μ,τ The last grid in the array is denoted as b. end Initialize b end =b0;
[0118] Randomly select n grids from grid set B as cluster centers. in, Indicates the first The cluster center will be connected with the first cluster center. Distance between cluster centers The most recent grid structure Class Indicates the relationship with the first Distance between cluster centers The most recent j'-th grid, Indicates the first The number of grids in each class;
[0119] Step 2.1.2, Initialization
[0120] Step 2.1.3, from the first Class Choose with b end The nearest min-th grid And insert p μ,τ The end;
[0121] Step 2.1.4, from Delete And update like If not empty, return to step 2.1.3; otherwise, insert b0 into p. μ,τ At the end, and update b end =b0, thus obtaining p μ,τ The Middle Grid paths;
[0122] Step 2.1.5, Assign to like Then return to step 2.1.3; otherwise, it means that p has been obtained. μ,τAll grid paths in the array are processed, and step 2.2 is executed.
[0123] Step 2.2: Assign τ+1 to τ. If τ≤PopSize, return to step 2.1; otherwise, it means that the population Pop of generation μ has been obtained. μ Then proceed to step 3.
[0124] Step 3: Based on the path cost generated from historical order data and the structural indicators of individuals, analyze the Pop population of the μth generation. μ Evaluation of individuals;
[0125] Step 3.1: Construct the objective function of the grid path evaluation model using equation (9):
[0126]
[0127] In equation (9), f1 represents the objective function for minimizing the rank, Rank μ,τ p μ,τ The ranking, and Represents the τ-th individual p μ,τ The ranking in the α-th scenario is calculated by plotting the τ-th individual p. μ,τ Delivery route cost in scenario α We obtain; where cost μ,τ,β Represents the τ-th individual p μ,τ The delivery path cost in the βth time slice under the αth scenario is obtained using equation (1);
[0128] f2 represents the objective function for density, and AreaRate represents the value of the τ-th individual p. μ,τ The sum of the ratios between the grid area occupied by each grid path and the bounding rectangle of the corresponding grid path, such as... Figure 3 As shown, the calculation method is to divide the area of the shaded part by the area of the entire rectangle;
[0129] f3 represents the objective function for the degree of discreteness, and Dis represents the τ-th individual p. μ,τ The difference between the bounding rectangles of any two grid paths and the grid areas occupied by the corresponding two grid paths, and the ratio between these ratios, are calculated by summing all such ratios. Figure 4 As shown, the calculation method is to divide the area of the unshaded part by the area of the entire rectangle.
[0130] Step 3.2: Use equation (9) to analyze Pop of the μth generation population. μ Each individual is evaluated to obtain three target values for each individual, which are used as evaluation indicators for each individual;
[0131] Step 3.2.1: Initialize τ = 1;
[0132] Step 3.2.2: Initialize α = 1;
[0133] Step 3.2.3, record individual p. μ,τ The length is len μ,τ , using p μ,τ Generate the αth historical scene Delivery routes for K1 time-slice orders;
[0134] Step 3.2.3.1: Let the τ-th individual p μ,τ Let b be the w'th grid in the grid path. μ,τ,w’ Initialize β = 1;
[0135] Step 3.2.3.2: Define and initialize the αth historical scene. Delivery path R in the βth time slice α,β It is an empty set;
[0136] Step 3.2.3.3: Initialize w' = 1, define and initialize the temporary delivery path R' = {v0};
[0137] Step 3.2.3.4, if b w' If b≠b0, proceed to step 3.2.3.5; otherwise, proceed to step 3.2.3.6.
[0138] Step 3.2.3.5, if grid b μ,τ,w’ There exist orders that satisfy equations (2)-(8) from grid b. μ,τ,w’ Select the order closest to the last node in R' from grid b. μ,τ,w’ After deleting and inserting at the end of R', repeat step 3.2.3.5; otherwise, proceed to step 3.2.3.6.
[0139] Step 3.2.3.6: Assign w'+1 to w', if w'≤len μ,τ If the result is positive, return to step 3.2.3.4; otherwise, insert v0 at the end of R', indicating that a delivery route R' has been obtained and will be inserted into R. α,β middle;
[0140] Step 3.2.3.7: Determine individual p μ,τ If any unprocessed orders exist in each grid, return to step 3.2.3.3; otherwise, the α-th historical scene has been obtained. Determine the delivery route for the order placed in the βth time slice; and execute step 3.2.3.8;
[0141] Step 3.2.3.8: Assign β+1 to β. If β≤K1, return to step 3.2.3.3; otherwise, obtain the α-th historical scene. individual p μ,τ Delivery routes for orders placed in time slot K1;
[0142] Step 3.2.3.9: Assign α+1 to α. If α≤P1, return to step 3.2.3; otherwise, it means using p. μ,τ Delivery routes for K1 time-slice orders across all scenarios were generated, and step 3.2.3 was executed.
[0143] Step 3.2.3: Use formula (9) to calculate individual p. μ,τ The three target values;
[0144] Step 3.2.4: After assigning τ+1 to τ, if τ≤PopSize, return to step 3.2.2; otherwise, it indicates that the population Pop of generation μ has been obtained. μ Three target values for each individual.
[0145] Step 4: Based on the Pop of the μth generation population μ The evaluation criteria for each individual were used to generate the μth generation mating pool using the binary tournament method. Then, PopSize individuals in the μth generation mating pool were crossovered to obtain PopSize offspring individuals, which constitute the μth generation child population. μ ;
[0146] Step 4.1: Generate the μth generation mating pool;
[0147] Step 4.1.1: Initialize the μ-th generation mating pool (MatingPool) μ ={}, τ=1;
[0148] Step 4.1.2, from Pop μ Two individuals are randomly selected, and their Pareto dominance is determined based on evaluation indicators. The dominant individual is then placed into the MatingPool. μ If neither of the two entities is dominant, then an individual is randomly selected and placed into the MatingPool. μ middle;
[0149] Step 4.1.3: After assigning τ+1 to τ, if τ≤PopSize, return to step 4.1.2; otherwise, it indicates that the μ-th generation mating pool, MatingPool, has been obtained. μ .
[0150] Step 4.2: Initialize the crossover mutation count q = 1, and initialize the offspring population Child of the μth generation. μ ={};
[0151] Step 4.3, from MatingPool μ Select two adjacent individuals p μ,2q-1 With p μ,2q And use the crossover operator to generate two offspring individuals. and
[0152] Step 4.3.1: Let the 2q-1th individual... The 2qth individual in and They represent p respectively μ,2q-1 With p μ,2q The h-th visited grid, H 2q-1 With H 2q Let p represent the 2q-1th individual. μ,2q-1 With the 2qth individual p μ,2q The sequence length;
[0153] Step 4.3.2, from p μ,2q-1 With p μ,2q Two temporary grid sets are formed by randomly selecting k grids from each grid. and From p μ,2q-1 Delete In the grid, generate the 2q-1th temporary individual p' μ,2q-1 From p μ,2q Delete In the grid, generate the 2qth temporary individual p' μ,2q ;
[0154] Step 4.3.3, will Grid insertion p' μ,2q Generate the 2qth offspring individual Will Grid insertion p' μ,2q-1 Generate the 2q-1th offspring individual.
[0155] Step 4.3.4: Randomly generate a value P. If P > P c If so, proceed to step 4.3.5; otherwise, proceed to step 4.3.5. and Place in Child μ , where P c It is the mutation probability, and P∈[0,1],P c ∈[0,1];
[0156] Step 4.3.5, for and Perform a mutation operation to obtain the 2qth offspring individual after the mutation operation. With the 2q-1th offspring And put it into Child gen .
[0157] Step 4.4: Assign q+1 to q, if the condition is met. Then return to step 4.3 and execute sequentially; otherwise, it indicates that the μ-th generation offspring population (Child) has been obtained. μ .
[0158] Step 5: Following the process in Step 3.2, process the μth generation child population. μ Each offspring individual is evaluated to obtain three target values for each offspring individual;
[0159] Step 6: Pop of the μth generation population μ With the μth generation child population μ Merging yields the μth generation merged population. And based on environmental selection strategies, the populations were merged from the μth generation. Select PopSize individuals and form the μ+1 generation population Pop. μ+1 ;
[0160] Step 7: Assign μ+1 to μ, if μ <gen max If the iteration terminates, return to step 4 and continue execution; otherwise, the iteration terminates and the result is compared to the gen-th iteration. max Generation population As the final population Among them, gen max This indicates the maximum number of iterations.
[0161] Step 8: Based on the final population For each individual, three target values are selected, and the ω individuals with the smallest first target value are chosen to form the guidance path. And used to generate new scene sets The delivery routes, among which, This indicates the use of Scene to guide the creation of new scene sets. new The s'th grid path; Let α' be the α'-th online delivery scenario, and It contains K2 time slices, that is This represents the α'th online delivery scenario. The β'th time slice and It contains n2 orders, that is This represents the α'th online delivery scenario. The β'th time slice The γ'th order.
[0162] Step 9: Create a new scene set. new Generate delivery routes for each scenario;
[0163] Step 9.1: Generate the α'th online delivery scenario. The delivery routes for each time slice are initialized with α' = 1;
[0164] Step 9.1.1: Generate the β'-th time slice The delivery route is initialized with β' = 1;
[0165] Step 9.1.2: Initialize the α'th online delivery scenario. The β'th time slice Delivery route set
[0166] Step 9.1.3: Initialize s' = 1;
[0167] Step 9.1.4, Use Generate the s'-th delivery route R' according to step 3.2. α'β's' and R' α'β's' insert
[0168] Step 9.1.5: Assign s'+1 to s'. If s'≤ω, return to step 9.1.4; otherwise, it indicates that the guiding path R is used. π The α'th online delivery scenario was generated. The β'th time slice The ω delivery routes for the order;
[0169] Step 9.1.6: Calculate according to formula (1) The cost of each delivery route is calculated, and the delivery route with the lowest cost is selected as the time slice. Delivery routes in the middle;
[0170] Step 9.1.7: Assign β'+1 to β'. If β'≤K2, return to step 9.1.2 and execute sequentially; otherwise, it indicates that the α'th online delivery scenario has been obtained. For the delivery routes of each time slot, proceed to step 9.2;
[0171] Step 9.2: Assign α'+1 to α'. If α'≤P2, return to step 9.1.1 and execute sequentially, indicating that a new scene set, Scene, is obtained. new Delivery routes generated for various scenarios.
[0172] In this embodiment, an electronic device includes a memory and a processor. The memory stores a program that supports the processor in executing the above-described method, and the processor is configured to execute the program stored in the memory.
[0173] In this embodiment, a computer-readable storage medium stores a computer program, which is executed by a processor to perform the steps of the above method.
Claims
1. A route generation method for food delivery processes, characterized in that, This is applied to a food delivery scenario consisting of a single restaurant, M riders, and N customers, and is carried out according to the following steps: Step 1: Build a food delivery route model; Step 1.1: Denote the outer rectangle of the restaurant's delivery range as the delivery area S, and divide S into n×n grids proportionally, thus forming a grid set B = {b}. w w = 1, 2, ..., n 2 }, b w Let w represent any w-th grid, and n represent the precision of the grid division; In the delivery area S, there exists a set V = {v0, v1, ..., v...} consisting of restaurant nodes and N customer nodes. i ,…,v N }, where v0 represents the restaurant node, v i Let the i-th customer node be represented by the path set E = {e_i} formed by the nodes in the set V. ij |i=0,1,…,N;j=0,1,…,N;i≠j},e ij Represents the i-th node v i To the j-th node v j The path; Let b0 represent the grid where restaurant node v0 is located; Define a scene set consisting of P1 historical scenes. in, Let α be the α-th historical scene, and It contains K1 time slices, that is Represents the α-th historical scene The βth time slice below, and It contains n1 orders; Step 1.2: Construct the objective function cost of the food delivery route model using equation (1): In equation (1), c ij Indicates path e ij The distance, x ij Represents the i-th node v i To the j-th node v j Is there a path; if the i-th node v i To the j-th node v j If there is a path, then let x ij =1, otherwise, let x =1. ij =0; Step 1.3: Construct the constraints for the food delivery route model using equations (2)-(8): u i -u j +Qx ij ≤Q-d j ,i,j=1,2,…,N,i≠j (6) d i ≤u i ≤Q (7) x ij ∈{0,1},0≤i,j≤N (8) In equations (2)-(8), M represents the number of riders, u i This indicates that the rider visited the i-th node v. i The amount of takeout food carried at that time, u j This indicates that the rider visited the j-th node v. j The maximum amount of food delivery a rider can carry at any given time, Q represents the maximum capacity of food deliveries a rider can carry, and d represents the maximum capacity of food deliveries a rider can carry. i Represents the i-th node v i Demand; Step 2: Define the current algebra as μ and initialize μ = 0; Randomly generate the μth generation population Pop μ Let the population size be PopSize, and let p μ,τ Pop represents the μth generation population. μ The τth individual in the array, and each individual is composed of multiple grid paths. Each grid path is a grid sequence that starts from the grid b0 where the restaurant node v0 is located, passes through the grids where multiple customer nodes are located, and returns to b0. Initialize τ = 1. Step 2.1: Generate the τ-th individual p from the grid set B. μ,τ ; Step 2.2: Assign v+1 to τ. If τ ≤ PopSize, return to step 2.1; otherwise, it means that the population Pop of generation μ has been obtained. μ And proceed to step 3; Step 3: Based on the path cost generated from historical order data and the structural indicators of individuals, analyze the Pop population of the μth generation. μ Evaluation of individuals; Step 3.1: Construct the objective function of the grid path evaluation model using equation (9): In equation (9), f1 represents the objective function for minimizing the rank, Rank μ,τ p μ,τ The ranking, and Represents the τ-th individual p μ,τ The ranking in the α-th scenario is calculated by plotting the τ-th individual p. μ,τ Delivery route cost in scenario α We obtain; where cost μ,τ,β Represents the τ-th individual p μ,τ The delivery path cost in the βth time slice under the αth scenario is obtained using equation (1); f2 represents the objective function for density, and AreaRate represents the value of the τ-th individual p. μ,τ The sum of the ratios between the grid area occupied by each grid path and the bounding rectangle of the corresponding grid path; f3 represents the objective function for the degree of discreteness, and Dis represents the τ-th individual p. μ,τ The difference between the circumscribed rectangles of any two grid paths and the grid area occupied by the corresponding two grid paths, and the ratio between the circumscribed rectangles of the corresponding two grid paths, and summing all ratios. Step 3.2: Use equation (9) to analyze Pop of the μth generation population. μ Each individual is evaluated to obtain three target values for each individual, which are used as evaluation indicators for each individual; Step 3.2.1: Initialize τ = 1; Step 3.2.2: Initialize α = 1; Step 3.2.3, record individual p. μ,τ The length is len μ,τ , using p μ,τ Generate the αth historical scene Delivery routes for K1 time-slice orders; Step 3.2.4: Use formula (9) to calculate individual p. μ,τ The three target values; Step 3.2.5: After assigning τ+1 to τ, if τ≤PopSize, return to step 3.2.2; otherwise, it indicates that the population Pop of generation μ has been obtained. μ Three target values for each individual; Step 4: Based on the Pop of the μth generation population μ The evaluation criteria for each individual were used to generate the μth generation mating pool using the binary tournament method. Then, PopSize individuals in the μth generation mating pool were crossovered to obtain PopSize offspring individuals, which constitute the μth generation child population. μ ; Step 5: Following the process in Step 3.2, process the μth generation child population. μ Each offspring individual is evaluated to obtain three target values for each offspring individual; Step 6: Pop of the μth generation population μ With the μth generation offspring population Child μ Merging yields the μth generation merged population. And based on environmental selection strategies, the populations were merged from the μth generation. Select PopSize individuals and form the μ+1 generation population Pop. μ+1 ; Step 7: Assign μ+1 to μ, if μ <gen max If the iteration terminates, return to step 4 and continue execution; otherwise, the iteration terminates and the result is compared to the gen-th iteration. max Generation population As the final population Among them, gen max Indicates the maximum number of iterations; Step 8: Based on the final population For each individual, three target values are selected, and the ω individuals with the smallest first target value are chosen to form the guidance path. And used to generate new scene sets. The delivery routes, among which, This indicates the use of Scene to guide the creation of new scene sets. new The s'th grid path; Let α' be the α'-th online delivery scenario, and It contains K2 time slices, that is This represents the α'th online delivery scenario. The β'th time slice and It contains n2 orders; Step 9: Create a new scene set. new Generate delivery routes for each scenario; Step 9.1: Generate the α'th online delivery scenario. The delivery routes for each time slice are initialized with α' = 1; Step 9.1.1: Generate the β'-th time slice The delivery route is initialized with β' = 1; Step 9.1.2: Initialize the α'th online delivery scenario. The β'th time slice Delivery route set Step 9.1.3: Initialize s' = 1; Step 9.1.4, Use Generate the s'-th delivery route R' according to step 3.
2. α'β's' and R' α'β's' insert Step 9.1.5: Assign s'+1 to s'. If s'≤ω, return to step 9.1.4; otherwise, it indicates that the guiding path R is used. π The α'th online delivery scenario was generated. The β'th time slice The ω delivery routes for the order; Step 9.1.6: Calculate according to formula (1) The cost of each delivery route is calculated, and the delivery route with the lowest cost is selected as the time slice. Delivery routes in the middle; Step 9.1.7: Assign β'+1 to β'. If β'≤K2, return to step 9.1.2 and execute sequentially; otherwise, it indicates that the α'th online delivery scenario has been obtained. For the delivery routes of each time slot, proceed to step 9.2; Step 9.2: Assign α'+1 to α'. If α'≤P2, return to step 9.1.1 and execute sequentially, indicating that a new scene set, Scene, is obtained. new Delivery routes are generated for each scenario.
2. The route generation method for food delivery process according to claim 1, characterized in that, Step 2.1 includes: Step 2.1.1: Initialize p μ,v ={b0}, let p μ,τ The last grid in the array is denoted as b. end Initialize b end =b0; Randomly select n grids from grid set B as cluster centers. in, Indicates the first The cluster center will be connected with the first cluster center. Distance between cluster centers The most recent grid structure Class Indicates the relationship with the first Distance between cluster centers The most recent j'-th grid, Indicates the first The number of grids in each class; Step 2.1.2, Initialization Step 2.1.3, from the first Class Choose with b end The minth nearest grid And insert p μ,τ The end; Step 2.1.4, from Delete And update like If not empty, return to step 2.1.3; otherwise, insert b0 into p. μ,τ At the end, and update b end =b0, thus obtaining p μ,τ The Middle Grid paths; Step 2.1.5, Assign to like Then return to step 2.1.3; otherwise, it means that p has been obtained. μ,τ All grid paths in the array are processed, and step 2.2 is executed.
3. The route generation method for food delivery processes according to claim 2, characterized in that, Step 4 includes: Step 3.2.3.1: Let the τ-th individual p μ,τ Let b be the w'th grid in the grid path. μ,τ,w’ Initialize β = 1; Step 3.2.3.2: Define and initialize the αth historical scene. Delivery path R in the βth time slice α,β It is an empty set; Step 3.2.3.3: Initialize w' = 1, define and initialize the temporary delivery path R' = {v0}; Step 3.2.3.4, if b w' If b≠b0, proceed to step 3.2.3.5; otherwise, proceed to step 3.2.3.
6. Step 3.2.3.5, if grid b μ,τ,w’ There exist orders that satisfy equations (2)-(8) from grid b. μ,τ,w’ Select the order closest to the last node in R' from grid b. μ,τ,w’ After deleting and inserting at the end of R', repeat step 3.2.3.5; otherwise, proceed to step 3.2.3.
6. Step 3.2.3.6: Assign w'+1 to w', if w'≤len μ,τ If the condition is met, return to step 3.2.3.4; otherwise, insert v0 at the end of R', indicating that a delivery route R' has been obtained and will be inserted into R. α,β middle; Step 3.2.3.7: Determine individual p μ,τ If any unprocessed orders exist in each grid, return to step 3.2.3.3; otherwise, the α-th historical scene has been obtained. Determine the delivery route for the order placed in the βth time slice; and execute step 3.2.3.8; Step 3.2.3.8: Assign β+1 to β. If β≤K1, return to step 3.2.3.3; otherwise, obtain the α-th historical scene. individual p μ,τ Delivery routes for orders placed in time slot K1; Step 3.2.3.9: Assign α+1 to α. If α≤P1, return to step 3.2.3; otherwise, it means using p. μ,τ The delivery routes for K1 time-slice orders in all scenarios were generated, and step 3.2.3 was executed.
4. The route generation method for food delivery process according to claim 3, characterized in that, Step 4 includes: Step 4.1: Generate the μth generation mating pool; Step 4.1.1: Initialize the μ-th generation mating pool (MatingPool) μ ={}, τ=1; Step 4.1.2, from Pop μ Two individuals are randomly selected, and their Pareto dominance is determined based on evaluation indicators. The dominant individual is then placed into the MatingPool. μ If neither of the two entities is dominant, then an individual is randomly selected and placed into the MatingPool. μ middle; Step 4.1.3: After assigning τ+1 to τ, if τ≤PopSize, return to step 4.1.2; otherwise, it indicates that the μ-th generation mating pool, MatingPool, has been obtained. μ ; Step 4.2: Initialize the crossover mutation count q = 1, and initialize the offspring population Child of the μth generation. μ ={}; Step 4.3, from MatingPool μ Select two adjacent individuals p μ,2q-1 With p μ,2q And use the crossover operator to generate two offspring individuals. and Step 4.4: Assign q+1 to q, if the condition is met. Then return to step 4.3 and execute sequentially; otherwise, it indicates that the μ-th generation offspring population (Child) has been obtained. μ .
5. The route generation method for food delivery process according to claim 3, characterized in that, Step 4.3 includes: Step 4.3.1: Let the 2q-1th individual... The 2qth individual in and They represent p respectively μ,2q-1 With p μ,2q The h-th visited grid, H 2q-1 With H 2q Let p represent the 2q-1th individual. μ,2q-1 With the 2qth individual p μ,2q The sequence length; Step 4.3.2, from p μ,2q-1 With p μ,2q Two temporary grid sets are formed by randomly selecting k grids from each grid. and From p μ,2q-1 Delete In the grid, generate the 2q-1th temporary individual p' μ,2q-1 From p μ,2q Delete In the grid, generate the 2qth temporary individual p' μ,2q ; Step 4.3.3, will Grid insertion p' μ,2q Generate the 2qth offspring individual Will Grid insertion p' μ,2q-1 Generate the 2q-1th offspring individual. Step 4.3.4: Randomly generate a value P. If P > P c If so, proceed to step 4.3.5; otherwise, proceed to step 4.3.
5. and Place in Child μ , where P c It is the mutation probability, and P∈[0,1],P c ∈[0,1]; Step 4.3.5, for and Perform a mutation operation to obtain the 2qth offspring individual after the mutation. With the 2q-1th offspring And put it into Child gen .
6. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports the processor in executing any of the route generation methods of claims 1-5, the processor being configured to execute the program stored in the memory.
7. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program, when run by a processor, performs the steps of any of the route generation methods described in claims 1-5.
Citation Information
Patent Citations
take-out distribution path selection method based on a modern investment portfolio theory
CN109583634A
Logistics distribution line generation method and device
CN110490510A
