A method for real-time delivery task allocation based on a two-stage metaheuristic algorithm
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-13
- Publication Date
- 2026-08-14
AI Technical Summary
[0003]然而,现有技术在大规模即时配送任务分配场景中仍存在较为突出的局限性,且其原因多源于问题结构本身的复杂性与多目标冲突性:(1)候选边爆炸导致计算不可控
1.本发明方法面向外卖平台的订单分配问题,针对“订单×骑手”规模过大导致候选边爆炸、后续MCMF与元启发式算法计算成本高的问题,提出一种“时空过滤+区域软约束+混合效用建模”的候选生成方法,在保留高质量候选者的同时,极大节约了候选解构造的成本。
Smart Images

Figure CN122022101B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of on-demand delivery, and more specifically to an on-demand delivery task allocation method based on a two-stage metaheuristic algorithm. Background Technology
[0002] Instant delivery task allocation can typically be abstracted as a matching optimization of "order set - rider set": orders are demand nodes, riders are resource nodes, and feasible connections are formed between them based on conditions such as spatial distance, arrival time, promised delivery time limit, business district restrictions, and rider capacity. Revenue or cost is defined on these connections. The instant delivery task allocation process usually involves: first, processing orders in batches (e.g., windowed or rolling time slots) on the timeline; second, constructing order-rider candidate edges and calculating edge weights; third, calling the solver to obtain the allocation results; and finally, outputting the results and updating rider status to proceed to the next batch.
[0003] However, existing technologies still have significant limitations in large-scale instant delivery task allocation scenarios, and the reasons for this are mostly due to the complexity of the problem structure itself and the conflict of multiple objectives: (1) Candidate edge explosion leads to uncontrollable computation. In real business, the number of orders and riders are both large. If the full "order × rider" utility matrix is directly constructed, the number of edges will increase exponentially, causing memory usage and solution scale to quickly exceed the acceptable range. Even if network flow or matching algorithms are used, their time and space complexity will be amplified by the size of candidate edges, resulting in engineering problems of "model can be built but cannot be solved" or "solution is very slow". The fundamental reason is that feasible connection edges are determined by multiple factors such as geographical proximity, time accessibility, business district restrictions, and rider status, and these factors change over time, resulting in non-stationary candidate sets that are difficult to fix. (2) Single-objective solutions are difficult to express the platform's true preferences, and multi-objective constraints are easily "marginalized". Many precise optimization methods tend to focus on a single indicator (such as maximizing total cost or total utility) in terms of objectives. Fairness, peak coverage, and overload penalties are often achieved through additional constraints or post-processing. However, when resources are scarce during peak periods, a single objective will naturally tend to "let a few efficient riders take on more orders," resulting in problems such as highly concentrated load, idle riders at the tail end, and fluctuating service experience. The reason is that there is a natural conflict between fairness and total utility. If the fairness constraint is set too hard, it is easy to cause the feasible region to shrink sharply and the coverage to drop. If it is set too soft, it is difficult to play the constraint role, resulting in the phenomenon of "the model is written but the result is out of control." (3) Mixed modeling of peak / off-peak periods leads to "local optima" and "time period crowding." Many online or windowed methods process orders in fixed windows and solve independently or make local greedy decisions within each window. This structure will bring typical problems: the front window consumes more high-quality rider capacity in order to improve local indicators, resulting in insufficient available capacity in the back window (especially at the end of the peak period), resulting in a sharp drop in coverage or a large number of orders that can only be allocated to riders at a distance. The reason is that the time distribution of order flow is highly uneven, and the fixed window cannot adapt to the changes in peak and valley; at the same time, rider capacity belongs to cross-window shared resources. If there is no consistent constraint mechanism of "cross-window budget / soft capacity", unreasonable consumption of resources on the time axis will occur. (4) Pure metaheuristic methods are highly sensitive to the quality of initial solution and parameters, and lack stability and reproducibility. Although methods such as GA / NSGA-II / ALNS can explore better solutions under complex constraints, two types of problems often occur in engineering: First, if the initial solution is poor or the quality of candidate edges is insufficient, it is difficult to enter the high-quality region in the early stage of the search, the convergence is slow and the results fluctuate greatly; Second, the combination space of parameters such as operator selection probability, cross-mutation probability, and penalty weight is large, and there is no unified parameter calibration mechanism. It often requires a lot of manual parameter tuning, resulting in high application cost and difficulty in cross-scenario migration.The reason is that the utility evaluation and constraints of delivery task allocation are strongly coupled (timeliness, punctuality, distance, capacity, fairness, etc. affect each other), and the dimensions and sparsity of indicators differ significantly in different scenarios (peak hours, small peak hours, all day), making it difficult to be compatible with fixed parameters. (5) The two-stage structure of "one-stage completion" or "entering the secondary search without threshold" is prone to causing waste of computing power or mis-optimization. Some schemes use local search as a general post-processing and perform secondary search on all evolved solutions or all individuals. This structure will significantly increase the operating cost in large-scale scenarios and may ineffectively strengthen low-quality individuals, or even destroy coverage or sacrifice utility due to the directional deviation of local search. The reason is that the benefits of local search are usually concentrated near elite solutions that are "already in high-quality areas". If there is a lack of entry conditions (such as coverage threshold, utility lower bound, stability criterion, etc.), the secondary search cannot bring benefits that match its computational cost. In summary, existing technologies, under the constraints of large-scale, multi-time period, and multi-objective real-time delivery, still generally suffer from the following problems: difficulty in controlling the size of candidate edges, unstable peak coverage, difficulty in balancing fairness and utility, high parameter tuning costs, and efficiency issues caused by the lack of an effective threshold for two-stage search. The root cause of these problems lies in the significant spatiotemporal dynamics and multi-objective conflicts in delivery task allocation, and the fact that the feasible region is jointly determined by the quality and capacity constraints of candidate edges. Once the candidate construction or constraint mechanism is unreasonable, it is difficult for any subsequent solver or metaheuristic to simultaneously obtain a stable result of "high coverage, high efficiency, and controllable fairness" within a finite time.
[0004] Therefore, how to provide a two-stage task allocation method that takes into account feasible domain size control, multi-objective global search, and secondary reinforcement of elite threshold is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] In view of this, the present invention provides a real-time delivery task allocation method based on a two-stage metaheuristic algorithm. In the candidate generation stage, it reduces edge size and improves candidate quality; in the global search stage, it outputs a Pareto front using a multi-objective mechanism; and in the second stage, it performs local reinforcement only on elite solutions that meet the threshold conditions. This further improves fairness and controls operating costs while ensuring that coverage does not deteriorate. The connection relationship between the modules is as follows: candidate edges and the utility matrix serve as common inputs; MCMF serves as the initial solution generator; NSGA-II serves as the first-stage global searcher; the local searcher serves as the second-stage elite reinforcement module; and finally, the Pareto solution set and the index summary results are output.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: This invention discloses a real-time delivery task allocation method based on a two-stage metaheuristic algorithm, comprising: Step 1: Construct the mixed utility matrix for order riders and generate a candidate edge set; Step 2: Based on the hybrid utility matrix, calibrate the utility parameters and determine the baseline parameters; Step 3: Based on the hybrid utility matrix, the candidate edge set, and the baseline parameters, construct the MCMF model using dynamic TopK pruning and time-segmented soft capacity constraint methods to generate an initial solution for MCMF; Step 4: Based on the initial solution of MCMF, the final delivery task allocation result is obtained by using the two-stage multi-objective task allocation optimization method of NSGA-II and ALNS.
[0007] Furthermore, step 1 specifically includes: Step 1.1: Based on the locations of riders, merchants, and pickup points, as well as waiting business constraints, construct an order completion time prediction model; Step 1.2: Construct a hybrid utility function based on the promised delivery time of the order; Step 1.3: Based on the soft neighborhood of the business district, generate a candidate edge table through KDTree spatiotemporal filtering; Step 1.4: Deduplicate and merge the candidate edge tables and write them into the hybrid utility matrix; at the same time, calculate the order candidate degree index and the number of candidate riders per order and output the merged log; Step 1.5: Perform TopK pruning and K=150 replacement on the mixed utility matrix to obtain the candidate edge set.
[0008] Furthermore, the order completion time prediction model is expressed as follows: ; ; ; in, Represent two points on the sphere distance, and For the corresponding latitude, This represents the latitudinal distance between points a and b, i.e. , This represents the longitude distance between two points a and b, i.e. R = 6,371,000 meters; This indicates the travel time from the rider's location to the merchant. Indicates the rider's valid position. Indicates the merchant's order. This indicates the delivery time from the merchant to the pickup point. Indicates the receiving point. Indicates rider speed; Indicates the time to pick up the food. Indicates the time when the order is pushed. Indicates the time when meal preparation is completed. Indicates the time when the order was completed; The mixed utility function represents: ; ; ; ; in, , and These represent completion utility, punctuality utility, and timeliness utility, respectively. These represent the corresponding weight parameters. Indicates mixed utility; Indicates the on-time attenuation scale. Indicates the time-related decay coefficient. This indicates the promised delivery time for the order.
[0009] Furthermore, step 2 specifically includes: Step 2.1: Construct a subset of calibrated orders based on the full set of order details; Step 2.2: Construct a parameter grid set centered on the punctuality penalty scale parameter and the aging decay parameter. Step 2.3: Quickly recalculate the mixed utility of each group of parameters in the parameter grid set based on power transform; Step 2.4: Using the simplified MCMF equivalent assignment method of argmax, evaluate the coverage and average mixed utility of each group of parameters in the parameter grid set; Step 2.5: Using the order placement time and estimated delivery time in the calibrated order subset, evaluate the service performance index (CTD) and comprehensive evaluation index for each set of parameters in the parameter grid set. ; Step 2.6: Calculate the normalized comprehensive evaluation index and select the benchmark parameters.
[0010] Furthermore, step 2.3 specifically includes: In relation to the specified order subset The corresponding mixed utility matrix Above, to and The parameter transfer is achieved using a power transform, and the formula is as follows: ; in, Indicates parameters The corresponding time-sensitive utility, Indicates the time-related decay coefficient. , Indicates parameters The corresponding punctuality utility This represents the punctuality penalty scale parameter. Second; For each set of parameters The formula for calculating mixed utility is: ; in, Indicates parameters The corresponding mixed utility, Indicates completion utility These represent the corresponding weight parameters; Step 2.4 specifically includes: For each order Select the candidate rider with the highest mixed utility directly. , obtain the allocation set The formula is: ; Each set of parameters Output the allocation results and record the coverage. With average mixed utility The formula is: ; in, This represents a set of matching order-rider pairs. Indicates in the parameter The number of matching pairs obtained. This indicates the size of the order subset used for calibration parameters.
[0011] Furthermore, step 3 specifically includes: Step 3.1: Perform data input and sign unification based on the hybrid utility matrix, the candidate edge set, and the benchmark parameters; Step 3.2: Construct a dynamic window and calculate the peak ratio of the window. Map the dynamic TopK threshold according to the peak ratio of the window and calculate the non-peak capacity ratio. Step 3.3: Filter the input data using dynamic TopK pruning and K=150 backoff mechanism; Step 3.4: Divide the rider group into time-segmented capacities based on the off-peak capacity ratio, and set a soft upper limit and a daily total capacity gate; Step 3.5: Introduce a fair penalty term into the edge weights based on the segmented load rate; Step 3.6: Based on the data filtered in Step 3.3, the capacity allocation, soft upper limit, and total daily capacity gate in Step 3.4, and the fair penalty term, perform MCMF modeling and solution; Step 3.7: Based on the MCMF solution, update the rider status by submitting a rolling commit via Horizon. Step 3.8: Perform result derivation calculations and interpretable outputs on the results submitted in Step 3.7 to finally obtain the initial allocation result.
[0012] Furthermore, step 4 specifically includes: Step 4.1: Determine the decision variables and constraints of the multi-objective optimization model; Step 4.2: Determine the objective function of the multi-objective optimization model; Step 4.3: Initialize the population using the initial solution of the MCMF as the anchor point, and perform NSGA-II global multi-objective search for a large-scale feasible domain; Step 4.4: Extract Pareto elite solutions from the output population of Step 4.3 and perform ALNS local search to obtain the final allocation results.
[0013] As can be seen from the above technical solution, compared with the prior art, the present invention provides a real-time delivery task allocation method based on a two-stage metaheuristic algorithm, which has the following beneficial effects: 1. The method of this invention addresses the order allocation problem of food delivery platforms. To solve the problem of candidate edge explosion caused by the excessive size of "order × rider" and the high computational cost of subsequent MCMF and metaheuristic algorithms, a candidate generation method of "spatiotemporal filtering + regional soft constraints + hybrid utility modeling" is proposed. This method greatly saves the cost of constructing candidate solutions while retaining high-quality candidates.
[0014] 2. This invention introduces Gaussian penalty and exponential decay to construct a hybrid utility score, which simultaneously incorporates the timeliness, efficiency and completion of the task into the evaluation system of order utility, truly reflecting the impact of timeout and dispatch distance on user experience and rider costs, and is more suitable for real-world order allocation scenarios.
[0015] 3. This invention uses power transformation mapping and grid search to effectively adjust the utility function parameters, making the platform performance more in line with business SLA requirements, and selects the optimal parameters for subsequent optimization; 4. In step 3, a dynamic TOPK+SoftCapMCMF model is constructed, which introduces load borrowing and penalty mechanisms to simultaneously maximize order coverage and balance rider load. At the same time, NSGA-II and ALNS are integrated, multi-objective evolution is adopted to improve the robustness of the solution, and fair solutions are strengthened through local search and destruction-repair, which significantly improves the order service rate during peak periods.
[0016] In summary, the two-stage task allocation method based on metaheuristic algorithms demonstrates comprehensiveness, flexibility, global search capability, and local optimization capability. This enables the order dispatch algorithm to improve overall delivery efficiency while effectively reducing the uneven load among different riders, which is conducive to improving platform capacity utilization and rider satisfaction. It is suitable for solving the task allocation problem with large supply and demand fluctuations in multiple peak scenarios throughout the day. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0018] Figure 1 This is a schematic diagram of the overall process of the present invention.
[0019] Figure 2 A schematic diagram of the two-stage multi-objective task allocation optimization method provided by the present invention.
[0020] Figure 3 This is a schematic diagram of the 2D Pareto results provided by the present invention.
[0021] Figure 4 This is a schematic diagram of the 3D Pareto front provided by the present invention. Detailed Implementation
[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0023] This invention discloses a real-time delivery task allocation method based on a two-stage metaheuristic algorithm, such as... Figure 1 As shown, it includes: Step 1: Construct the mixed utility matrix for order riders and generate a candidate edge set; Step 2: Calibrate utility parameters based on the mixed utility matrix and determine the baseline parameters; Step 3: Based on the mixed utility matrix, candidate edge set, and baseline parameters, construct the MCMF model using dynamic TopK pruning and time-segmented soft capacity constraint methods to generate the initial solution of MCMF; Step 4: Based on the initial solution of MCMF, the final delivery task allocation result is obtained through the two-stage multi-objective task allocation optimization method of NSGA-II and ALNS.
[0024] Specifically, this implementation example provides a two-stage task allocation method that combines a minimum cost maximum flow (MCMF) initial solution with multi-objective evolutionary optimization (NSGA-II), and incorporates the "disruption-repair" idea of adaptive large neighborhood search (ALNS) and Pareto elite fairness local search. This method is used for multi-objective optimization and comparative evaluation of the food delivery order-rider matching problem. First, peaks are automatically identified and dynamically mapped using dynamic time windows and density proportions to achieve adaptive candidate size. Second, a feasible baseline is anchored using the MCMF initial solution, and structured perturbations are performed around the "overloaded / unserved order index." Third, a Pareto front is generated using multi-objective NSGA-II, and the ALNS idea is embedded through a combined mutation operator with a "disruption-repair" mechanism. Finally, a fairness elite local search is added at the front level, employing strict acceptance criteria to ensure coverage and utility stability. This constitutes a two-stage task allocation optimization of global evolution and elite fine-tuning, further optimizing the Pareto front in terms of fairness.
[0025] In one specific embodiment, step 1 specifically includes: Step 1.1: Based on the locations of riders, merchants, and pickup points, as well as waiting business constraints, construct an order completion time prediction model; Step 1.2: Construct a hybrid utility function based on the promised delivery time of the order; Step 1.3: Based on the soft neighborhood of the business district, generate a candidate edge table through KDTree spatiotemporal filtering; Step 1.4: Deduplicate and merge the candidate edge tables and write them into the hybrid utility matrix; at the same time, calculate the order candidate degree and the number of candidate riders per order and output the merged log; Step 1.5: Perform TopK pruning and K=150 replacement on the mixed utility matrix to obtain the candidate edge set.
[0026] Specifically, this invention is a two-stage task allocation method based on metaheuristic algorithms, characterized in that it is applied to order sets. Meet with riders In, any order o rider and several designated business districts The service scenario is as follows: In this scenario, the order data must contain at least the following information: order identifier (order_id), business district identifier (da_id), merchant coordinates (sender_lat, sender_lng), delivery point coordinates (recipient_lat, recipient_lng), order push time (order_push_time), meal preparation completion time (estimate_meal_prepare_time), platform promised delivery time (estimate_arrived_time), rider identifier (courier_id), and rider capture location (grab_lat, grab_lng).
[0027] In a specific embodiment, in step 1.1, the order completion time prediction model is represented as follows: ; Convert the rider's average speed from km / h to vm / s, and then calculate the two travel times: ; Considering the business constraint that stores need to wait if food preparation is completed earlier, the pick-up time and completion time are defined as follows: ; in, Represent two points on the sphere distance, and For the corresponding latitude, This represents the latitudinal distance between points a and b, i.e. , This represents the longitude distance between two points a and b, i.e. R = 6,371,000 meters; This indicates the travel time from the rider's location to the merchant. Indicates the rider's valid position. Indicates the merchant's order. This indicates the delivery time from the merchant to the pickup point. Indicates the receiving point. Indicates rider speed; Indicates the time to pick up the food. Indicates the time when the order is pushed. Indicates the time when meal preparation is completed. Indicates the time when the order was completed.
[0028] In step 1.2, based on the promised delivery time of the order... We construct three basic types of utility and merge them into a mixed utility, represented by the mixed utility function: ; ; ; ; in, , and These represent timeliness utility, punctuality utility, and overall timeliness utility (completion utility: whether the rider completes the task within the promised time; punctuality utility: the rider's punctuality utility relative to the promised completion time (ETA); timeliness utility: the timeliness utility of the time consumed from task submission to completion). These represent the corresponding weight parameters. Indicates mixed utility; Indicates the on-time attenuation scale. Indicates the time-related decay coefficient. The order promises to be delivered at the specified time. Equation (4) represents the completion utility of whether the order is completed within the promised time; Equation (5) represents the on-time utility relative to the promised time, with a stronger penalty for larger deviations; Equation (6) represents the timeliness utility of the time consumed from push to completion; Equation (7) represents the weighted fusion of the three, used for the unified measurement of subsequent MCMF edge weights and metaheuristic objectives.
[0029] In step 1.3, to reduce the cost of full matching of "orders × riders", this invention uses "business district segmentation + neighborhood soft constraints + KDTree radius query" to generate candidate edge sets, specifically: Step 1.3.1 Construction of the Business District Center and Neighbor Set: The average coordinates of all order merchants within the same business district da_id are used as the geometric center of the business district, and a neighbor set is constructed for each business district. If the distance between other business district centers and the neighbor is no more than neighbor_radius_m, then include it as a neighbor; if the radius is empty, then select the nearest neighbor_topk business districts as neighbors.
[0030] Step 1.3.2 Sample Pool and Time Filtering: Construct a sample table `samples` from historical order records. Each sample contains `courier_id`, `da_id`, `lat`, `lng` (order location), and `sample_time`, where `sample_time` is the order push time, used to characterize the rider's available location observations at different times. For orders... o Only retain The sample is designed to satisfy the temporal causal constraint that the candidate location must have appeared before the order is pushed.
[0031] Step 1.3.3 KDTree Radius Query and Minimum Candidate Guarantee: For orders within each business district (da), only... Candidates are queried from the sample pool; a radius query is performed on the merchant coordinates based on KDTree, with the radius being radius_m (default 5km). If the number of candidates is less than min_cands, the radius is widened to 1.5 times and the query is repeated to reduce the risk of no candidates due to "isolated orders".
[0032] Step 1.3.4 Spherical distance refinement and rider deduplication: For candidate samples that hit the radius, use formula (1) to calculate the spherical distance dist_m between them and the merchant point and sort them in ascending order of distance; if the optional Top-K clipping parameter k is enabled, then truncate to the first k candidates; then only keep the closest sample for the same courier_id, so as to ensure that "each order × each rider has at most one candidate edge".
[0033] Step 1.3.5 Candidate Edge Utility Calculation and Block Placement: For each order - candidate rider pair o , r Calculate according to formulas (2)-(7) It also includes its components, and outputs a candidate edge table for the columns order_id, courier_id, utility_tim (overall timeliness utility), utility_ont (punctuality utility), utility_cmp (timeliness utility), and utility_mix (mixed utility).
[0034] In step 1.4, after deduplication of order_id and courier_id, they are written into the hybrid utility matrix; at the same time, the mean and quantile of the number of candidate riders per order are calculated, and the merged log is output.
[0035] In step 1.5, after obtaining the full candidate edge matrix, for each order, its candidate rider set is calculated according to the mixed utility. Sort the edges in descending order and keep the top K candidates to obtain the TOPK candidate edge set: ; in This is used to control the scale of subsequent MCMF mapping; when an order has no candidates or insufficient feasible candidates to support allocation under its corresponding K, a supplementary mechanism is triggered, using K=150 to expand the candidate set to improve the order completion rate. ; Mode This represents the TOPK candidate set obtained by sorting by mixed utility; (Equation) This represents a trade-off between pruning K and achieving completion rate: prioritizing cost reduction for K, as the order-rider density ratio rapidly increases after the daily order peak, leading to rider scheduling difficulties, K may need to be increased to 150 if necessary, sacrificing some runtime to ensure allocability. Subsequently, the "TOPK candidate edge set + hybrid utility matrix" is obtained, serving as the unified input for the subsequent MCMF initial solution and the two-stage metaheuristic algorithm.
[0036] In one specific embodiment, step 2 specifically includes: Step 2.1: Construct a subset of calibrated orders based on the full set of order details; Step 2.2: Construct a parameter grid set centered on the punctuality penalty scale parameter and the aging decay parameter. Step 2.3: Fast recalculation of the mixed utility of each set of parameters in the parameter grid based on power transform; Step 2.4: Using argmax's simplified MCMF equivalent assignment method, evaluate the coverage and average mixed utility of each set of parameters in the parameter grid set; Step 2.5: Using the order placement time and estimated delivery time from the calibrated order subset, evaluate the service metrics CTD and comprehensive evaluation metrics for each parameter group in the parameter grid set. ; Step 2.6: Calculate the normalized comprehensive evaluation index and select the benchmark parameters.
[0037] Specifically, let the order set be The riders gathered as The candidate edge set is For any order rider The SOFT hybrid utility matrix output from step 1 is given in the form of a side table. Baseline utility column: The reference parameters are taken as follows: Second, Define the parameter vector to be calibrated. ,in This represents the punctuality penalty scale parameter. >0 indicates the aging decay parameter, and ∈[0,1] represents a mixed weight used to reflect the platform's preference for on-time performance, overall timeliness, and punctuality. This stage outputs the baseline parameters. This allows for unified calls to be made in subsequent stages of MCMF initial solution and metaheuristic two-stage optimization.
[0038] In step 2.1, to reduce the cost of full-scale computation and ensure statistical representativeness, a subset of labeled orders is randomly selected from the full set of order details. The sampling size is 10% of the orders. The order table is filtered to obtain... The output is orders_calib.parquet, and the result is obtained by filtering from the utility matrix. The output is soft_calib.parquet to ensure that subsequent calibration is performed only on this subgraph.
[0039] In step 2.2, a parametric mesh set is constructed. Specifically, based on the benchmark A finite network structure is constructed around the center, and four sets of weight scenarios are constructed. , , Thus forming Group candidate parameters. For each group of candidate parameters... The numerical values, scaling factors, and their corresponding output files are used for subsequent group-by-group execution and review.
[0040] In step 2.3, fast recalculation is performed based on power transform. The following steps, 2.3, specifically include: Step 2.3.1, in Step 1, the timeliness and punctuality utility are expressed in an exponential form from the benchmark. Generate, to avoid generating each group Recalculate high-cost intermediate quantities such as distance / time, in conjunction with the standard order subset. The corresponding mixed utility matrix Above, that is, on soft_calib.parquet and The parameter transfer is achieved using a power transform, and the formula is as follows: ; in, Indicates parameters The corresponding time-sensitive utility, Indicates the time-related decay coefficient. , Indicates parameters The corresponding punctuality utility This represents the punctuality penalty scale parameter. Seconds; to ensure numerical stability, Exponentiation.
[0041] Step 2.3.2, for each set of parameters The formula for calculating mixed utility is: ; in, Indicates parameters The corresponding mixed utility, Indicates completion utility These represent the corresponding weight parameters; and according to the formula... Output this The corresponding submatrix contains the following fields: baseline utility column and... Utility column , , , .
[0042] In step 2.4, the MCMF equivalent assignment argmax is simplified to evaluate the parameters. Step 2.4 specifically includes: Step 2.4.1 is to quickly evaluate each group during the calibration phase. Regarding the impact of "side utility ranking," under the assumption that "rider capacity does not constitute a major bottleneck," the full-scale MCMF network is no longer explicitly constructed for each order. Select the candidate rider with the highest mixed utility directly. , obtain the allocation set The formula is: ; Under this assumption, the process is consistent with the "maximum weight matching / maximum weight flow without capacity constraints", thus enabling it to approximate the effect of parameters on allocation tendency at extremely low cost.
[0043] Step 2.4.2: For each group The allocation result is output as mcmf_assign_theta_.parquet, and the coverage is recorded. With average mixed utility The formula is: ; in, This represents a set of matching order-rider pairs. Indicates in the parameter The number of matching pairs obtained. This indicates the size of the order subset used for calibration parameters.
[0044] Step 2.5 mainly involves calculating service indicators (CTD), lateness rate, and comprehensive evaluation. Step 2.5 specifically includes: Step 2.5.1 Use the order time in orders_calib.parquet Compared with the estimated delivery time Calculate the target click-to-door (click-to-door, a delivery time metric, representing the total time from order creation to delivery to the user, formula 14): ; in, This indicates the promised duration of order 'o', i.e., the click-to-door time given by the platform, used to determine lateness.
[0045] Step 2.5.2 involves restoring the "true timeliness dimension" from the allocation results and assessing the baseline timeliness utility. Inverse solution is obtained
[0046] ; in, This indicates the estimated time it will take rider r to complete order o.
[0047] And for orders Allocation edge calculate .
[0048] Step 2.5.3 Define the duration and percentage of late arrivals: ; in, This represents the lateness duration of order o. If the actual CTD (time delay) does not exceed the target, it is set to 0; otherwise, it is set to the exact value of the lateness duration. This indicates the promised delivery time for order 'o', specifically the click-to-door time provided by the platform, used to determine lateness. Indicate the percentage of late arrivals; and compile statistics. The mean and quantiles, such as p90, are used as indicators of service level.
[0049] Step 2.5.4 Construct a comprehensive deviation function oriented towards business targets. For the "smaller the better" metric, only the portion exceeding the target is penalized; for the "larger the better" metric, the average utility is represented by the gap. ; ; ; ; ; in, This means that only the portion exceeding the target will be punished. , Indicates parameters The average CTD of the allocated orders. This represents the average target value set by the business. Indicates the degree of deviation. This represents the 90th percentile of the CTD (Content To be Measured), meaning that 90% of orders have a CTD that does not exceed this value. This indicates a business objective: a 90th percentile deviation of ≤40 minutes. Indicates the degree of deviation. Indicates the lateness rate, This indicates a business goal: a lateness rate of ≤10%. Indicates the degree of utility deviation, expressed as 1- Default weights And allow adjustments according to operating standards.
[0050] In step 2.6, normalized comprehensive indicators are performed. The calculation and selection of benchmark parameters involve the following steps: Step 2.6.1 To avoid ranking bias caused by differences in the units and ranges of different indicators, in the overall... The core metrics are normalized using a min-max method: ; like If the indicator has no discriminative power, then that item should be set to zero; for items where "the greater the utility, the better"... Inverse normalization is used: ; Step 2.6.2 Construct the normalized comprehensive score: ; in, , , and These represent the weights of each deviation item in the normalized composite dashboard, used to express business priority. (Default) ;according to Sort by size from smallest to largest, using the smallest as the benchmark. It outputs theta_eval_with_Jcalib.csv, which can be directly read in subsequent stages. .
[0051] In one specific embodiment, step 3 specifically includes: Step 3.1: Based on the mixed utility matrix, candidate edge set, and baseline parameters, perform data input and sign unification; Step 3.2: Construct a dynamic window and calculate the peak ratio of the window, map the dynamic TopK threshold according to the peak ratio of the window, and calculate the off-peak capacity ratio; Step 3.3: Filter the input data using dynamic TopK pruning and K=150 backoff mechanism; Step 3.4: Divide rider groups into time-segment capacity based on off-peak capacity ratio, and set soft upper limits and daily total capacity gates; Step 3.5: Introduce a fair penalty term into the edge weights based on the segmented load rate; Step 3.6: Based on the data filtered in Step 3.3, the capacity allocation, soft upper limit and total daily capacity gate in Step 3.4, and the fair penalty term, perform MCMF modeling and solution; Step 3.7: Based on the MCMF solution, update the rider status by submitting a rolling commit via Horizon. Step 3.8: Perform result derivation calculations and interpretable outputs on the results submitted in Step 3.7 to finally obtain the initial allocation results.
[0052] Specifically, this section calculates three types of sub-utilities based on the comprehensive utility matrix obtained in steps S1 to S2 above, i.e., for any order o and rider r. and overall utility ,in Based on the baseline parameters obtained from the second part of the calibration, a high-coverage, feasible, and fair preliminary solution for MCMF is further generated for subsequent metaheuristic fine-tuning. The key to this preliminary solution lies in the combined effect of dynamic windows and dynamic TopK candidate sets, time-segmented capacity and soft upper limits, and borrowing mechanisms and fair penalties, thereby improving peak-hour serviceability and global load balancing without significantly increasing computational costs.
[0053] Step 3.1 is mainly used to unify the input data and symbols. The specific steps are as follows: Step 3.1.1 Read the order set For each order At least include the push time. Compared with the platform's estimated arrival time Represented by timestamps in seconds, and by Sort in ascending order to construct an online rolling allocation sequence, containing the fields: order_id, order_push_time, and estimate_arrived_time.
[0054] Step 3.1.2 Read the candidate edge table. Candidate edges are triples. .
[0055] Step 3.1.3 Candidate edge table path rules: When When the candidate edge list is active, the corresponding TopK pruning utility matrix is used; when a backoff is triggered, the utility matrix with K=150 is used. The consistency of this path assignment rule is guaranteed by the candidate path resolution function in the implementation.
[0056] Step 3.2 is mainly used for dynamic window construction and dynamic K-determination of order density driving. The specific steps are as follows: Step 3.2.1 Construct an online scrolling window sequence Let the starting point of the current window be t, and count the number of orders within the next 180 seconds. The window length is adaptively determined based on order density. :when Take 180 seconds; when Choose 120 seconds; otherwise choose 60 seconds, thus using a finer-grained window during peak periods and a longer window during off-peak periods to reduce the number of solutions.
[0057] Step 3.2.2 For each window Define the number of orders per hour. And calculate the peak ratio of the window: Where |O| represents the total number of orders for the entire day or for this scenario. In the implementation, the number of orders is calculated by backtracking one hour from the window's end index and dividing by the total number of orders. .
[0058] Step 3.2.3 According to Mapping dynamic TopK threshold Follow the rule of left-closed, right-open, and last gear right-closed:
[0059] Considering the surge in orders during peak hours, which could lead to a shortage of candidate riders and difficulties in order allocation, an "absolute volume safety net" is introduced: when the number of orders in a given window... Force boost when a given threshold is reached ,For example This is to avoid insufficient candidates due to the proportional threshold in high-density windows.
[0060] Step 3.2.4 Define whether the window is peak: If Then record For peak window i 1, This represents the threshold for determining peak orders, based on a certain window density ratio. If the threshold is exceeded, the window is marked as a peak. Furthermore, in smaller peak scenarios, to ensure that the capacity allocation is consistent with the actual peak ratio of the scenario, the peak order ratio can be estimated based on the rolling 1-hour peak ratio. Based on this, the proportion of off-peak capacity is calculated.
[0061] Step 3.3 is mainly used for constructing the TopK candidate set and ensuring the feasibility of the K=150 backoff mechanism. The specific steps are as follows: Step 3.3.1 Generate the TopK candidate edge table. For each order... o All of its candidate riders were selected by Sort in descending order, extract the first K items, and form The corresponding script for this process sorts utility_mix and truncates it by order group, such as K=25 / 50 / 75 / 100.
[0062] Step 3.3.2 Construct a candidate table and fallback table with K=150. In some embodiments, to reduce I / O requirements and improve generation efficiency, a database window function is used to calculate the ranking of each order. and retain Records: , and will As a column _rk Write to Parquet, where This represents a window function that expresses the rank number of each row after grouping and sorting. This represents the set of 150 candidate edges with the highest retention utility for each order.
[0063] Step 3.3.3 Rollback Trigger Condition: For any order o After applying "remaining capacity feasibility filtering" to candidate riders, if the number of feasible candidates is less than the threshold... Then forced from Re-filter to obtain expanded candidates, and record the actual candidate size used for the order: used_k=150.
[0064] Step 3.4 is mainly used to ensure the feasibility and controllability of time-based capacity, soft upper limit, and total capacity gate. The specific steps are as follows: Step 3.4.1 Initialize the rider set For each rider Given the total capacity for the day In the implementation, random integers can be generated according to rules, with a fixed random seed to ensure consistency in implementation.
[0065] Step 3.4.2 Time-based capacity allocation: Introducing off-peak capacity ratio The total capacity is broken down into off-peak and peak capacities: ; in, Indicates off-peak capacity. This indicates peak capacity.
[0066] Step 3.4.3 Soft-cap design: Set a soft factor Then the soft upper limit for each segment is: ; in, This indicates the permissible overspending limit for rider r in this segment. This indicates the base capacity quota available to rider r in this segment. This indicates a segmentation between peak and off-peak periods, with values ranging from "off" (off-peak) to "peak" (peak-peak); and is based on the currently committed load. Calculate the two types of available capacity, and the basic available quantity. With excess available quantity The formula is: ; quantity ; in, Indicates available capacity. This indicates the number of orders that rider r has submitted in this segment.
[0067] Step 3.4.4 Hardgate for total daily orders: This strictly limits the number of orders a rider can accept in a single day. H is the daily hard limit. This represents the rider's total cumulative load across all scenarios (regardless of peak hours). If the rider is not assigned a ride in subsequent windows, the total number of rides accepted will not exceed the hard limit.
[0068] Step 3.5 is mainly used for the calculation and symbolic unification of FairnessPenalty, specifically including: To avoid the phenomenon of "locally overloaded riders being continuously selected" during peak or off-peak periods, this embodiment introduces a penalty term related to load rate in the edge weights. The aim is to achieve a combination of above-average penalty + above-1 penalty + below-average reward. This sets the segmented load rate... ; and order This represents the average load rate of all riders within the same segment. In the implementation, peak / off rates are calculated separately. and .in, Indicates to The cutoff upper limit, peak / off represents the load ratio calculated for peak and off-peak periods compared to the average. This indicates the rider load ratio (utilization rate). This indicates the average load ratio of all riders.
[0069] Define fair punishment by calculating it separately for each of the two segments:
[0070] in For fair penalty parameters, This is for cropping the range.
[0071] Step 3.6 is mainly used for MCMF modeling: it is equivalent to "minimum cost flow" in terms of "maximum effective utility". The specific steps are as follows: Step 3.6.1 Decision Variables: Let Indicates order Whether by the rider Serve.
[0072] Step 3.6.2 Effective Utility: For candidate edges Define the basic rewards and penalties, where b is the order service reward; Penalty for exceeding capacity; Penalty for borrowing from other sections; For fair punishment.
[0073] When orders occur during peak periods, the effective utility of "local allocation" is as follows: ; When "peak-hour borrowing of off-peak capacity" is allowed, the effective utility of its "borrowing allocation" is: ; Off-peak orders are used in symmetrical ways. or And corresponding borrowing penalties, constructing edge weights and penalty terms to nodes with different capacities based on whether the order is at a peak.
[0074] Step 3.6.3 Minimum Cost Flow Transformation: Let the scaling factor S be used to transform "maximizing total effective utility" into "minimizing total cost": ,in This represents the cost from order o to rider r in MCMF, and introduces a virtual unserved channel, where each order node o is connected to a virtual node dummy, with a cost that is a constant M much larger than any real allocation edge. This forces a preference for real allocation when a candidate is feasible, and only uses the dummy if the candidate is not feasible, in order to keep the flow feasible.
[0075] Step 3.6.4 Network Structure Segmentation Basic / Excess Channel + Total Amount Gate: Source node S to order node o: capacity 1; Order node 0 to dummy: Capacity 1, Cost M; dummy to remittance point T: Capacity |O|, Fee 0; Each rider establishes a total quantity node ct_r, and applies the total remaining capacity tot_rem corresponding to the available total after the hard gate / soft gate from ct_r to T; Each rider establishes a basic node cb_ for both off-peak and peak periods. With excess node ce_ The base edge weight is 0, and the excess edge weight is over_pen_cost=roundSδ_over, in order to implement the utility penalty for accepting excess orders; Order node o is connected to the corresponding segment cb_ or ce_ The cost is calculated from the effective utility according to formulas (3)-(12); if borrowing is enabled, it is simultaneously connected to another node and the borrowing penalty is added.
[0076] Step 3.6.5 Solve the simplex of the minimum cost flow network for the above network call to obtain the flow dictionary and minimum cost value, and identify the actual allocation of orders flowing to the dummy from the outflow of the order node.
[0077] Step 3.7 primarily reduces long-term uncertainty and controls computational load through Horizon rolling commits. The specific steps are as follows: Step 3.7.1 Horizon Construction: In the window Upon arrival, merge the active order sets from the most recent H windows into the current solution set. .like If the limit is exceeded, the current window's orders will be retained first, and the remaining orders will be truncated and supplemented from other windows to control the graph size and solution time.
[0078] Step 3.7.2 Submission Strategy: For each provisional allocation obtained from Horizon (i.e., the planning view of the current window plus several future windows), only the window corresponding to the earliest submission window tH is confirmed and committed (i.e., for each provisional solution solved on Horizon, in the rolling submission process, the earliest part of the solution that is about to be implemented is assigned as the final solution and fixed without modification; this step is the commit). The purpose of the commit is to determine the allocation result of orders within the submitted window as the final matching result and update the rider load; this part will not participate in subsequent optimizations), and update each rider. The script performs a hard upper limit check upon submission to ensure that the total number of orders received does not exceed the upper limit defined by equations (3)-(7).
[0079] Step 3.8 is mainly used for result derivation calculations and interpretable output of timeout / out-of-service reasons. The specific steps are as follows: Step 3.8.1 Determine the completion time CTD from the time utility: For assigned orders, take their time utility. , with parameters Convert it to estimated completion time: ; Mark whether the timeout has occurred, where, For time utility The exponential decay coefficient, Indicates the estimated completion time of the order. Indicates the time when the order was placed. This indicates the platform's estimated delivery time.
[0080] Step 3.8.2 Fairness Indicator Output: In some embodiments, the mean absolute deviation of the load factor from the mean (MAD) is used as the aggregate fairness indicator: ; in To effectively gather riders, , This indicates the number of orders currently assigned to rider r. This indicates the maximum capacity of rider r. This indicates the load ratio cutoff, used to control penalty stability.
[0081] Step 3.8.3 Explaining the reasons for non-service: For unassigned orders, perform statistics by "no feasible candidates after capacity filtering" and "entered dummy or other infeasible" and output a summary table and a sample table by hour / peak / usage K / reason to locate bottlenecks.
[0082] Step 3.8.4 Output Files: Write the final submitted allocation results to Parquet, and simultaneously output window-level summary, rider-level summary, and running logs, so that the subsequent second-stage metaheuristic algorithm can use this initial solution as a starting point for neighborhood search and Pareto fine-tuning.
[0083] In a specific embodiment, such as Figure 2 As shown, step 4 specifically includes: Step 4.1: Determine the decision variables and constraints of the multi-objective optimization model; Step 4.2: Determine the objective function of the multi-objective optimization model; Step 4.3: Initialize the population using the initial solution of MCMF as the anchor point, and perform NSGA-II global multi-objective search for a large feasible domain; Step 4.4: Extract Pareto elite solutions from the output population of Step 4.3, and perform ALNS (Adaptive Large Neighborhood Search) local search to obtain the final allocation results.
[0084] Specifically, based on the obtained feasible region candidate edge set and the initial solution of MCMF, a two-stage optimization framework of "global multi-objective search + elite solution adaptive large neighborhood reinforcement" is constructed. While ensuring coverage and unserved rate constraints, this framework further improves overall utility and load fairness. The two-stage process in the script consists of the NSGA-II main process and Pareto elite local search. Key parameters include population size, number of iterations, crossover / mutation probability, and fairness and coverage penalties.
[0085] Step 4.1 is mainly used for symbol definition and multi-objective optimization model establishment. The specific steps are as follows: Step 4.1.1 Define the consistency between decision variables and coding, defining binary decision variables: ; And define the individual encoding vector as ,in , Let O represent the set of candidate riders for order o, and This indicates that order o was not served, and the two satisfy the equivalence relation: ; The encoding scheme of "integer gene + 0 represents unserved" is used to support the implementation of crossover, mutation, and local search operators in NSGA-II.
[0086] Step 4.1.2 Assigning Constraints: Hard Constraints + Soft Constraints for Consistency Standardization (1) Unique allocation constraint for a single order: ; (2) Candidate feasibility constraints can only be assigned within the candidate set: ; (3) Capacity constraints are expressed using soft constraints, defining riders The total capacity limit is And define its load as: ; in, Show order collection, This indicates the load ratio. The algorithm does not force this on every operation. Instead, the overload level is constrained by the overload penalty term in the fairness objective and the receiver ratio threshold of the local search (see steps 4.3 and 4.4).
[0087] Step 4.2 is mainly used for defining the three-objective function and the penalty mechanism, specifically including: Step 4.2.1 Determine the total utility objective : Based on the mixed utility matrix determined in steps 1-3 The total utility is defined as: ; in Obtained from the candidate edge table; if in the order dynamics If an edge is missing from the corresponding edge table, a backtracking search is allowed in the remaining K candidate tables to avoid utility loss due to candidate pruning. The script iterates through k_values in the evaluation function to perform the backtracking search. Furthermore, if the rider is overloaded, a discount factor can be applied to their utility contribution. ,form: ; To reduce the profit-driven nature of excessively concentrated distribution.
[0088] Step 4.2.2 Determine the fairness objective Load fairness is defined in the load ratio vector. The mean of the above is denoted as . The standard deviation is : ; To suppress overloading at the tail end, an overload penalty is introduced: ; Ultimate fairness goal Defined as: ; in, The overload penalty weight.
[0089] Step 4.2.3 Identify unserved targets Penalty for coverage constraints: First, define the set of unserved orders. Define peak unserved rate. Off-peak unservice rate : ; And define peak-weighted unserved: ; Introducing a threshold penalty to hard limit service levels, given an allowable threshold for non-service. ,but: ; in, This represents a collection of orders placed during off-peak periods. Indicates the peak window weight, 1- Indicates the weight of the off-peak window. This is a penalty coefficient. This design ensures that NSGA-II, when advancing the Pareto frontier, does not gain utility or a fair boost at the expense of coverage.
[0090] Step 4.2.4 Determine the minimal form adapted to NSGA-II: Because NSGA-II uses a minimized adaptation in the script, it will maximize... Transform into minimization target =- This forms a three-objective fitness: ; And set the weight vector in the DEAP framework as That is, all three should be chosen according to the principle of "the smaller the better".
[0091] Step 4.3 is Phase 1: NSGA-II global multi-objective search for large-scale feasible domains. The specific steps are as follows: Step 4.3.1 Binding dynamic windows and dynamic TOPKs follows the same feasible domain organization method as Step 3: To balance feasibility and computational efficiency across different order density phases, a dynamic window is constructed for the time-ordered order stream. The script calculates based on the number of orders within the next 180 seconds. Adaptive selection of window width and with Form a window sequence. For each window, count the number of orders within a 1-hour scrolling range. And calculate its percentage of all orders for the day: ; when A value >0.075 indicates a peak window, meaning all orders within that window are marked as peak orders; otherwise, they are considered off-peak orders. Simultaneously, based on... Map the window to a dynamic TOPK: 51); Inherit orders within the window As its dynamic candidate size This step ensures that subsequent NSGA-II evaluation and operator repair are always performed within the feasible region of "density-adaptive pruning".
[0092] Step 4.3.2 Construct the NSGA data structure: candidate edge table + initial solution information + repairable indexes. The pruned candidate edge table is grouped by K and further indexed by order to form a mapping. The script reads and trims the candidate edge table [25, 50, 75, 100, 150] according to the scenario, generating structures such as edges_by_order_by_k and best_by_order_by_k for each order. Simultaneously, it reads the initial MCMF solution assign_init and rider capacity output from step 3. and peak capacity The initial overloaded order index `overloaded_idx` and the unserved order candidate repair table `failed_candidates_sorted` are used for subsequent "damage-repair" operators to quickly locate the object set. The unserved order candidate repair table is sorted from highest to lowest candidate utility for the "priority insertion" repair strategy.
[0093] Step 4.3.3 Population Initialization: Diversification Generation Anchored by the Initial Solution of MCMF: Let the gene vector corresponding to the initial solution of MCMF be... To ensure that the search starts from high-feasibility areas, the 0th individual is defined as fixed as... The remaining individuals achieve diversity enhancement by randomly zeroing the indexes of overloaded and unserved orders, supplemented by a low-probability global zeroing perturbation: This is applied to the index set. , This represents the set of order indexes related to overload. This represents the set of indexes for unserved or failed-to-assign orders, set with a probability of 0.5. Then, all orders are reset to zero with a probability of 0.02. This initialization strategy achieves "local diversification centered on the initial solution," balancing convergence speed and Pareto diversity.
[0094] Step 4.3.4: Partial swapping of the crossover operator maintains consistency of the feasible region. Define the crossover operator as a partial order position swap. For two parent individuals... Randomly sample a set of order locations For all Perform the exchange: ( This operator is used in the pairing crossover phase of the NSGA-II main loop.
[0095] Step 4.3.5 Embedded ALNS with Mutation Operator: Destructive-Repair Hybrid Mutation: The mutation in Phase 1 does not employ a single random perturbation, but instead constructs a hybrid mutation (combined_mutation) with an adaptive large neighborhood search style. This hybrid mutation includes at least the following three types of repair / rearrangement mechanisms and is coupled with the dynamic TOPK feasible region structure: Unserved Order Insertion Repair: Unserved orders For each order, iterate through its candidate sequence in descending order of utility, select the first candidate r that satisfies the condition that the receiving rider capacity does not "significantly deteriorate", and set it aside. ,accomplish The process explicitly records the utility-priority repair strategy.
[0096] Peak-priority insertion repair: Prioritize processing peak-hour unserved order collections Insert the best candidate from the candidate set to satisfy "peak coverage priority", where This represents the peak order set. First, a peak unserved index is constructed and randomly shuffled. Then, candidate riders are selected for each order and written back to the gene.
[0097] Load balancing and redistribution: Transfer some orders from the busy rider with the highest load ratio to the idle rider with the lowest load ratio. Let the load ratios of the two riders before the transfer be respectively... The migration is triggered only when the following condition is met: ;in The minimum ratio difference threshold parameter is `min_ratio_gap`. During migration, the receiver ratio constraint must be satisfied: ;in For the fairness threshold parameter FAIRNESS_PHI in the script, The relaxation term uses a hard-coded relaxation of +0.1; and the migration is only allowed within the order candidate set, meaning the receiving rider must exist in the candidate edge table of the order, otherwise the migration is invalid. This operator embodies a structured large neighborhood rearrangement within the feasible region, unlike traditional random mutation.
[0098] The above three mechanisms are uniformly organized by a hybrid mutation scheduling strategy and are called as mutation operators in the NSGA-II main loop.
[0099] Step 4.3.6, NSGA-II main loop non-dominated sorting + crowding distance to maintain diversity: Let the maximum number of iterations be N_GEN, the crossover probability be CXPB, and the mutation probability be MUTPB. Each generation executes the following process: Step 4.3.6.1 Uses a tournament selection method based on crowding comparisons to generate offspring sequences; Step 4.3.6.2 Perform crossover on the offspring according to probability and remove invalid fitness values; Step 4.3.6.3 Perform probabilistic mixed mutation on the offspring and remove invalid fitness values; Step 4.3.6.4 Re-evaluate the ineffective individuals and merge the parent and offspring generations; Step 4.3.6.5 uses the NSGA-II selection operator selNSGA2 to perform non-dominated stratification and crowding distance screening, and outputs a new generation of population.
[0100] This loop can be abstracted as: ; in Depend on( It is composed together with mixed variations.
[0101] Step 4.4 is Phase Two: Local Enhancement of ALNS for Pareto Elite Solutions with Priority for Fairness Improvement and Hard Coverage Constraints, specifically including: Step 4.4.1 Elite Set Extraction and Local Search Triggering: Extract the Paretofront solution set from the output population of Phase 1. The system selects at most L elite solutions to execute the local enhancement script parameter LS_MAX_SOLUTIONS, while limiting the maximum number of local moves for each elite solution to the script parameter LS_MAX_MOVES_PER_SOL. This process is implemented by calling local_search_pareto, and for each elite solution, fairness_local_search is called to complete the enhancement.
[0102] Step 4.4.2 Acceptance Criteria for Local Search: Strong Claim Restrictive Terms: Let elite solution The three evaluations are Candidate solutions are obtained by local movement. The following acceptance criteria are defined, with script parameters specifying the threshold values: Fairness must be significantly improved: ; in, This represents the minimum tolerance for "improvement in fairness" during local search (second-stage elite enhancement). Only when the new solution meets the fairness metric... At least improve Only then are they qualified to be accepted.
[0103] Furthermore, coverage must not deteriorate and the original unserved value must not increase: ); in, This represents the maximum allowable increase in the non-service rate under the local search acceptance criteria. The default minimum value.
[0104] Total utility is allowed to decrease by a very small amount but is subject to an upper limit: ); in, This represents the minimum loss of task utility allowed under the local search acceptance criterion.
[0105] The move is accepted if the new solution achieves a threshold improvement in fairness, does not deteriorate coverage, and has controlled utility loss; otherwise, it is rejected. This triple acceptance criterion directly constitutes the core of the second-stage ALNS reinforcement.
[0106] Step 4.4.3 Local movement constructs a feasible domain repair for the migration from busy riders to idle riders: Local movement first calculates the busy rider set from the current solution. Meet with idle riders And randomly shuffled to improve search diversity. For any busy rider Select its assigned order set One of the orders o And try to migrate it to a certain idle rider It simultaneously meets two types of hard conditions: (a) Candidate feasibility conditions: This means that idle riders must be present for orders. o Otherwise, the migration will fail directly; (b) Receiver fairness threshold condition: The receiver ratio after migration does not exceed , i.e. .
[0107] Candidate solutions are formed after satisfying a–b. Then follow the formula – The process determines whether to accept the solution. It performs a maximum of T moves on each elite solution, or terminates when consecutive failures reach the upper limit, to ensure manageable operating costs.
[0108] Step 4.5 evaluates the output and Pareto front solidification for subsequent comparative experiments and claim support, specifically including: Step 4.5.1 Unify the output indicator fields: Pareto solution set and its locally enhanced solution set The following metrics will be output uniformly: (a) Total utility The results are cached in total_utility; (b) Fairness The script caches individual attributes and writes them to the table; (c) Peak / Off-peak / Overall Unserved Rate and after punishment ; (d) Running time and the optimal / mean convergence trajectory script of the iteration process printed in each generation. wait.
[0109] Step 4.5.2 Pareto Front Preservation and Visualization: Save the solution set as a frontier file according to the non-dominant relation, and output 2D / 3D visualization results, such as... Figure 3 , 4 As shown, the script contains a dedicated save function to export the Pareto front summary table and graphical files. Finally, the obtained non-dominated solution set is output as the multi-objective optimization result, allowing the platform to select an execution plan from the Pareto front according to business preferences.
[0110] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0111] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A real-time delivery task allocation method based on a two-stage metaheuristic algorithm, characterized in that, include: Step 1: Construct the mixed utility matrix for order riders and generate a candidate edge set, specifically including: Step 1.1: Based on the locations of riders, merchants, and pickup points, as well as waiting business constraints, construct an order completion time prediction model; Step 1.2: Based on the promised delivery time of the order, construct a hybrid utility function that includes completion utility, punctuality utility, and timeliness utility; Step 1.3: Based on the soft neighborhood of the business district, a candidate edge table is generated through KDTree spatiotemporal filtering; the soft neighborhood of the business district is based on the average coordinates of the merchants in the business district as the geometric center, and is automatically included in the surrounding business districts according to a preset distance threshold. If no matching merchants are found, a set of neighboring business districts of a specified number of business districts is selected according to the nearest distance; the candidate edge table records order-candidate rider pair information with order identifier, rider identifier, completion utility, punctuality utility, timeliness utility, and mixed utility as columns; Step 1.4: Based on the order identifier and rider identifier, deduplicate and merge the candidate edge table and write it into the hybrid utility matrix; at the same time, calculate the order candidate degree and the number of candidate riders per order and output the merge log; Step 1.5: Perform TopK pruning and K=150 replacement on the hybrid utility matrix to obtain the candidate edge set; Step 2: Based on the hybrid utility matrix, perform utility parameter calibration to determine the baseline parameters, specifically including: Step 2.1: Construct a subset of calibrated orders based on the full set of order details; Step 2.2: Construct a parameter grid set centered on the punctuality penalty scale parameter and the aging decay parameter. Step 2.3: Quickly recalculate the mixed utility of each group of parameters in the parameter grid set based on power transform; Step 2.4: Using the simplified MCMF equivalent assignment method of argmax, evaluate the coverage and average mixed utility of each group of parameters in the parameter grid set; Step 2.5: Using the order placement time and estimated delivery time in the calibrated order subset, evaluate the service performance index (CTD) and comprehensive evaluation index for each set of parameters in the parameter grid set. ; Step 2.6: Calculate the normalized comprehensive evaluation index and select the benchmark parameters; Step 3: Based on the hybrid utility matrix, the candidate edge set, and the baseline parameters, construct the MCMF model using dynamic TopK pruning and time-segmented soft capacity constraint method to generate an initial solution for MCMF; wherein, the time-segmented soft capacity constraint is: divide the rider's total delivery capacity into peak time capacity and off-peak time capacity, and set a soft upper limit for capacity for each time period; Step 4: Using the initial MCMF solution as the anchor point, perform NSGA-II population initialization and execute multi-objective global search to generate Pareto front solution set. Perform ALNS local search on the Pareto elite solutions in the Pareto front solution set to obtain the final delivery task allocation result. The ALNS local search adopts a triple acceptance criterion of fairness improvement, no deterioration of coverage, and controlled total utility loss.
2. The instant delivery task allocation method based on a two-stage metaheuristic algorithm according to claim 1, characterized in that, The order completion time prediction model is expressed as follows: ; ; ; in, Represent two points on the sphere distance, and For the corresponding latitude, This represents the latitudinal distance between points a and b, i.e. , This represents the longitude distance between two points a and b, i.e. R = 6,371,000 meters; This indicates the travel time from the rider's location to the merchant. Indicates the rider's valid position. Indicates the merchant's order. This indicates the delivery time from the merchant to the pickup point. Indicates the receiving point. Indicates rider speed; Indicates the time to pick up the food. Indicates the time when the order is pushed. Indicates the time when meal preparation is completed. Indicates the time when the order was completed; The mixed utility function represents: ; ; ; ; in, , and These represent completion utility, punctuality utility, and timeliness utility, respectively. These represent the corresponding weight parameters. Indicates mixed utility; Indicates the on-time attenuation scale. Indicates the time-related decay coefficient. This indicates the promised delivery time for the order.
3. The instant delivery task allocation method based on a two-stage metaheuristic algorithm according to claim 1, characterized in that, Step 2.3 specifically includes: In relation to the specified order subset The corresponding mixed utility matrix Above, to and The parameter transfer is achieved using a power transform, and the formula is as follows: ; in, Indicates parameters The corresponding time-sensitive utility, Indicates the time-related decay coefficient. , Indicates parameters The corresponding punctuality utility This represents the punctuality penalty scale parameter. Second; For each set of parameters The formula for calculating mixed utility is: ; in, Indicates parameters The corresponding mixed utility, Indicates completion utility. These represent the corresponding weight parameters; Step 2.4 specifically includes: For each order Select the candidate rider with the highest mixed utility directly. , obtain the allocation set The formula is: ; Each set of parameters Output the allocation results and record the coverage. With average mixed utility The formula is: ; in, This represents a set of matching order-rider pairs. Indicates in the parameter The number of matching pairs obtained. This indicates the size of the order subset used for calibration parameters.
4. The instant delivery task allocation method based on a two-stage metaheuristic algorithm according to claim 1, characterized in that, Step 3 specifically includes: Step 3.1: Perform data input and sign unification based on the hybrid utility matrix, the candidate edge set, and the benchmark parameters; Step 3.2: Construct a dynamic window and calculate the peak ratio of the window. Map the dynamic TopK threshold according to the peak ratio of the window and calculate the non-peak capacity ratio. Step 3.3: Filter the input data using dynamic TopK pruning and K=150 backoff mechanism; Step 3.4: Divide the rider group into time-segmented capacities based on the off-peak capacity ratio, and set a soft upper limit and a daily total capacity gate; Step 3.5: Introduce a fair penalty term into the edge weights based on the segmented load rate; Step 3.6: Based on the data filtered in Step 3.3, the capacity allocation, soft upper limit, and total daily capacity gate in Step 3.4, and the fair penalty term, perform MCMF modeling and solution; Step 3.7: Based on the MCMF solution, update the rider status by submitting a rolling commit via Horizon. Step 3.8: Perform result derivation calculations and interpretable outputs on the results submitted in Step 3.7 to finally obtain the initial solution of the MCMF.
5. The instant delivery task allocation method based on a two-stage metaheuristic algorithm according to claim 1, characterized in that, Step 4 specifically includes: Step 4.1: Determine the decision variables and constraints of the multi-objective optimization model; Step 4.2: Determine the objective function of the multi-objective optimization model; Step 4.3: Initialize the population using the initial MCMF solution as the anchor point, perform NSGA-II global multi-objective search for large-scale feasible regions, and generate Pareto front solution set; Step 4.4: Extract Pareto elite solutions from the Pareto front solution set in Step 4.3, and perform ALNS local search to obtain the final allocation result.
Citation Information
Patent Citations
Order and transport capacity matching method and device, and electronic equipment
CN115496431A
Dynamic demand cold chain transportation path planning method based on improved ALNS algorithm
CN120069721A