Online housekeeping service order allocation method considering the comprehensive benefits of the platform
By combining reinforcement learning and Transformer networks with K-means clustering, the housekeeping service order allocation model is optimized, which solves the local optimality problem of the existing algorithm under large-scale data, improves the intelligence and rationality of order allocation, and enhances customer satisfaction and service quality.
Patent Information
- Application Number
- CN202510789197.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-06-13
AI Technical Summary
The existing housekeeping service order allocation algorithm converges slowly under large-scale data, is prone to falling into local optimal solutions, and fails to effectively consider factors such as customer satisfaction, service staff ratings, and order intervals, resulting in poor real-time performance. Especially during peak hours, customers often cannot be matched with service staff for a long time.
A reinforcement learning-based method is used, combined with Transformer networks and K-means clustering, to construct an order allocation model that considers the comprehensive benefits of the platform. By predicting the constraints and objective function of the model, the adjacency matrix and graph Laplacian matrix are used to calculate the importance of orders. Local search is performed in combination with destruction and repair strategies to optimize the order allocation results.
It improves the intelligence and rationality of order allocation, increases the convergence speed and global search capability of the algorithm, ensures customer satisfaction and service quality, reduces the travel distance of service personnel and the order interval time, and improves the overall benefits of the platform.
Smart Images

Figure CN120297709B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data processing technology, and in particular relates to an online housekeeping service order allocation method that takes into account the comprehensive benefits of the platform. Background Art
[0002] In recent years, with the continuous advancement of technology and the booming economy, the domestic service industry has gradually entered a golden age. For online domestic service platforms, fully considering factors such as customer satisfaction and overall service personnel income, and designing more intelligent and reasonable order matching algorithms, plays a vital role in improving the online domestic service platform mechanism, enhancing the overall efficiency of online domestic service platforms, and expanding the application market of the domestic service industry.
[0003] The Large Neighborhood Search (LNS) algorithm is a common solution for order allocation problems. However, as the problem size increases and the types of optimization objectives increase, the LNS algorithm has exposed certain limitations in the solution process, mainly manifested in slow convergence, limited global search capabilities, and a tendency to fall into local optimal solutions.
[0004] Existing research often focuses on minimizing the time it takes service personnel to reach their destination (for example, in the ICTAI paper "Vehicle Routing and Scheduling for Regular Mobile Healthcare Services," the optimization objectives for home healthcare services are divided into two parts, based on priority: first, minimizing the number of medical vehicles used within a specified time window; second, minimizing the total travel time, fuel consumption, and number of service routes while ensuring that the vehicles can return to the departure station normally after completing the service; and in the European Journal of Operational Research paper "A Simultaneous Facility Location and Vehicle Routing Problem Arising in Health Care Logistics in the Netherlands," which minimizes the logistics costs of delivering medications to lockers and the travel costs of patients retrieving medications from lockers, screens a set of potential locker locations, and generates routes to access these lockers and routes to access patients within the locker coverage area) or maximizing customer satisfaction (for example, in the Socio-Economic Planning Sciences paper "Online Doctor-Patient Dynamic Stable Matching Model Based on Regret Theory Under Incomplete In the paper "Optimal quality regulation on the online health platform" published in "Electronic Markets", an online doctor-patient matching mechanism is proposed, in which doctors are scored according to the patient's disease type and doctor's skill information. Only when the doctor and the patient are successfully matched in both directions can the doctor have the opportunity to participate in the patient's treatment. This method takes into account the patient's health while also taking into account the doctor's treatment needs; in the paper "Optimal quality regulation on the online health platform" published in "Electronic Markets", the quality of online doctor-patient services is better guaranteed by excluding low-level doctors and incorporating patient satisfaction into the platform's specific benefits; in the paper "Medical Service Matching Decision-making Method Considering Patients' Personalized Needs" published in "Operations Research and Management", a stable matching scheme and a satisfactory matching scheme for online doctor-patient services are constructed to calculate the matching degree between doctors and patients, thereby achieving online doctor-patient service matching decision) as the optimization goal, but ignores the comprehensive consideration between the two and the impact of factors such as the time interval between adjacent service orders on the matching decision.Furthermore, existing housekeeping service order allocation algorithms suffer from poor real-time performance, particularly during peak order periods. Customers often remain unmatched with service personnel for extended periods after placing an order. Furthermore, as the problem scale and the number of optimization targets increase, the LNS algorithm exhibits limitations in its solution process, primarily manifesting in slow convergence, limited global search capabilities, and a tendency to become trapped in local optimal solutions. Summary of the Invention
[0005] In view of this, the present invention aims to provide an online housekeeping order allocation method that takes into account the comprehensive benefits of the platform. On the basis of the traditional order allocation problem, it comprehensively considers factors such as customer satisfaction, the travel distance of service personnel to serve each order, and the time interval between serving adjacent orders. It aims to improve the comprehensive benefits of the online housekeeping service platform and provide effective decision-making support for improving the intelligence and rationality of order allocation in the online housekeeping service platform.
[0006] To achieve the above object, the technical solution created by the present invention is implemented as follows:
[0007] A method for allocating online housekeeping service orders that considers the overall benefits of the platform includes:
[0008] S1: Determine the constraints and objective function of the prediction model used to predict order allocation results based on the influencing parameters that affect the comprehensive benefits of the housekeeping service platform;
[0009] S2: Sort the orders to be analyzed by importance and segment the sorted order sequence to obtain the initial optimal solution for predicting order allocation results, and the initial optimal solution satisfies the constraints;
[0010] S3: Based on the constraints and objective function obtained in step S1, a local search based on reinforcement learning is performed on the initial optimal solution obtained in step S2 to predict the optimal order allocation result that meets the constraints and objective function.
[0011] Furthermore, the objective function in step S1 is:
[0012] ;
[0013] Where obj represents the optimization target value, α, β and γ are weight parameters in the objective function, α+β+γ=1, I represents the total number of service personnel, J represents the total number of orders, and f i represents the service score of the i-th service staff, 0.5 <f i <1, R ij The value is 0 or 1, R ij = 0, indicating that the jth order is not served by the i-th service personnel.ij =1, it means that the jth order is served by the i-th service personnel. serve | represents the number of service personnel actually involved in order service, D jj’ represents the Euclidean distance between the jth order and the j'th order, X ijj’ Indicates a value of 0 or 1, X ijj’ = 0, indicating that the next order of the jth order of the i-th service staff is not the j'th order. ijj’ =1 means the next order of the jth order of the i-th service staff is the j'th order. represents the time when the i-th service staff executes the j'th order, represents the time when the i-th service staff executes the j-th order, represents the service duration of the j-th order.
[0014] Furthermore, the constraints in step S1 include the number of service personnel for each order, the service time for each order, the temporal connectivity and spatial connectivity of the order routes for each order, and the location constraint that all service personnel start from the starting point for the first order and the i-th service personnel starts from the starting location and travels to the location of the j-th order; where:
[0015] The service capacity is limited to:
[0016] ;
[0017] The service time constraint is an integer multiple of half an hour between the earliest service start time and the latest service start time for each order. All service personnel must arrive at the order location before the latest service start time of each order, that is:
[0018]
[0019] in, represents the latest service start time for the jth order, represents the earliest service start time for the jth order, a ij’ represents the time when the i-th service staff arrives at the j'th order location, and M represents a positive integer;
[0020] Temporal connectivity satisfies:
[0021] ;
[0022] Among them, v represents the speed of service personnel;
[0023] Spatial connectivity satisfies:
[0024]
[0025] Position constraints satisfy:
[0026]
[0027] Among them, p i represents the initial position of the i-th service staff, Indicates that the i-th service staff starts from the initial position p i Whether to directly reach the j'th order position, The value is 0 or 1. When the value is 0, it means that the i-th service staff starts from the initial position p i Does not directly reach the j'th order position, When the value is 1, it means that the i-th service staff starts from the initial position p i Directly reach the j'th order position.
[0028] Furthermore, step S2 includes:
[0029] S21: Construct an order node set from service orders and service personnel, and construct a complete undirected graph from the order node set. Use the adjacency matrix method to construct a graph Laplacian matrix based on the complete undirected graph, and calculate the eigenvalues of the graph Laplacian matrix. The eigenvalues represent the importance of the corresponding order.
[0030] S22: Perform K-means clustering on the order location and order time to obtain several clusters; sort the orders within the cluster and between clusters based on the characteristic values of the orders within the cluster and the number of connections between the orders in the clusters;
[0031] S23: Use the K-means clustering algorithm to split the order sequence obtained in step S22 into multiple subsequences, and calculate the comprehensive score of each order in the current subsequence; sort all orders according to the comprehensive score to obtain the initial optimal solution.
[0032] Furthermore, the process of calculating the comprehensive score of each order in the current subsequence in step S23 includes:
[0033] Calculate the Euclidean distance of each order to the first order in the current subsequence, and perform a weighted calculation with the service score of each order to obtain the comprehensive score corresponding to each order.
[0034] Furthermore, step S3 includes:
[0035] S31: Input the initial optimal solution into multiple feature encoding modules based on the Transformer network to extract order features, and obtain the initial state and initial features. The orders in the initial state meet the constraints.
[0036] S32: Input the initial state and initial features obtained in step S31 into the destruction module, obtain and execute the current destruction action of deleting some order nodes, obtain the current destruction state, determine whether the orders in the current destruction state meet the constraints, and determine the current destruction reward corresponding to the current destruction action;
[0037] S33: Input the current damage state obtained in step S32 into the repair module, obtain and execute the current repair action, obtain the current repair state and the corresponding order sequence, determine the current repair reward corresponding to the current repair action, and determine whether the orders in the current repair state meet the constraint conditions;
[0038] S34: Input the order sequence obtained in step S33 into the feature encoding module for feature extraction, replace the initial features and initial state in step S32 with the extracted features and the current repair state, repeat steps S32 to S34, and output the optimal order allocation result from the repair module.
[0039] Furthermore, in each feature encoding module, the initial optimal solution is input into the linear transformation layer for linear transformation; the output of the linear transformation layer is then subjected to two feature extractions and order reordering by the first and second attention submodules to obtain the initial state;
[0040] In the first attention submodule, a multi-head attention mechanism is used to encode the input features, and the encoded features are batch normalized to obtain the output;
[0041] In the second attention submodule, the input features are first processed by the feedforward neural network, and the processed features are then batch normalized to obtain the output.
[0042] Furthermore, in the destruction module:
[0043] The initial state or the repair state at the previous moment is decoded through the destruction strategy network to obtain the current destruction action;
[0044] After executing the current destruction action to obtain the current destruction state, the destruction reward function is used to evaluate the current destruction state to obtain the current destruction reward.
[0045] Furthermore, the destruction reward function is:
[0046] ;
[0047] in, represents the destruction reward function, Indicates the current damage status, Indicates the current destruction action, m and n represent the mth order node and nth order node respectively. The correlation between the mth order node and the nth order node is obtained by the following formula:
[0048] ;
[0049] Among them, ε and η are weight values, d mn Represents the Euclidean distance between the mth order node and the nth order node, that is:
[0050] ;
[0051] in, and Represent the position coordinates of the mth order node and the nth order node respectively.
[0052] Furthermore, the destruction strategy network includes a multi-head self-attention module and an LSTM network; wherein, the multi-head self-attention module interacts with features in the initial state and the repair state at the previous moment, and then uses the LSTM network to decode the execution sequence of the interaction features to obtain the removal probability score of removing the order node; according to the removal probability distribution, the order node is removed from the order node set at the previous moment to complete the current destruction action.
[0053] Furthermore, in the repair module:
[0054] The damage state at the previous moment is decoded through the repair strategy network to obtain the current repair action;
[0055] After executing the current repair action to obtain the current repair state, the repair reward function uses the change in the objective function of the current repair state before and after the moment as the current repair reward.
[0056] Furthermore, in the repair strategy network, multi-head self-attention is used to decode the current damage state and the removed order nodes to obtain the repair probability distribution of the order node insertion position; the first multiple positions consistent with the number of removed order nodes are selected as the insertion area; according to the repair probability distribution, the removed order nodes are inserted into the order node set at the previous moment in sequence to complete the current repair action.
[0057] Furthermore, the repair reward function is:
[0058] ;
[0059] in, represents the repair reward function, Indicates the current repair status. Indicates the current repair action, m and n represent the mth order node and nth order node respectively. The correlation between the mth order node and the nth order node is obtained by the following formula:
[0060] ;
[0061] Among them, ε and η are weight values, d mn Represents the Euclidean distance between the mth order node and the nth order node, that is:
[0062] ;
[0063] in, and Represent the position coordinates of the mth order node and the nth order node respectively.
[0064] Compared with the prior art, the present invention can achieve the following beneficial effects:
[0065] Compared to the commonly used solution for order allocation problems (LNS algorithm), the online housekeeping service order allocation method described in this invention, which takes into account the platform's overall benefits, effectively addresses the problems of traditional service scheduling algorithms, such as slow search speed and susceptibility to local optimality under large-scale data conditions. This method achieves certain improvements in algorithmic intelligence and inference speed. Furthermore, the objective function constructed in this invention is more reasonable and meets practical needs. This invention can provide effective decision-making support for improving the intelligence and rationality of order allocation on online housekeeping service platforms, and can also have a positive impact on improving the platform's overall benefits and expanding the market size of the online housekeeping service industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] The accompanying drawings, which constitute part of the present invention, are intended to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are intended to explain the present invention and do not constitute an undue limitation of the present invention. In the accompanying drawings:
[0067] Figure 1 A flow chart of an online housekeeping service order allocation method considering the comprehensive benefits of the platform according to an embodiment of the present invention;
[0068] Figure 2 This is a flowchart of the method for allocating online housekeeping service orders taking into account the comprehensive benefits of the platform as described in an embodiment of the present invention;
[0069] Figure 3 A schematic diagram of the reinforcement learning algorithm described in the embodiment of the present invention;
[0070] Figure 4 A schematic diagram of a feature encoding module according to an embodiment of the present invention. DETAILED DESCRIPTION
[0071] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not constitute a limitation of the present invention.
[0072] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other.
[0073] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, the terms "first", "second" and the like are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, features defined as "first", "second" and the like may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0074] In the description of the present invention, it should be noted that, unless otherwise expressly specified or limited, the terms "installed," "connected," and "connected" should be understood in a broad sense. For example, they can refer to fixed connections, detachable connections, or integral connections; they can refer to mechanical connections or electrical connections; they can refer to direct connections or indirect connections through an intermediate medium; and they can refer to internal connections between two components. Those skilled in the art can understand the specific meanings of the above terms in the present invention based on specific circumstances.
[0075] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments.
[0076] like Figure 1 and Figure 2 As shown, the online housekeeping order allocation method considering the comprehensive benefits of the platform described in the embodiment of the present invention includes:
[0077] S1: Based on the influencing parameters that affect the comprehensive benefits of the housekeeping service platform, determine the constraints and objective function of the prediction model used to predict the order allocation results.
[0078] In some online housekeeping service scenarios, the order allocation problem can be described as follows: there are no more than I service personnel participating in J orders, and the order location coordinates of the jth order among the J orders and the earliest service start time of the jth order are known. , the latest service start time for the jth order , the service duration of the jth order , the service score f of the i-th service staff i , and the travel speed v of each service person. No more than M service people depart from their starting point at the same time, complete all order services, and return to the starting point after completing the service. The optimization goal is to maximize the service score of all service people matching the orders, while minimizing the average travel distance of the service people serving each order and the average interval time between serving adjacent orders. The matching strategy between orders and service people is rationally designed. In this process, each service person departs from the starting point, serves only one order at a time, and must arrive at the order's location within the specified time window of the order. At the same time, each order can only be served by one service person. In addition, to simplify calculations, the order service start time is specified as an integer multiple of half a point within the time window. In the objective function, since the service person's travel speed is constant, the time interval between serving adjacent orders depends on the Euclidean distance between the adjacent orders. In this embodiment of the present invention, the travel speed v of each service person is consistent and a constant value, namely v = 15 km / h.
[0079] In some embodiments, the objective function is:
[0080] ;
[0081] Where obj represents the optimization target value, α, β and γ are weight parameters in the objective function, and α+β+γ=1. Since the variables corresponding to the β and γ terms have a negative impact on the final objective function value, they are balanced with a negative sign; 0.5 <f i <1, R ij The value is 0 or 1, R ij = 0, indicating that the jth order is not served by the i-th service personnel. ij =1, it means that the jth order is served by the i-th service personnel. serve | represents the number of service personnel actually involved in order service, D jj’ represents the Euclidean distance between the jth order and the j'th order, X ijj’ Indicates a value of 0 or 1, X ijj’ = 0, indicating that the next order of the jth order of the i-th service staff is not the j'th order. ijj’ =1 means the next order of the jth order of the i-th service staff is the j'th order. represents the time when the i-th service staff executes the j'th order, represents the time when the i-th service staff executes the j-th order, In this embodiment of the present invention, the weight parameters α, β, and γ are 0.78, 0.025, and 0.195, respectively.
[0082] By analyzing the various components of the objective function, it can be seen that in order to make the objective function value as large as possible, the average score of the service personnel participating in the order service is required to be as high as possible, the average Euclidean distance between the current location of the service personnel and the order location in each order service is as short as possible, and the average time interval between the service personnel's services for adjacent orders is as short as possible.
[0083] In some embodiments, the constraints in step S1 include a constraint on the number of people to serve each order, a constraint on the service time for each order, temporal connectivity and spatial connectivity of the order routes for each order, and a location constraint that all service personnel start from the starting point for the first order and the i-th service personnel starts from the starting location and travels to the location of the j-th order; wherein:
[0084] The service personnel constraint requires that each order can only be served by one and only one service personnel. Otherwise, it will be detrimental to the design of the model. It is specifically expressed as follows:
[0085] ;
[0086] The service time constraint is an integer multiple of half an hour between the earliest service start time and the latest service start time for each order. All service personnel must arrive at the order location before the latest service start time of each order, that is:
[0087]
[0088] Among them, a ij’ represents the time when the i-th service staff arrives at the j'th order location, and M represents a positive integer;
[0089] Temporal connectivity satisfies:
[0090] ;
[0091] Spatial connectivity satisfies:
[0092]
[0093] Position constraints satisfy:
[0094] ;
[0095] Among them, pi represents the initial position of the i-th service staff, Indicates that the i-th service staff starts from the initial position p i Whether to directly reach the j'th order position, The value is 0 or 1. When the value is 0, it means that the i-th service staff starts from the initial position p i Does not directly reach the j'th order position, When the value is 1, it means that the i-th service staff starts from the initial position p i Directly reach the j'th order position.
[0096] S2: Sort the orders to be analyzed by importance and segment the sorted orders to obtain an initial optimal solution for predicting order allocation results, and the initial optimal solution satisfies the constraints. In the present invention, the orders are constructed in the form of graph data, and an order-service personnel matching mechanism is formulated based on the properties of the graph Laplacian matrix to generate an initial solution. In some embodiments, step S2 includes:
[0097] S21: Construct an order node set from service orders and service personnel, and construct a complete undirected graph from the order node set; use the adjacency matrix method to construct a graph Laplacian matrix based on the complete undirected graph, and calculate the eigenvalues of the graph Laplacian matrix, which represent the importance of the corresponding order.
[0098] In an embodiment of the present invention, a complete undirected graph G=(V,E) is defined, where V is the vertex set in the undirected graph, V=I∪J here represents the order node set in the undirected graph, and E represents the edge set in the undirected graph. If a service staff can serve two orders continuously in adjacent time windows, then the two orders are said to have a connectivity relationship. In an embodiment of the present invention, the connectivity relationship between all orders is represented in the form of an adjacency matrix, and the adjacency matrix is used to construct a graph Laplace matrix based on the complete undirected graph G. By calculating the eigenvalues of the graph Laplace matrix, the importance of each order in the graph can be obtained. The larger the eigenvalue, the higher the importance of the order in the graph. By analyzing the importance of each order and giving priority to matching orders with higher importance, the efficiency and timeliness of the service can be effectively guaranteed.
[0099] S22: Perform K-means clustering on the order location and order time to obtain several clusters; sort the orders within the cluster and between clusters according to the characteristic values of the orders within the cluster and the number of connections between the orders between clusters.
[0100] The feature vector of an order is composed of the importance of the order and the two-dimensional coordinates of the location of the order. Since large-scale data can easily cause the algorithm to search slowly and fall into local optimality, the present invention adopts a divide-and-conquer strategy. Specifically, the embodiment of the present invention clusters the order location based on the horizontal coordinate, vertical coordinate and time of the order based on the K-means algorithm to obtain several clusters. After all orders are clustered, orders with similar characteristics in the same cluster can make full use of the surrounding service personnel resources in the local order sequence, thereby improving the convergence speed of the algorithm while minimizing the distance traveled by service personnel to serve orders. Then, the orders within the cluster and between clusters are sorted according to the importance of the orders within the cluster and the number of connections between the orders between clusters.
[0101] S23: Use the K-means clustering algorithm to split the order sequence obtained in step S22 to obtain multiple subsequences, and calculate the comprehensive score of each order in the current subsequence; sort all orders according to the comprehensive score to obtain the initial optimal solution that meets the constraints. In some embodiments, the process of calculating the comprehensive score of each order in the current subsequence includes calculating the Euclidean distance of each order to the first order in the current subsequence, and performing a weighted calculation with the service score of each order, which can reflect the suitability of the service personnel to serve the order, and the resulting comprehensive score corresponding to each order. The higher the comprehensive score, the more suitable the order is to be assigned to the service personnel. In addition, the present invention also comprehensively considers the service personnel's travel speed and the time window of the order service, and reasonably divides the order sequence into multiple subsequences, thereby accurately evaluating the performance of each service personnel in each subsequence and assigning the best service personnel to each subsequence. This strategy can ensure that each subpath has the most suitable service personnel to serve, thereby improving service quality and customer satisfaction.
[0102] S3: Based on the constraints and objective function obtained in step S1, a local search based on reinforcement learning is performed on the initial optimal solution obtained in step S2 to predict the optimal order allocation result that satisfies the constraints and objective function. Figure 3 The reinforcement learning algorithm shown guides the agent to select the optimal action in a specific state, performs neighborhood search by destroying and repairing order sequences, and solves the problem based on constraints and objective functions, taking into account the current state and possible future states, thereby reducing the risk of falling into a local optimal solution.
[0103] In some embodiments, step S3 includes:
[0104] S31: Input the initial optimal solution into the feature encoding module based on the Transformer network to extract order features and obtain the initial state and initial features.
[0105] In this embodiment of the present invention, N feature encoding modules are used to embed the initial optimal solution X0 into the high-dimensional feature space to obtain the initial state s0, which can be expressed as:
[0106] ;
[0107] in, Indicates the encoding feature output by the vth feature encoding module among the N feature encoding modules in the 0th iteration. When v=0, that is, It represents the initial features after the initial feature encoding of the initial optimal solution X0. Transformer represents the feature extraction operation of the feature encoding module. After the pth iteration, the features obtained after the operation of N feature encoding modules are Feature encoding aims to enrich the feature representation using N Transformer network-based feature encoding modules, thereby providing contextual information in the initial order sequence for subsequent destruction actions during the initial iteration of the algorithm.
[0108] In some embodiments, the feature encoding module uses the feature encoding module based on the Transformer network in the paper "Attention is all you need" published in "Advances in neural information processing systems", and its structure is as follows: Figure 4 As shown, the initial optimal solution is input into the linear transformation layer for linear transformation, and the output of the linear transformation layer is then subjected to two feature extractions and order rearrangements by the first attention submodule and the second attention submodule in sequence to obtain an initial state, and the orders in the initial state meet the constraints. In the first attention submodule, a multi-head attention mechanism is used to perform feature encoding processing on the input features, and the encoded features are then batch normalized to obtain the output. In the second attention submodule, the input features are first processed by a feedforward neural network, and the processed features are then batch normalized to obtain the output. In the embodiment of the present invention, the feedforward neural network used is a long short-term memory network in a recursive feedforward neural network.
[0109] S32: The initial state and initial features obtained in step S31 are input into the destruction module. The current destruction action of deleting some order nodes is obtained and executed, resulting in the current destruction state. The orders in the current destruction state satisfy the constraints, and the current destruction reward corresponding to the current destruction action is determined. An effective destruction mechanism can introduce a new search space and expand the range of service personnel that can match orders, thereby increasing the probability of high-rated service personnel participating in order service.
[0110] In some embodiments, in the destruction module, a destruction strategy network decodes the initial state or the repair state at the previous moment to obtain the current destruction action. After executing the current destruction action to obtain the current destruction state, the current destruction state is evaluated using a destruction reward function to obtain the current destruction reward. The destruction strategy network includes a multi-head self-attention module and a long short-term memory network (LSTM network). The multi-head self-attention module interacts features between the initial state and the repair state at the previous moment. The LSTM network then decodes the execution sequence of the interactive features to obtain a removal probability score for removing the order node. Order nodes are then removed from the set of order nodes at the previous moment according to the removal probability distribution to complete the current destruction action.
[0111] The destruction module in the present invention adopts a destruction mechanism, such as Figure 3 As shown, the damage mechanism consists of four parts, namely the current damage state , Current destruction action , Current Destruction Reward and a destruction strategy network that formulates the current optimal destruction action .
[0112] For the current state of damage , the destruction module repairs the initial state s0 or the previous moment Execute the current destruction action , thus obtaining the currently destroyed order sequence, that is, the current destruction state ,in, It represents the set of all possible sequences of all order features after removing a certain number of orders from the initial order sequence or the order sequence at the previous moment.
[0113] For the current destruction action , by disrupting the policy network Decode the repair status of the previous moment to obtain the current destruction action for the current order sequence The content of the destruction action includes: continuously selecting a certain number of orders that need to be removed from the current order sequence, the current destruction action It can be expressed as:
[0114] ;
[0115] Among them, P t Represents the current order sequence, Represents the feature set of orders removed at the current moment, , A represents the order sequence P from the current t A set of actions for selecting a certain number of orders.
[0116] For current destruction rewards , when getting the current destruction action After that, by destroying the reward function Current state of damage Evaluate and get the current destruction action Current damage reward . Since deleting orders with too high feature similarity can expand the scope of search solutions to a certain extent, it can increase the probability of matching with high-scoring service personnel and achieve the purpose of improving customer satisfaction. Therefore, in order to guide the destruction strategy network to achieve a balance between exploration and utilization, the similarity of the deleted orders at the moment is used as the reward indicator for the destruction action. The reward function is used to encourage the destruction strategy network to more actively explore orders with high similarity, thereby achieving better results in the deletion operation. In some embodiments, the destruction reward function for:
[0117] ;
[0118] Among them, m and n represent two different orders, x m and x n Represent the mth order node and the nth order node respectively, The correlation between the mth order node and the nth order node is obtained by the following formula:
[0119] ;
[0120] Among them, ε and η are weight values, which are adaptively defined and assigned according to actual conditions. mn Represents the Euclidean distance between the mth order node and the nth order node, that is:
[0121] .
[0122] in, and Represent the position coordinates of the mth order node and the nth order node respectively.
[0123] For the destruction of strategic network , using the initial state s0 or the repair state of the previous moment By perceiving the context information before the action is executed, the current destructive action that destroys the current order sequence can be obtained. . In the present invention, multi-head self-attention is used to interact features between order sequences, and then the LSTM network is used to decode the execution sequence of the interactive features, and then the probability distribution of the removed orders is output in sequence. In an embodiment of the present invention, specifically, in the destruction strategy network, the feature encoding module is first subjected to multi-head self-attention feature extraction, and at the same time, the initial state of the input or the repair state of the previous moment is decoded by the LSTM network, and the decoded features are sequentially subjected to masking and softmax operations to obtain the removed orders; the orders at the specified positions are removed from the initial state or the repair state of the previous moment to complete the current destruction action and obtain the current destruction state. The processing process of the destruction strategy network can be expressed by the following formula:
[0124] ;
[0125] ;
[0126] ;
[0127] ;
[0128] in, Indicates the features extracted by the multi-head self-attention in the destruction strategy network in the pth iteration. Attention represents the multi-head self-attention. 、 and represents the weight in multi-head self-attention, and They represent the feature vector and output vector of the sth layer network in the LSTM network, Ω represents the removed order, masked_softmax represents the function of masking and softmax operations on the feature vector in sequence, Repeat represents the repeated operation, and Delete represents the repair state from the previous moment. The operation of removing the order element at the specified position in , k represents the number of times the Delete operation is performed. The number k is adaptively adjusted according to the actual situation and updated to the optimal value through parameter tuning.
[0129] After the destruction strategy network outputs the current destruction action and completes the execution of the current destruction action, the current destruction state can be obtained, thereby providing an operation object for the repair module to execute the repair mechanism.
[0130] S33: Input the current damage state obtained in step S32 into the repair module, obtain and execute the current repair action, obtain the current repair state and the corresponding order sequence, determine the current repair reward corresponding to the current repair action, and the orders in the current repair state meet the constraints.
[0131] Specifically, in the repair module: the damage state at the previous moment is decoded through the repair strategy network to obtain the current repair action; after executing the current repair action to obtain the current repair state, the repair reward function uses the change in the objective function of the current repair state between the previous and next moments as the current repair reward. In the repair strategy network, multi-head self-attention is used to decode the current damage state and the removed order nodes to obtain the repair probability distribution of the order node insertion position; the first multiple positions that match the number of removed order nodes are selected as the insertion area; and according to the repair probability distribution, the removed order nodes are sequentially inserted into the set of order nodes at the previous moment to complete the current repair action.
[0132] The repair module in the present invention adopts a repair mechanism, such as Figure 3 As shown, the repair mechanism consists of 4 parts, namely the current repair status , Current repair action , Current Repair Rewards and a repair strategy network that formulates the current optimal repair action .
[0133] For the current repair status , repair module to the current damage state Execute the current repair action , thus obtaining the currently repaired order sequence, that is, the current repair status ,in, Represents the set of all possible order permutations that may occur when a certain number of orders are inserted into the destroyed large path.
[0134] For the current repair action , by repairing the policy network Current state of damage Decode and get the current repair action for the current order sequence The content of the repair action includes: inserting the removed order into the damaged order sequence, the current repair action It can be expressed as:
[0135] ;
[0136] in, Indicates the current order sequence that is destroyed, , A' represents the set of actions that insert the removed orders into the destroyed ones from the current order sequence.
[0137] For current repair rewards , get the current repair status After that, by fixing the reward function Current repair status Evaluate and get the current repair action Current repair rewards for , to guide the balance between exploration and utilization of the repair policy network. In some embodiments, the repair reward function for:
[0138] .
[0139] For Repair Strategy Network , using the current state of destruction , and the feature set of removing orders at the current moment By perceiving the context information before the action is executed, the current repair action that destroys the current order sequence can be obtained. In the embodiment of the present invention, the current destruction state is decoded by using multi-head self-attention to obtain the probability distribution of the order insertion position, and finally the first multiple positions that are consistent with the number of removed order nodes are selected as the insertion area, and the removed order nodes are inserted into the selected insertion area in sequence. Specifically: the current destruction state is decoded by using multi-head self-attention to obtain the probability distribution of the order insertion position, and finally the first multiple positions that are consistent with the number of removed order nodes are selected as the insertion area, and the removed order nodes are inserted into the selected insertion area in sequence. Decode and get the probability distribution of the order insertion position, and finally select the front positions as the insertion area, and the order feature set Insert into the selected insertion area one by one. The specific process can be expressed as follows:
[0140] ;
[0141] ;
[0142] in, Indicates the current damage status With current order characteristics The mutual encoding feature vectors between represents the set of order feature insertion positions, W 0 and b 0 Represents the weight value of the softmax function.
[0143] S34: The order sequence obtained in step S33 is input into the feature encoding module for feature extraction. The extracted features and the current repair state replace the initial features and initial state in step S32. Steps S32-S34 are repeated, and the optimal order allocation result is output from the repair module. In this embodiment of the present invention, the number of iterations is 20. That is, after 20 repetitions of steps S32-S34, the optimal order allocation result is output from the repair module.
[0144] Through the above steps, the final order allocation result can be obtained.
[0145] In the embodiment of the present invention, the good performance of the online housekeeping order allocation method considering the comprehensive benefits of the platform provided by the present invention is verified through the following experiments.
[0146] Obtain a verified data set. The embodiment of the present invention obtains a data set consisting of 2304 sets of order data and 2975 sets of service personnel data from the "58 Home" housekeeping service platform. Each set of order data includes 7 fields, namely, order number, order placement time, earliest time of order service start time, latest time of order service start time, order service duration, order service location horizontal coordinate x, and order service location vertical coordinate y. Each set of service personnel data includes the service personnel number, service personnel service score, and the horizontal and vertical coordinates of the service personnel's initial departure position. The order data time is from August 25, 2022 to September 10, 2022, with a time span of 17 days.
[0147] Due to the large size of the experimental dataset and the inherent randomness of the LNS algorithm, the results obtained from each experiment may vary, and even abnormal experimental data may appear. Therefore, to prevent abnormal experimental data from interfering with the experimental conclusion analysis and to prove the reliability of the order allocation scheme involved in this invention, the runtime Time(s) and optimization target value obj of the algorithm before and after the improvement were calculated through repeated experiments on a large-scale dataset, thereby more accurately analyzing the experimental results, as shown in Table 1. The lower the Time(s) value and the higher the obj value, the better the algorithm performance.
[0148] Table 1:
[0149]
[0150] According to the data in Table 1, compared with the existing benchmark LNS algorithm, the order matching algorithm involved in the present invention has better comprehensive performance. It can have a faster reasoning speed while ensuring a high objective function value, is more in line with actual needs, and can effectively improve the intelligence and rationality of order allocation in the online housekeeping service platform.
[0151] In order to further verify the rationality of the objective function model constructed by the present invention, the experiment uses the participation rate of high-scoring service personnel (those with a score higher than 0.85 are set as high-scoring service personnel, and the full score is 1.00) in the service, the average distance traveled by the service personnel for each order, and the average score Score of all service personnel involved in the order service as evaluation indicators. Experiments are conducted respectively when only customer satisfaction, only service personnel income, and comprehensive consideration of the service personnel's average score, the distance traveled by the service personnel in the process of serving each order, and the time interval between the service personnel serving two adjacent orders are used as objective functions. All experiments are based on the online housekeeping order allocation method that considers the comprehensive benefits of the platform involved in the present invention. In order to avoid the interference of abnormal experimental data that may be caused by the randomness of the algorithm, the strategy of repeated experiments is still adopted, and the average value of ten groups of experimental data without abnormalities is taken as the final experimental result, so as to ensure the reliability of the experimental results and conclusions. The calculation method of the service ratio Rate, the average distance Distance, and the average score Score is as follows:
[0152] ;
[0153] ;
[0154] ;
[0155] Among them, Num grate_work Indicates the number of service personnel with a score higher than 0.85 who participated in the order service, Num grate Indicates the number of service personnel with a score higher than 0.85 in the dataset, Num work Indicates the number of service personnel involved in the service, Distance i Score represents the average distance traveled by the i-th service personnel for each order. i represents the rating of the i-th service member who participated in the service. Customer satisfaction is measured by the average rating of all service members who served orders. A higher average rating indicates higher customer satisfaction. Service member income is measured by the average number of orders received per service member. A higher average rating indicates a higher average income for practitioners in the industry. The comparative experimental results are shown in Table 2.
[0156] Table 2:
[0157]
[0158] Analysis of the experimental data in Table 2 shows that:
[0159] (1) When only considering customer satisfaction, although the proportion of service personnel with high scores participating in the service is slightly higher than the proportion of service personnel with high scores participating in the service under the objective function constructed based on the present invention, the increase is only 1.44 percentage points. In addition, the average score of service personnel who actually participated in the order service only increased by 0.012. These improvements have little effect on the overall efficiency of order matching. However, when the objective function constructed by the present invention is used, the average travel distance of service personnel for each order is shortened by nearly 2 kilometers compared to when only considering customer satisfaction. This means that service personnel can participate in the service of other orders more often in unit time, which to a certain extent promotes the increase of their own income. Therefore, the objective function constructed by the present invention is more reasonable than considering only customer satisfaction.
[0160] (2) When only the service personnel's income is considered, although the average travel distance per service order is shortened by about 0.5 km, when the objective function constructed by the present invention is used, the proportion of high-scoring service personnel participating in the service is 22.41 percentage points higher, and the average score of the service personnel participating in the order is also improved by 0.035. This means that when the objective function constructed by the present invention is used as the optimization target, it is possible to take into account customer satisfaction while not excessively increasing the travel distance of service personnel in the process of serving orders, which is more in line with the expectations of the order allocation strategy in the online housekeeping service platform.
[0161] The above experimental results can effectively prove the effectiveness of the online housekeeping order allocation method that considers the comprehensive benefits of the platform involved in the present invention, and can also verify the rationality of the objective function constructed in the present invention.
[0162] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved. This is not limited herein.
[0163] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A method for allocating online housekeeping service orders considering the comprehensive benefits of the platform, characterized in that: include: S1: Determine the constraints and objective function of the prediction model used to predict order allocation results based on the influencing parameters that affect the comprehensive benefits of the housekeeping service platform; S2: Sort the orders to be analyzed by importance, and segment the sorted order sequence to obtain an initial optimal solution for predicting order allocation results, and the initial optimal solution satisfies the constraints. Step S2 includes: S21: constructing an order node set from the service orders and service personnel, and constructing a complete undirected graph from the order node set; constructing a graph Laplacian matrix based on the complete undirected graph using an adjacency matrix method, and calculating eigenvalues of the graph Laplacian matrix, where the eigenvalues represent the importance of the corresponding order; S22: Perform K-means clustering on the order location and order time to obtain several clusters; sort the orders within the cluster and between clusters based on the characteristic values of the orders within the cluster and the number of connections between the orders in the clusters; S23: Use the K-means clustering algorithm to segment the order sequence obtained in step S22 to obtain multiple subsequences, and calculate the comprehensive score of each order in the current subsequence; sort all orders according to the comprehensive score to obtain the initial optimal solution; S3: Based on the constraints and objective function obtained in step S1, a local search based on reinforcement learning is performed on the initial optimal solution obtained in step S2 to predict the optimal order allocation result that satisfies the constraints and objective function. Step S3 includes: S31: Inputting the initial optimal solution into multiple feature encoding modules based on the Transformer network to extract order features, thereby obtaining an initial state and initial features, wherein the orders in the initial state satisfy the constraint conditions; S32: Input the initial state and initial features obtained in step S31 into the destruction module, obtain and execute the current destruction action of deleting some order nodes, obtain the current destruction state, determine whether the orders in the current destruction state meet the constraints, and determine the current destruction reward corresponding to the current destruction action; In the destruction module: Decoding the initial state or the repair state at the previous moment through a destruction strategy network to obtain a current destruction action; After executing the current destruction action to obtain the current destruction state, the destruction reward function is used to evaluate the current destruction state to obtain the current destruction reward; The destruction strategy network includes a multi-head self-attention module and an LSTM network; wherein the multi-head self-attention module interacts features between the initial state and the repair state at the previous moment, and then uses the LSTM network to decode the execution sequence of the interaction features to obtain a removal probability score for removing the order node; and according to the removal probability distribution, the order node is removed from the set of order nodes at the previous moment to complete the current destruction action; S33: Input the current damage state obtained in step S32 into the repair module, obtain and execute the current repair action, obtain the current repair state and the corresponding order sequence, determine the current repair reward corresponding to the current repair action, and the orders in the current repair state meet the constraints; in the repair module: The damage state at the previous moment is decoded through the repair strategy network to obtain the current repair action; After executing the current repair action and obtaining the current repair state, the repair reward function uses the change in the objective function of the current repair state before and after the current repair state as the current repair reward; In the repair strategy network, multi-head self-attention is used to decode the current damage state and the removed order nodes to obtain a repair probability distribution of the order node insertion positions; the first multiple positions that match the number of removed order nodes are selected as insertion areas; and the removed order nodes are sequentially inserted into the set of order nodes at the previous moment according to the repair probability distribution to complete the current repair action; S34: Input the order sequence obtained in step S33 into the feature encoding module for feature extraction, replace the initial features and initial state in step S32 with the extracted features and the current repair state, repeat steps S32 to S34, and output the optimal order allocation result from the repair module.
2. The online housekeeping service order allocation method considering the comprehensive benefits of the platform according to claim 1 is characterized in that: The objective function in step S1 is: ; Where obj represents the optimization target value, α, β and γ are weight parameters in the objective function, α+β+γ=1, I represents the total number of service personnel, J represents the total number of orders, and f i represents the service score of the i-th service staff, 0.5 <f i <1, R ij The value is 0 or 1, R ij = 0, indicating that the jth order is not served by the i-th service personnel. ij =1, it means that the jth order is served by the i-th service personnel. serve | represents the number of service personnel actually involved in order service, D jj’ represents the Euclidean distance between the jth order and the j'th order, X ijj’ Indicates a value of 0 or 1, X ijj’ = 0, indicating that the next order of the jth order of the i-th service staff is not the j'th order. ijj’ =1 means the next order of the jth order of the i-th service staff is the j'th order, represents the time when the i-th service staff executes the j'th order, represents the time when the i-th service staff executes the j-th order, represents the service duration of the j-th order.
3. The online housekeeping service order allocation method considering the comprehensive benefits of the platform according to claim 2 is characterized in that: The constraints in step S1 include the number of service personnel for each order, the service time for each order, the temporal and spatial connectivity of the order routes for each order, and the location constraint that all service personnel start from the starting point for the first order and the i-th service personnel starts from the starting location and travels to the location of the j-th order. The service headcount constraints are: ; The service time constraint is an integer multiple of half an hour between the earliest service start time and the latest service start time of each order. All service personnel must arrive at the order location before the latest service start time of each order, that is: in, represents the latest service start time for the jth order, represents the earliest service start time for the jth order, a ij’ represents the time when the i-th service staff arrives at the j'th order location, and M represents a positive integer; The temporal connectivity satisfies: ; Among them, v represents the speed of service personnel; The spatial connectivity satisfies: The position constraints satisfy: Among them, p i represents the initial position of the i-th service staff, Indicates that the i-th service staff starts from the initial position p i Whether to directly reach the j'th order position, The value is 0 or 1. When the value is 0, it means that the i-th service staff starts from the initial position p i Does not directly reach the j'th order position, When the value is 1, it means that the i-th service staff starts from the initial position p i Directly reach the j'th order position.
4. The online housekeeping service order allocation method considering the comprehensive benefits of the platform according to claim 1 is characterized in that: The process of calculating the comprehensive score of each order in the current subsequence in step S23 includes: Calculate the Euclidean distance of each order to the first order in the current subsequence, and perform a weighted calculation with the service score of each order to obtain the comprehensive score corresponding to each order.
5. The online housekeeping service order allocation method considering the comprehensive benefits of the platform according to claim 1 is characterized in that: In each feature encoding module, the initial optimal solution is input into the linear transformation layer for linear transformation; the output of the linear transformation layer is then subjected to two feature extractions and order rearrangement in the first attention submodule and the second attention submodule in sequence to obtain the initial state; In the first attention submodule, a multi-head attention mechanism is used to encode the input features, and the encoded features are batch normalized to obtain the output; In the second attention submodule, the input features are first processed by a feedforward neural network, and the processed features are then batch normalized to obtain the output.
6. The online housekeeping service order allocation method considering the comprehensive benefits of the platform according to claim 1 is characterized in that: The destruction reward function is: ; in, represents the destruction reward function, Indicates the current damage status, Indicates the current destruction action, m and n represent the mth order node and nth order node respectively. The correlation between the mth order node and the nth order node is obtained by the following formula: ; Among them, ε and η are weight values, d mn Represents the Euclidean distance between the mth order node and the nth order node, that is: ; in, and Represent the position coordinates of the mth order node and the nth order node respectively.
7. The online housekeeping service order allocation method considering the comprehensive benefits of the platform according to claim 1 is characterized in that: The repair reward function is: ; in, represents the repair reward function, Indicates the current repair status. Indicates the current repair action, m and n represent the mth order node and nth order node respectively. The correlation between the mth order node and the nth order node is obtained by the following formula: ; Among them, ε and η are weight values, d mn Represents the Euclidean distance between the mth order node and the nth order node, that is: ; in, and Represent the position coordinates of the mth order node and the nth order node respectively.