A method and apparatus for multitasking
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-10
- Publication Date
- 2026-08-11
AI Technical Summary
这种方式缺乏透明、统一的任务状态跟踪与反馈机制,容易导致任务在流转过程中出现延迟、遗漏甚至推诿扯皮
[0018] Using the embodiments of this specification, a task allocation result for processing tasks is generated based on the execution cost of each processing task for multiple processing resources in a processing resource cluster. This allows staff to allocate the multiple target tasks to the corresponding processing resources according to the task allocation result, thereby improving resource utilization and task processing efficiency.
Smart Images

Figure CN122549765A_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification relate to the field of computer technology, and in particular to a multi-task allocation method and apparatus. Background Technology
[0002] In court trial management and other related work, multi-task allocation is a prevalent and crucial core element. Essentially, it involves the rational allocation of limited resources to the continuous influx of various cases (macro-level tasks) and the specific tasks (micro-level tasks) throughout the entire case handling process. These resources include, but are not limited to, human resources such as judges, judicial assistants, court clerks, and enforcement officers, as well as spatial and temporal resources such as courtrooms, conference rooms, and time slots. Efficient and scientific multi-task allocation is decisive for improving trial quality and efficiency, optimizing resource allocation, and alleviating the contradiction of "too many cases and too few personnel."
[0003] Currently, the multi-task allocation mechanism in the court system still relies heavily on manual decision-making and experience-based judgment in many aspects, and its level of intelligence and automation needs to be improved. Specifically, this is reflected in the following aspects: Firstly, at the case allocation level, relatively fixed rules such as "waiting list allocation" or "assignment by type" are currently widely adopted. For example, when the case filing division allocates cases to various business divisions or even specific judges, although it considers the matching of case types with judges' professional specializations to some extent, it often finds it difficult to dynamically and accurately assess the real-time workload of each judge. This easily leads to uneven workloads among different judges, with some judges being overworked for extended periods and experiencing severe case backlogs, while the adjudication capabilities of other judges are not fully utilized, affecting overall efficiency and the physical and mental health of judges.
[0004] Secondly, in terms of the allocation of trial procedures, especially in the scheduling of court hearings, current practices heavily rely on manual coordination by court clerks or administrative staff. They need to repeatedly communicate with judges, litigants, lawyers, and court administration departments via telephone and internal office systems to determine a hearing time and location acceptable to all parties. This process is not only time-consuming and labor-intensive with high communication costs, but also, due to information asymmetry and the localization of decision-making, often results in both idle and congested court resources (such as smart courts and specialized courtrooms), fragmented scheduling, and difficulty in optimizing resource utilization.
[0005] Secondly, regarding task coordination and workflow, the assignment and follow-up of tasks between various departments within the court (such as the case filing division, trial division, and enforcement bureau) and within trial teams (judges, judicial assistants, and court clerks) largely rely on traditional administrative approvals or verbal assignments. This approach lacks a transparent and unified task status tracking and feedback mechanism, easily leading to delays, omissions, or even buck-passing during task workflow. For example, an application for preservation measures may go through multiple stages from submission to final execution; without effective dynamic task tracking and reminders, the legitimate rights and interests of the parties involved will be directly affected.
[0006] Furthermore, existing court trial management systems mostly focus on information recording and process management rather than intelligent decision support. They lack a core intelligent allocation engine that can comprehensively consider task attributes (such as case type, urgency, and estimated time), resource status (such as judges' current workload, professional capabilities, and schedules), and constraints (such as statutory time limits and procedural requirements). Therefore, the current multi-task allocation model is poorly adaptable, unable to quickly respond to emergencies (such as judges being temporarily unable to hold court due to illness), and struggles to achieve refined management and globally optimal resource allocation based on the differentiation of complex and simple cases and the separation of fast and slow processes. Summary of the Invention
[0007] To address the problems existing in the prior art, embodiments of this specification provide a multi-task allocation method and apparatus, which designs a task allocation model to allocate multiple tasks to multiple processing resources, thereby improving resource utilization and task processing efficiency.
[0008] The specific technical solutions of the embodiments in this specification are as follows: On the one hand, the embodiments of this specification provide a multi-task allocation method. The method includes: Obtain task allocation information for multiple historical tasks from multiple processing resources in the processing resource cluster. The allocation information includes the first execution cost of each processing resource for each historical task and the actual task allocation of the multiple historical tasks. A first cost matrix is generated based on the first execution cost, and a first initial variable is set; The initial task allocation model is trained using the first cost matrix, the first initial variable, and the actual task allocation situation to obtain the target task allocation model; Obtain the second execution cost of multiple target tasks to be allocated in the processing resource cluster; A second cost matrix is generated based on the second execution cost, and a second initial variable is set; The second cost matrix and the second initial variable are input into the target task allocation model for processing to obtain the task allocation results of the multiple target tasks, so that the staff can allocate the multiple target tasks to the corresponding processing resources according to the task allocation results.
[0009] Furthermore, generating a first cost matrix based on the first execution cost and setting a first initial variable further includes: Each first execution cost is used as an element in the first cost matrix, which has a dimension of m×n, where m is the number of processing resources and n is the number of historical tasks. The first initial variable x0 := (u0, v0), where u0 is the first component of the first initial variable x0, v0 is the second component of the first initial variable x0, the vector length of u0 is m, the vector length of v0 is n, u0 with a vector length of m is randomly generated, v0 with a vector length of n is randomly generated, and the first initial variable x0 is obtained.
[0010] Furthermore, the initial task allocation model is trained using the first cost matrix, the first initial variable, and the actual task allocation situation to obtain the target task allocation model, which further includes: Construct a task allocation function based on the first cost matrix; Calculate the gradient of the task allocation function with respect to the first initial variable, and use it as the first gradient; The first initial variable and the first gradient are input into the initial task allocation model to update the first initial variable, and the update result of the first initial variable is obtained. The update result is used as the first initial variable. The step of calculating the gradient of the task allocation function with respect to the first initial variable is repeated until the number of repetitions reaches a predetermined number. The final update result is then used as the first final variable. The first final variable is calculated using the task allocation function to obtain the predicted task allocation result; Determine whether the deviation between the predicted task allocation result and the actual task allocation meets the requirements. If not, adjust the parameters of the initial task allocation model, and use the first final variable as the first initial variable. Repeat the step of calculating the gradient of the task allocation function with respect to the first initial variable until the deviation between the predicted task allocation result and the actual task allocation meets the requirements, and obtain the target task allocation model.
[0011] Furthermore, the formula for constructing the task allocation function based on the first cost matrix is as follows: P = exp(u t 1 T + v t T 1–γC); Where P represents the prediction task assignment result, x t := (u t , v t ), x t Let u represent the first initial variable during the t-th update. t v is the first component of the first initial variable at the t-th update. t v is the second component of the first initial variable at the t-th update. t T v represents the second component of the first initial variable at the t-th update. t The transpose of , where γ is a hyperparameter and C is the first cost matrix.
[0012] Furthermore, the initial task allocation model includes a first neural network model and a second neural network model; The steps for updating the first initial variable to obtain the update result include: Using the first neural network model and the first gradient at the current update, a local optimum is selected from the first initial variable at the current update. Calculate the global optimal points corresponding to all previous updates based on the local optimal points selected in each update before the current update; Calculate the global optimum corresponding to the current update based on the local optimum corresponding to the current update and the global optima corresponding to all previous updates; The second neural network model is used to calculate the global optimum, the first initial variable, and the first gradient corresponding to the current update, so as to obtain the diagonal preconditioner corresponding to the current update. The update result for the current update is obtained by using the diagonal preconditioner operator corresponding to the current update, the global optimum corresponding to the current update, and the first initial variable for the current update.
[0013] Furthermore, the formula for calculating the global optimum corresponding to all previous updates based on the local optima selected in each update prior to the current update is as follows: ; Where, x A t-1 Let A represent the global optimum corresponding to all updates prior to the t-th update. θ (·) represents the first neural network model, g iLet g0 represent the first gradient corresponding to the first initial variable at the i-th update, μ represent the set parameters, x0 represent the first initial variable at the 0-th update, and g0 represent the first gradient corresponding to the first initial variable at the 0-th update.
[0014] Furthermore, the formula for calculating the global optimum corresponding to the current update, based on the local optimum corresponding to the current update and the global optima corresponding to all previous updates, is as follows: x A t = μx A t-1 + (1-μ) A θ (x t , -g t ); Where, x A t Let g represent the global optimum corresponding to the t-th update. t This represents the first gradient corresponding to the first initial variable at the t-th update.
[0015] Furthermore, by using the second neural network model to calculate the global optimum, the first initial variable, and the first gradient corresponding to the current update, the formula for the diagonal preconditioner corresponding to the current update is obtained as follows: η t = G θ (x A t - x t , g t ); Where, η t Let G represent the diagonal preconditioner operator corresponding to the t-th update. θ (·) represents the second neural network model.
[0016] Furthermore, the formula for obtaining the update result of the current update based on the diagonal preconditioner operator corresponding to the current update, the global optimum corresponding to the current update, and the first initial variable at the time of the current update is as follows: x t+1 = x t + tanh(G θ (x A t - x t , g t (x) A t - x t )); Where, x t+1This represents the update result corresponding to the t-th update, and is the first initial variable for the (t+1)-th update.
[0017] On the other hand, embodiments of this specification also provide a multi-task allocation device, the device comprising: An information acquisition unit is used to acquire task allocation information of multiple processing resources to multiple historical tasks in a processing resource cluster. The allocation information includes the first execution cost of each processing resource to each historical task and the actual task allocation of the multiple historical tasks. An information processing unit is configured to generate a first cost matrix based on the first execution cost and set a first initial variable; The model training unit is used to train the initial task allocation model using the first cost matrix, the first initial variable, and the actual task allocation situation to obtain the target task allocation model. The information acquisition unit is also used to acquire the second execution cost of multiple target tasks to be allocated in multiple processing resources in the processing resource cluster; The information processing unit is further configured to generate a second cost matrix based on the second execution cost, and set a second initial variable; The prediction unit is used to input the second cost matrix and the second initial variable into the target task allocation model for processing, so as to obtain the task allocation results of the multiple target tasks, so that the staff can allocate the multiple target tasks to the corresponding processing resources according to the task allocation results.
[0018] Using the embodiments of this specification, a task allocation result for processing tasks is generated based on the execution cost of each processing task for multiple processing resources in a processing resource cluster. This allows staff to allocate the multiple target tasks to the corresponding processing resources according to the task allocation result, thereby improving resource utilization and task processing efficiency. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this specification 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 some embodiments of the embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 The diagram shown is a flowchart of a multi-task allocation method according to an embodiment of this specification. Figure 2 The diagram shown is a flowchart illustrating the training of the initial task allocation model in an embodiment of this specification. Figure 3The diagram shown is a flowchart illustrating the process of updating the first initial variable and obtaining the update result in an embodiment of this specification. Figure 4 The diagram shown is a structural schematic of a multi-task allocation device according to an embodiment of this specification. Figure 5 The diagram shown is a structural schematic of the computer device in an embodiment of this specification.
[0021] [Explanation of Figure Markers]: 401. Information Acquisition Unit; 402. Information Processing Unit; 403. Model training unit; 404, Prediction Unit; 502. Computer equipment; 504. Processing equipment; 506. Storage resources; 508. Drive mechanism; 510. Input / Output Module; 512. Input devices; 514. Output devices; 516. Presentation equipment; 518. Graphical User Interface; 520. Network interface; 522. Communication link; 524. Communication bus. Detailed Implementation
[0022] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the embodiments of this specification, and not all embodiments. Based on the embodiments of this specification, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the embodiments of this specification.
[0023] It should be noted that the terms "first," "second," etc., in the description, claims, and accompanying drawings of the embodiments herein are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, apparatus, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0024] It should be noted that the acquisition, storage, use, and processing of data in the technical solutions of the embodiments of this specification all comply with the relevant provisions of national laws and regulations.
[0025] It should be noted that in the embodiments of this specification, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, they do not mean that the applicant has used or necessarily used the solution.
[0026] To address the problems existing in the prior art, this specification provides a multi-task allocation method and designs a task allocation model. By using the task allocation model, multiple tasks are allocated to multiple processing resources, thereby improving resource utilization and task processing efficiency. Figure 1 The diagram illustrates a multi-task allocation method according to an embodiment of this specification. It depicts the process of training a task allocation model and using that model to allocate tasks to multiple processing resources in a processing resource cluster. The order of steps listed in the embodiment is merely one possible execution order among many and does not represent the only possible order. In actual system or device products, the method can be executed sequentially or in parallel, as shown in the embodiment or the accompanying drawings. Specifically, as shown... Figure 1 As shown, the method can be executed by a server, and the method may include: Step 101: Obtain task allocation information for multiple historical tasks from multiple processing resources in the processing resource cluster. The allocation information includes the first execution cost of each processing resource for each historical task and the actual task allocation of the multiple historical tasks. Step 102: Generate a first cost matrix based on the first execution cost, and set a first initial variable; Step 103: Train the initial task allocation model using the first cost matrix, the first initial variable, and the actual task allocation situation to obtain the target task allocation model; Step 104: Obtain the second execution cost of multiple processing resources in the processing resource cluster for multiple target tasks to be allocated; Step 105: Generate a second cost matrix based on the second execution cost, and set a second initial variable; Step 106: Input the second cost matrix and the second initial variable into the target task allocation model for processing to obtain the task allocation results of the multiple target tasks, so that the staff can allocate the multiple target tasks to the corresponding processing resources according to the task allocation results.
[0027] Using the embodiments of this specification, a task allocation result for processing tasks is generated based on the execution cost of each processing task for multiple processing resources in a processing resource cluster. This allows staff to allocate the multiple target tasks to the corresponding processing resources according to the task allocation result, thereby improving resource utilization and task processing efficiency.
[0028] In the embodiments described in this specification, the processing resources in the processing resource cluster can be robots, servers, etc., and the execution cost is c. ij This represents the resource cost of the i-th processing resource executing the j-th task. This resource cost can be determined based on the computational load required by the task, the current remaining computational load of the processing resource, etc. If the processing resource is a robot, the execution cost can also be determined based on the distance between the robot and the location of the task. The execution cost can be determined by the staff based on the status of the processing resources and the status of the task. This specification does not impose any limitations on the embodiments.
[0029] Task allocation indicates which task(s) the i-th processing resource handles. Specifically, the calculated task allocation result can be in matrix form, where p is the element of the matrix. ij This represents the probability that the i-th processing resource will process the j-th task. Staff can decide whether to assign the j-th task to the i-th processing resource based on the probability.
[0030] The embodiments in this specification first use historical task allocation information to train a task allocation model. When a target task to be allocated is obtained, the task allocation result of the target task to be allocated is calculated based on the execution cost of each target task to be allocated by multiple processing resources with processing capacity in the processing resource cluster and the trained task allocation model.
[0031] During the training phase of the task allocation model, the embodiments of this specification use the first execution cost of processing resources for historical tasks as an element in the first cost matrix. The first cost matrix has a dimension of m×n, where m is the number of processing resources and n is the number of historical tasks. Then, set the first initial variable, x0 := (u0, v0), where u0 is the first component of the first initial variable x0, v0 is the second component of the first initial variable x0, the vector length of u0 is m, and the vector length of v0 is n. Therefore, the first initial variable x0 is a long vector. Randomly generate u0 with a vector length of m, and randomly generate v0 with a vector length of n to obtain the first initial variable x0.
[0032] In some other embodiments of this specification, the first and second components of the first initial variable may also be set to a vector containing all zeros.
[0033] Then, the initial task allocation model is trained using the cost matrix, the first initial variable, and the actual task allocation situation to obtain the target task allocation model. Specifically, as follows: Figure 2 As shown, the steps for training the initial task assignment model include: Step 201: Construct a task allocation function based on the cost matrix; Step 202: Calculate the gradient of the task allocation function with respect to the first initial variable, and use it as the first gradient; Step 203: Input the first initial variable and the first gradient into the initial task allocation model to update the first initial variable and obtain the update result of the first initial variable; Step 204: Determine whether the number of repetitions has reached the predetermined number; Step 205: If not, use the update result as the first initial variable and repeat the step of calculating the gradient of the task allocation function with respect to the first initial variable; Step 206: If so, use the final update result as the first final variable; Step 207: Calculate the first final variable using the task allocation function to obtain the predicted task allocation result; Step 208: Determine whether the deviation between the predicted task allocation result and the actual task allocation meets the requirements; Step 209: If not satisfied, adjust the parameters of the initial task allocation model, and use the first final variable as the first initial variable, and repeat the step of calculating the gradient of the task allocation function with respect to the first initial variable; Step 210: If satisfied, the target task allocation model is obtained.
[0034] In the embodiments described in this specification, the formula for constructing the task allocation function based on the cost matrix is as follows: P = exp(u t A T + Bv t T –γC); Where P represents the predicted task assignment result, which is an m×n matrix, and the elements p in the predicted task assignment result are... ij Let P represent the probability that the i-th processing resource processes the j-th task, A represent a vector of length m whose first component is all 1s, and B represent a vector of length n whose second component is all 1s. That is, P = exp(u t 1 T + v t T 1–γC). x t := (u t , v t ), x t Let u represent the first initial variable during the t-th update. t v is the first component of the first initial variable at the t-th update. t v is the second component of the first initial variable at the t-th update. t T v represents the second component of the first initial variable at the t-th update. t The transpose of , γ is a hyperparameter, C is the first cost matrix, and is an m×n matrix, where the elements c in the cost matrix are... ij This represents the resource overhead of the i-th processing resource in executing the j-th task.
[0035] In this embodiment, the 1-norm of the gradient of the task allocation function with respect to the first initial variable is used as an indicator to measure whether the first initial variable is the optimal variable. The first gradient is represented by g. t This means that the smaller the index, the better the first initial variable.
[0036] The training process of the task allocation model in this embodiment includes two nested loops. The number of iterations in the outer loop is determined by the deviation between the predicted task allocation result and the actual task allocation, while the number of iterations in the inner loop is a set value. The inner loop updates the first initial variable a set number of times based on the parameters of the task allocation model, ensuring that the first initial variable is optimal for the task allocation function. The outer loop iteratively optimizes the parameters of the task allocation model.
[0037] According to one embodiment of this specification, the initial task allocation model includes a first neural network model and a second neural network model. Both the first and second neural network models can be Transformer models. The purpose of the first neural network model is to select local optima from the output variables. Theoretically, local optima can correct the update direction of parameter optimization. However, in this embodiment, the global optimum is calculated in the form of momentum by combining iterative process information. The global optimum is used to correct the update direction of the parameter optimization path. The global optimum is only an estimate of the true value of the variables. In order to enhance the ability to accurately search for the optimal solution, this embodiment introduces a second neural network model. The purpose of the second neural network model is to calculate learnable precondition operators and coordinate with the global optimum to adjust the update direction of the parameter optimization path, thereby accelerating convergence.
[0038] It should be noted that the Transformer model is a neural network architecture model. Once the parameters are determined through training, the corresponding mapping relationship is also determined. The first neural network model A in the embodiments of this specification... θ Second neural network model G θ All of them adopted the Transformer architecture because of its excellent representation capabilities. When the parameters of the Transformer are different, the corresponding mappings are also different. Therefore, after training, if A... θ The local optimum was successfully predicted, G θ Successfully predicting the preconditioner can significantly accelerate the entire solution process (local optima in optimization are used to calculate the global optimum; optimal preconditioners can speed up the solution). First neural network model A θ Second neural network model G θ The causal relationship between input and output is fully reflected in the training process. The purpose of training is to find parameters that make the training function better, or to find neural network transformations that make the training function better. These transformations have a greater probability of making the output approach the local optimum and the preconditioning operator.
[0039] The Transformer neural network architecture includes attention, linear transformation, activation transformation, and normalization modules from deep learning. These modules contain the parameters to be trained. The Transformer architecture is formed by arranging and combining these modules according to rules known in the field. Given the parameters of each module, it accepts input data, which is then processed by the aforementioned modules in a specific arrangement to obtain the output data.
[0040] Therefore, as Figure 3As shown, the steps for updating the first initial variable to obtain the update result include: Step 301: Select a local optimum from the first initial variable at the time of the current update using the first neural network model and the first gradient at the time of the current update; Step 302: Calculate the global optimal points corresponding to all previous updates based on the local optimal points selected in each update before the current update; Step 303: Calculate the global optimum corresponding to the current update based on the local optimum corresponding to the current update and the global optima corresponding to all updates before the current update; Step 304: Calculate the global optimum, the first initial variable, and the first gradient corresponding to the current update using the second neural network model to obtain the diagonal preconditioner corresponding to the current update; Step 305: Obtain the update result corresponding to the current update based on the diagonal preconditioner operator corresponding to the current update, the global optimum corresponding to the current update, and the first initial variable at the time of the current update.
[0041] In the embodiments of this specification, the formula for calculating the global optimum corresponding to all previous updates based on the local optima selected in each update prior to the current update is as follows:
[0042] Where, x A t-1 Let A represent the global optimum corresponding to all updates prior to the t-th update. θ (·) represents the first neural network model, g i Let g0 represent the first gradient corresponding to the first initial variable at the i-th update, μ represent the set parameters, x0 represent the first initial variable at the 0-th update, and g0 represent the first gradient corresponding to the first initial variable at the 0-th update.
[0043] In the embodiments of this specification, the formula for calculating the global optimum corresponding to the current update based on the local optimum corresponding to the current update and the global optima corresponding to all updates prior to the current update is as follows: x A t = μx A t-1 + (1-μ) A θ (x t , -g t ); Where, x A t Let g represent the global optimum corresponding to the t-th update.t This represents the first gradient corresponding to the first initial variable at the t-th update.
[0044] In this embodiment of the specification, the second neural network model is used to calculate the global optimum, the first initial variable at the time of the current update, and the first gradient at the time of the current update, to obtain the formula for the diagonal preconditioner operator corresponding to the current update: η t = G θ (x A t - x t , g t ); Where, η t Let G represent the diagonal preconditioner operator corresponding to the t-th update. θ (·) represents the second neural network model.
[0045] The second neural network model will (x) A t - x t , g t Mapping to a diagonal matrix, and applying the Hessian matrix to the negative gradient -g t Unlike the second-order optimization method, the embodiments in this specification apply the diagonal matrix mapped by the second neural network model to (x A t - x t This is designed to facilitate the control of update direction and update step size, thereby enhancing the stability of the algorithm.
[0046] In the embodiments of this specification, the formula for obtaining the update result corresponding to the current update based on the diagonal preconditioner operator corresponding to the current update, the global optimum corresponding to the current update, and the first initial variable at the time of the current update is as follows: x t+1 = x t + tanh(G θ (x A t - x t , g t (x) A t - x t )); Where, x t+1 This represents the update result corresponding to the t-th update, and is the first initial variable for the (t+1)-th update.
[0047] Furthermore, the embodiments in this specification use the variable x. t The first component u t Second component vt An alternating update method, for example: updating the first component u during the t-th update. t The first component u is obtained. t Update result u t+1 And keep the second component v t Unchanged, i.e., v t+1 = v t The obtained x t+1 := (u t+1 , v t+1 ); during the (t+1)th update, update the second component v. t+1 The second component v is obtained. t+1 Update result v t+2 And keep the first component u t+1 Unchanged, i.e., u t+2 = u t+1 The obtained x t+2 :=(u t+2 , v t+2 ).
[0048] This can be understood as both the first and second neural networks containing u. t and v t The components in these two directions, i.e., u t and v t The calculations are performed by their respective first neural network components and second neural network components.
[0049] Specifically: u t+1 = u t + tanh(G θ u (x A t - x t , g t )(u A t - u t )); v t+1 = v t + tanh(G θ v (x A t - x t , g t (v) A t - v t )).
[0050] Among them, G θ u For the second neural network Gθ in u t Components in direction, G θ v For the second neural network G θ In v t Components in direction.
[0051] After the Tth update (where T represents the predetermined number of repetitions, i.e., the loop iteration count of the inner loop), we obtain x. T+1 := (u T+1 , v T+1 ), x T+1 Input into the task allocation function, i.e., P = exp(u T+1 A T + B v T+1 T In –γC), the predicted task assignment result P is obtained.
[0052] Then, the loss function is calculated. In this embodiment, KL divergence is used as the training loss function. Minimizing this loss function will reduce the deviation between the predicted task allocation result P and the actual task allocation.
[0053] If the loss function does not converge, the parameters of the first and second neural network models are adjusted, and an outer loop is performed until the loss function converges, resulting in the trained first and second neural network models.
[0054] When allocating multiple target tasks to be assigned, staff can first output the second execution cost of multiple processing resources in the processing resource cluster for the multiple target tasks to be assigned. Then, a second cost matrix is generated based on the second execution cost, and the second initial variable is set in the same way as the first initial variable in the training phase of the task allocation model. The second cost matrix and the second initial variable are then input into the target task allocation model for processing.
[0055] Specifically, the prediction phase only performs an inner loop, that is: Construct a task allocation function based on the cost matrix consisting of the second execution cost; Calculate the gradient of the task allocation function with respect to the second initial variable, and use it as the second gradient; The second initial variable and the second gradient are input into the trained target task assignment model to update the second initial variable, and the update result of the second initial variable is obtained. The update result is used as the second initial variable. The step of calculating the gradient of the task allocation function with respect to the second initial variable is repeated until the number of repetitions reaches a predetermined number. The final update result is then used as the second final variable. The task allocation function is used to calculate the second final variable to obtain the task allocation results for the multiple target tasks.
[0056] Based on the same inventive concept, embodiments of this specification also provide a multi-task allocation device, such as... Figure 4 As shown, it includes: Information acquisition unit 401 is used to acquire task allocation information of multiple processing resources to multiple historical tasks in a processing resource cluster. The allocation information includes the first execution cost of each processing resource to each historical task and the actual task allocation of the multiple historical tasks. Information processing unit 402 is used to generate a first cost matrix based on the first execution cost and set a first initial variable; The model training unit 403 is used to train the initial task allocation model using the first cost matrix, the first initial variable and the actual task allocation situation to obtain the target task allocation model. The information acquisition unit 401 is also used to acquire the second execution cost of multiple target tasks to be allocated in multiple processing resources in the processing resource cluster; The information processing unit 402 is further configured to generate a second cost matrix based on the second execution cost and set a second initial variable; The prediction unit 404 is used to input the second cost matrix and the second initial variable into the target task allocation model for processing, so as to obtain the task allocation results of the multiple target tasks, so that the staff can allocate the multiple target tasks to the corresponding processing resources according to the task allocation results.
[0057] The beneficial effects obtained by the above-described device are the same as those obtained by the above-described method, and will not be described in detail in the embodiments of this specification.
[0058] like Figure 5The diagram illustrates the structure of a computer device according to an embodiment of this specification. The methods described in this specification can be applied to the computer device in this embodiment to execute the methods described in the embodiments of this specification. The computer device 502 may include one or more processing devices 504, such as one or more central processing units (CPUs), each of which can implement one or more hardware threads. The computer device 502 may also include any storage resource 506 for storing information of any kind, such as code, settings, data, etc. Without limitation, for example, the storage resource 506 may include any type of RAM, any type of ROM, flash memory, hard disk, optical disk, etc. More generally, any storage resource can use any technology to store information. Furthermore, any storage resource can provide volatile or non-volatile retention of information. Furthermore, any storage resource may represent a fixed or removable component of the computer device 502. In one case, when the processing device 504 executes associated instructions stored in any storage resource or combination of storage resources, the computer device 502 can perform any operation of the associated instructions. The computer device 502 also includes one or more drive mechanisms 508 for interacting with any storage resource, such as hard disk drive mechanism, optical disk drive mechanism, etc.
[0059] Computer device 502 may also include an input / output module 510 (I / O) for receiving various inputs (via input device 512) and providing various outputs (via output device 514). A specific output mechanism may include a presentation device 516 and an associated graphical user interface (GUI) 518. In other embodiments, the input / output module 510 (I / O), input device 512, and output device 514 may be omitted, and the device may function solely as a computer device within a network. Computer device 502 may also include one or more network interfaces 520 for exchanging data with other devices via one or more communication links 522. One or more communication buses 524 couple the components described above together.
[0060] Communication link 522 can be implemented in any way, such as via a local area network, a wide area network (e.g., the Internet), a point-to-point connection, or any combination thereof. Communication link 522 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.
[0061] This specification also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0062] This specification also provides computer-readable instructions, wherein when a processor executes the instructions, the program therein causes the processor to perform the above-described method.
[0063] It should be understood that in the various embodiments of this specification, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this specification.
[0064] It should also be understood that, in the embodiments of this specification, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the embodiments of this specification, the character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0065] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of the embodiments in this specification.
[0066] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0067] In the embodiments provided in this specification, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces, devices, or units, or they may be electrical, mechanical, or other forms of connection.
[0068] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments described in this specification, depending on actual needs.
[0069] Furthermore, the functional units in the various embodiments of this specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0070] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this specification, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this specification. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0071] This specification describes the principles and implementation methods of the embodiments using specific examples. The above descriptions of the embodiments are only for the purpose of helping to understand the methods and core ideas of the embodiments in this specification. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the embodiments in this specification. Therefore, the content of this specification should not be construed as a limitation on the embodiments in this specification.
Claims
1. A multi-task allocation method, characterized in that, The method includes: Obtain task allocation information for multiple historical tasks from multiple processing resources in the processing resource cluster. The allocation information includes the first execution cost of each processing resource for each historical task and the actual task allocation of the multiple historical tasks. Generate a first cost matrix based on the first execution cost, and set a first initial variable; The initial task allocation model is trained using the first cost matrix, the first initial variable, and the actual task allocation situation to obtain the target task allocation model; Obtain the second execution cost of multiple target tasks to be allocated in multiple processing resources in the processing resource cluster; A second cost matrix is generated based on the second execution cost, and a second initial variable is set; The second cost matrix and the second initial variable are input into the target task allocation model for processing to obtain the task allocation results of the multiple target tasks, so that the staff can allocate the multiple target tasks to the corresponding processing resources according to the task allocation results.
2. The method according to claim 1, characterized in that, Generating a first cost matrix based on the first execution cost, and setting a first initial variable further includes: Each first execution cost is used as an element in the first cost matrix, which has a dimension of m×n, where m is the number of processing resources and n is the number of historical tasks. The first initial variable x0 := (u0, v0), where u0 is the first component of the first initial variable x0, v0 is the second component of the first initial variable x0, the vector length of u0 is m, the vector length of v0 is n, u0 with a vector length of m is randomly generated, v0 with a vector length of n is randomly generated, and the first initial variable x0 is obtained.
3. The method according to claim 2, characterized in that, The initial task allocation model is trained using the first cost matrix, the first initial variable, and the actual task allocation situation to obtain the target task allocation model, which further includes: Construct a task allocation function based on the first cost matrix; Calculate the gradient of the task allocation function with respect to the first initial variable, and use it as the first gradient; The first initial variable and the first gradient are input into the initial task allocation model to update the first initial variable, and the update result of the first initial variable is obtained. The update result is used as the first initial variable. The step of calculating the gradient of the task allocation function with respect to the first initial variable is repeated until the number of repetitions reaches a predetermined number. The final update result is then used as the first final variable. The first final variable is calculated using the task allocation function to obtain the predicted task allocation result; Determine whether the deviation between the predicted task allocation result and the actual task allocation meets the requirements. If not, adjust the parameters of the initial task allocation model, and use the first final variable as the first initial variable. Repeat the step of calculating the gradient of the task allocation function with respect to the first initial variable until the deviation between the predicted task allocation result and the actual task allocation meets the requirements, and obtain the target task allocation model.
4. The method according to claim 3, characterized in that, The formula for constructing the task allocation function based on the first cost matrix is as follows: P = exp(u t 1 T + v t T 1–γC); Where P represents the prediction task assignment result, x t := (u t , v t ), x t Let u represent the first initial variable during the t-th update. t v is the first component of the first initial variable at the t-th update. t v is the second component of the first initial variable at the t-th update. t T v represents the second component of the first initial variable at the t-th update. t The transpose of , where γ is a hyperparameter and C is the first cost matrix.
5. The method according to claim 4, characterized in that, The initial task allocation model includes a first neural network model and a second neural network model; The steps for updating the first initial variable to obtain the update result include: Using the first neural network model and the first gradient at the current update, a local optimum is selected from the first initial variable at the current update. Calculate the global optimal points corresponding to all previous updates based on the local optimal points selected in each update before the current update; Calculate the global optimum corresponding to the current update based on the local optimum corresponding to the current update and the global optima corresponding to all previous updates; The second neural network model is used to calculate the global optimum, the first initial variable, and the first gradient corresponding to the current update, so as to obtain the diagonal preconditioner corresponding to the current update. The update result for the current update is obtained by using the diagonal preconditioner operator corresponding to the current update, the global optimum corresponding to the current update, and the first initial variable for the current update.
6. The method according to claim 5, characterized in that, The formula for calculating the global optimum corresponding to all previous updates based on the local optima selected in each update prior to the current update is: ; Where, x A t-1 Let A represent the global optimum corresponding to all updates prior to the t-th update. θ (·) represents the first neural network model, g i Let g0 represent the first gradient corresponding to the first initial variable at the i-th update, μ represent the set parameters, x0 represent the first initial variable at the 0-th update, and g0 represent the first gradient corresponding to the first initial variable at the 0-th update.
7. The method according to claim 6, characterized in that, The formula for calculating the global optimum corresponding to the current update, based on the local optimum corresponding to the current update and the global optima corresponding to all previous updates, is as follows: x A t = μx A t-1 + (1-μ) A θ (x t , -g t ); Where, x A t Let g represent the global optimum corresponding to the t-th update. t This represents the first gradient corresponding to the first initial variable at the t-th update.
8. The method according to claim 7, characterized in that, Using the second neural network model, the global optimum, the first initial variable, and the first gradient corresponding to the current update are calculated to obtain the formula for the diagonal preconditioner operator corresponding to the current update: or t = G θ (x A t - x t , g t ); Where, η t Let G represent the diagonal preconditioner operator corresponding to the t-th update. θ (·) represents the second neural network model.
9. The method according to claim 8, characterized in that, The formula for obtaining the update result of the current update, based on the diagonal preconditioner operator corresponding to the current update, the global optimum corresponding to the current update, and the first initial variable at the time of the current update, is as follows: x t+1 = x t + tanh(G θ (x A t - x t , g t )(x A t - x t )); Where, x t+1 This represents the update result corresponding to the t-th update, and is the first initial variable for the (t+1)-th update.
10. A multi-task allocation device, characterized in that, The device includes: An information acquisition unit is used to acquire task allocation information of multiple processing resources to multiple historical tasks in a processing resource cluster. The allocation information includes the first execution cost of each processing resource to each historical task and the actual task allocation of the multiple historical tasks. An information processing unit is configured to generate a first cost matrix based on the first execution cost and set a first initial variable; The model training unit is used to train the initial task allocation model using the first cost matrix, the first initial variable, and the actual task allocation situation to obtain the target task allocation model. The information acquisition unit is also used to acquire the second execution cost of multiple target tasks to be allocated in multiple processing resources in the processing resource cluster; The information processing unit is further configured to generate a second cost matrix based on the second execution cost, and to set a second initial variable; The prediction unit is used to input the second cost matrix and the second initial variable into the target task allocation model for processing, so as to obtain the task allocation results of the multiple target tasks, so that the staff can allocate the multiple target tasks to the corresponding processing resources according to the task allocation results.