A task planning method and device, electronic equipment and readable medium
Through non-negative matrix decomposition and neural network models, tasks are assigned to the execution order one by one, which solves the problems of solution speed and accuracy in multi-constraint multi-task time planning problems and improves the solution efficiency and robustness of the task planning model.
Patent Information
- Application Number
- CN202410515295.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-26
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-04-26
AI Technical Summary
When dealing with time planning problems with many constraints and a large number of tasks, existing technologies cannot simultaneously meet the requirements of solution speed and solution accuracy.
The non-negative matrix factorization method is used to reduce the dimension of the time constraint matrix. Combined with the structure encoder, sequential encoder and decoder, the task planning model is used to assign the execution order of the tasks one by one. The neural network model is used to calculate the probability and the roulette algorithm is used to determine the task execution order.
It improves the speed and accuracy of solving task planning problems, enhances the robustness and anti-interference ability of the model, saves storage space and computing resources, and reduces computational complexity.
Smart Images

Figure CN118536698B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a task planning method, a task planning device, an electronic device, and a computer-readable medium. Background Art
[0002] Time planning, also known as task planning, involves planning the execution sequence of multiple tasks. It is a core area of operations research, integrating mathematics and computer science to provide decision support for task planners. The difficulty of solving time planning problems is often related to the constraints and the number of tasks involved. When dealing with time planning problems with numerous constraints and tasks, existing technologies cannot simultaneously meet the requirements for speed and accuracy. Summary of the Invention
[0003] Embodiments of the present invention provide a task planning method, device, electronic device, and computer-readable storage medium to solve the problem that when processing time planning problems with many constraints and a large number of tasks, the existing technology cannot simultaneously meet the requirements of solving time planning problems in terms of speed and accuracy.
[0004] An embodiment of the present invention discloses a task planning method, the method comprising:
[0005] Obtaining a time constraint matrix and an execution time matrix for the tasks to be planned; the elements in the time constraint matrix are related to the limited time intervals between any two tasks to be planned; and the elements in the execution time matrix are related to the limited execution times of the tasks to be planned;
[0006] Reducing the dimension of the time constraint matrix based on a non-negative matrix factorization method to obtain a reduced dimension matrix;
[0007] The dimension reduction matrix and the execution time matrix are input into a preset task planning model, and corresponding tasks to be planned are allocated to at least one preset execution order.
[0008] Optionally, the step of inputting the dimension reduction matrix and the execution time matrix into a preset task planning model and assigning corresponding tasks to be planned to at least one preset execution order includes:
[0009] Traversing the execution order, and tracing back the currently traversed execution order by a preset number of orders to obtain a target execution order;
[0010] Based on the time constraint matrix, a backtracking constraint matrix corresponding to the currently traversed execution order is obtained; the elements in the backtracking constraint matrix are related to the limited time interval corresponding to the currently traversed execution order; the limited time interval corresponding to the currently traversed execution order is the limited time interval between the task corresponding to any execution order between the currently traversed execution order and the target execution order and all tasks;
[0011] The backtracking constraint matrix, the tasks corresponding to the previous execution order of the currently traversed execution order, the dimensionality reduction matrix and the execution time matrix are input into the task planning model to allocate corresponding tasks to be planned for the currently traversed execution order.
[0012] Optionally, the task planning model includes a structure encoder, a sequence encoder, and a decoder; the step of inputting the backtracking constraint matrix, the task corresponding to the previous execution order of the currently traversed execution order, the dimensionality reduction matrix, and the execution time matrix into the task planning model, and allocating the corresponding to-be-planned task to the currently traversed execution order includes:
[0013] Inputting the backtracking constraint matrix, the dimension reduction matrix and the execution time matrix into the structure encoder to obtain a first vector;
[0014] Inputting the task corresponding to the previous execution order of the currently traversed execution order into the sequential encoder to obtain a second vector;
[0015] The first vector and the second vector are input into the decoder to obtain the tasks to be planned corresponding to the execution order of the current traversal.
[0016] Optionally, the step of reducing the dimension of the time constraint matrix based on a non-negative matrix factorization method to obtain a reduced dimension matrix includes:
[0017] The time constraint matrix is reduced in dimension based on a non-negative matrix factorization method to obtain a basis matrix and a coefficient matrix;
[0018] When the relationship between the base matrix, the coefficient matrix, and the time constraint matrix satisfies a preset accuracy condition, the coefficient matrix is used as the dimension reduction matrix.
[0019] Optionally, the step of inputting the backtracking constraint matrix, the dimensionality reduction matrix, and the execution time matrix into the structure encoder to obtain a first vector includes:
[0020] Encoding the backtracking constraint matrix, the dimensionality reduction matrix, and the execution time matrix respectively to obtain a first eigenvector, a second eigenvector, and a third eigenvector;
[0021] Concatenate the first eigenvector, the second eigenvector, and the third eigenvector to obtain a fused eigenvector;
[0022] The fused feature vector is mapped into a vector having the same dimension as the first feature vector to obtain the first vector.
[0023] Optionally, the tasks to be planned corresponding to the execution order of the current traversal are obtained by the decoder based on the attention mechanism.
[0024] Optionally, the method further includes:
[0025] Inputting the dimension reduction matrix and the execution time matrix into a preset neural network model to obtain the probability corresponding to the execution order; the probability is the probability of taking any of the tasks to be planned as the task to be planned corresponding to the execution order;
[0026] Calculating the first time used by the neural network model to assign corresponding tasks to be planned to all the execution orders using a roulette wheel algorithm based on the probability;
[0027] Calculating a second time used by the neural network model to allocate corresponding tasks to be planned to all the execution orders based on the maximum probability corresponding to the execution orders;
[0028] The model parameters of the neural network model are updated based on the first time and the second time to obtain the task planning model.
[0029] An embodiment of the present invention further discloses a task planning device, comprising:
[0030] a matrix acquisition module, configured to acquire a time constraint matrix and an execution time matrix of the tasks to be planned; wherein the elements in the time constraint matrix are related to the limited time intervals between any two tasks to be planned; and the elements in the execution time matrix are related to the limited execution times of the tasks to be planned;
[0031] A dimensionality reduction matrix obtaining module is used to reduce the dimension of the time constraint matrix based on a non-negative matrix decomposition method to obtain a dimensionality reduction matrix;
[0032] The matrix input module is used to input the dimension reduction matrix and the execution time matrix into a preset task planning model, and allocate corresponding tasks to be planned for at least one preset execution order.
[0033] Optionally, the matrix input module includes:
[0034] A traversal submodule is used to traverse the execution order and trace back the currently traversed execution order by a preset number of orders to obtain a target execution order;
[0035] A backtracking constraint matrix acquisition submodule is configured to acquire a backtracking constraint matrix corresponding to the currently traversed execution order based on the time constraint matrix; the elements in the backtracking constraint matrix are related to the limited time interval corresponding to the currently traversed execution order; the limited time interval corresponding to the currently traversed execution order is the limited time interval between the task corresponding to any execution order between the currently traversed execution order and the target execution order and all tasks;
[0036] The input submodule is used to input the backtracking constraint matrix, the task corresponding to the previous execution order of the currently traversed execution order, the dimensionality reduction matrix and the execution time matrix into the task planning model, and assign corresponding tasks to be planned for the currently traversed execution order.
[0037] Optionally, the task planning model includes a structural encoder, a sequential encoder, and a decoder; and the input submodule includes:
[0038] A first vector obtaining unit is configured to input the backtracking constraint matrix, the dimension reduction matrix, and the execution time matrix into the structure encoder to obtain a first vector;
[0039] A second vector obtaining unit, configured to input a task corresponding to a previous execution order of the currently traversed execution order into the sequential encoder to obtain a second vector;
[0040] The unit for obtaining tasks to be planned is used to input the first vector and the second vector into the decoder to obtain tasks to be planned corresponding to the execution order of the current traversal.
[0041] Optionally, the dimension reduction matrix obtaining module includes:
[0042] A dimensionality reduction submodule, configured to reduce the dimensionality of the time constraint matrix based on a non-negative matrix factorization method to obtain a basis matrix and a coefficient matrix;
[0043] The dimension reduction matrix is used as a submodule, and is used to use the coefficient matrix as the dimension reduction matrix when the relationship between the base matrix, the coefficient matrix and the time constraint matrix meets the preset accuracy condition.
[0044] Optionally, the first vector obtaining unit includes:
[0045] an encoding subunit, configured to encode the backtracking constraint matrix, the dimensionality reduction matrix, and the execution time matrix to obtain a first eigenvector, a second eigenvector, and a third eigenvector respectively;
[0046] a concatenation subunit, configured to concatenate the first feature vector, the second feature vector, and the third feature vector to obtain a fused feature vector;
[0047] A mapping subunit is configured to map the fused feature vector into a vector having the same dimension as the first feature vector to obtain the first vector.
[0048] Optionally, the tasks to be planned corresponding to the execution order of the current traversal are obtained by the decoder based on the attention mechanism.
[0049] Optionally, the device further comprises:
[0050] An input module, configured to input the dimension reduction matrix and the execution time matrix into a preset neural network model to obtain a probability corresponding to the execution order; the probability is a probability of taking any of the tasks to be planned as the task to be planned corresponding to the execution order;
[0051] A first time calculation module is used to calculate the first time used by the neural network model to allocate the corresponding tasks to be planned to all the execution orders based on the probability using a roulette algorithm;
[0052] A second time calculation module is used to calculate the second time used by the neural network model to allocate the corresponding tasks to be planned to all the execution orders based on the maximum probability corresponding to the execution order;
[0053] A model parameter updating module is used to update the model parameters of the neural network model based on the first time and the second time to obtain the task planning model.
[0054] An embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0055] The memory is used to store computer programs;
[0056] The processor is configured to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0057] The embodiments of the present invention further disclose one or more computer-readable media having instructions stored thereon. When executed by one or more processors, the processors are enabled to perform the method according to the embodiments of the present invention.
[0058] The embodiments of the present invention include the following advantages:
[0059] In an embodiment of the present invention, a time constraint matrix and an execution time matrix of tasks to be planned are obtained; elements in the time constraint matrix are related to the limited time intervals between any two tasks to be planned; elements in the execution time matrix are related to the limited execution times of the tasks to be planned; the time constraint matrix is reduced in dimension based on a non-negative matrix decomposition method to obtain a reduced dimension matrix; the reduced dimension matrix and the execution time matrix are input into a preset task planning model, and corresponding tasks to be planned are assigned to at least one preset execution order, providing a solution to task planning problems based on the task planning model, achieving the solution of task planning problems under multiple constraints, and improving the solution speed and solution accuracy of task time planning. At the same time, the time constraint matrix is reduced in dimension, noise mixed in the data set is removed, and the generalization performance of the task planning model in handling task planning problems of different scales is improved, making the task planning model more robust and improving the anti-interference ability of the task planning model when facing various random noises, abnormal situations and attacks. Moreover, solving the task planning problem based on the reduced dimension matrix of the time constraint matrix saves storage space and computer resources and improves the calculation speed of the task planning model. In addition, the task planning model assigns corresponding tasks to be planned one by one, that is, determines the execution order of tasks to be planned one by one, avoiding deciding the execution order of all tasks to be planned at one time. The optional action space dimension is extremely high, which brings great difficulties to the establishment and training process of the task planning model. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 is a flowchart of the steps of a task planning method provided in an embodiment of the present invention;
[0061] Figure 2 is a schematic diagram of a structural encoder provided by an embodiment of the present invention;
[0062] Figure 3 is a schematic diagram of a task planning model provided by an embodiment of the present invention;
[0063] Figure 4 This is a structural block diagram of a task planning device provided in an embodiment of the present invention;
[0064] Figure 5 is a block diagram of an electronic device provided in an embodiment of the present invention;
[0065] Figure 6 is a schematic diagram of a computer-readable medium provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0066] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0067] To facilitate understanding of the technical solutions and technical effects of the embodiments of the present invention, the prior art of the present invention is briefly described below.
[0068] Time planning, also known as task planning, involves planning the execution sequence of multiple tasks. It is a core area of operations research, integrating mathematics and computer science to provide decision support for task planners. As a typical discrete space optimization problem, time planning aims to find a configuration within the space of candidate solutions that satisfies the optimization objective. Proper time planning not only improves efficiency but also significantly reduces costs, making it particularly important for time-sensitive tasks.
[0069] When scheduling problems involve multiple tasks, there are often multiple possible solutions. These solutions differ in the order in which the tasks are performed, and some tasks may even be performed simultaneously. To determine the optimal solution, we need to calculate the total task execution time for each solution and select the solution with the shortest total task execution time as the target solution. As the number of tasks involved in the scheduling problem increases, the difficulty of finding the solution with the shortest total task execution time increases exponentially.
[0070] The difficulty of time planning problems is not only related to the number of tasks but also to the number of constraints within them. In both military and civilian fields, numerous time planning problems exist, often accompanied by multiple constraints. For example, time planning problems in areas such as air defense firepower deployment, combat resource allocation, material distribution, traffic control, quantitative investment strategy formulation, and production process management often involve multiple constraints and a large scale, placing high demands on solution accuracy and speed.
[0071] Current approaches to time planning problems still face the challenge of simultaneously meeting both speed and accuracy when faced with multiple constraints and large-scale time planning problems. Common methods for dealing with time planning problems primarily include mathematical programming and heuristic algorithms. The practical application of mathematical programming methods is limited to smaller-scale time planning problems, typically with no more than 50 tasks. When solving time planning problems, heuristic algorithms often employ explicit methods to sequentially construct solutions, and most of these heuristic algorithms rely on the expertise of domain experts to design them. While these algorithms cannot guarantee an optimal solution to the problem, they can typically provide a near-optimal feasible solution in a short period of time. However, for large-scale time planning problems, heuristic algorithms still require a significant amount of time to solve.
[0072] Reference Figure 1, shows a flowchart of a task planning method provided in an embodiment of the present invention, which may specifically include the following steps:
[0073] Step 101: Obtain a time constraint matrix and an execution time matrix of tasks to be planned; the elements in the time constraint matrix are related to the limited time intervals between any two tasks to be planned; and the elements in the execution time matrix are related to the limited execution times of the tasks to be planned;
[0074] In an embodiment of the present invention, when planning at least one task to be planned and determining the execution order of the tasks to be planned, it is necessary to first obtain a time constraint matrix and an execution time matrix for the tasks to be planned. The elements in the time constraint matrix are related to the time intervals between any two tasks to be planned, and the elements in the execution time matrix are related to the execution times of all tasks to be planned.
[0075] In this embodiment of the present invention, a defined time interval refers to the defined time interval between the start times of any two tasks to be planned, and a defined execution time refers to the defined time period within which the start time of a task to be planned must fall. It should be emphasized that the start time of a task to be planned is the time when the task to be planned begins execution, not the time when execution is ready. Specifically, if the task to be planned is an aircraft takeoff, the start time of the task to be planned is the time when the aircraft takes off, not the time when the aircraft begins accelerating on the runway.
[0076] In a specific example, the task planning involves three tasks: A, B, and C. If the limited execution time of task A is from 1:00 PM to 10:00 PM, which can be represented by the matrix [1, 10], the limited execution time of task B is from 1:00 PM to 8:00 PM, which can be represented by the matrix [0, 8], and the limited execution time of task C is from 5:00 PM to 12:00 AM, which can be represented by the matrix [5, 12], then the execution time matrix T of the task is w for:
[0077]
[0078] The time constraint matrix X of the task planning is:
[0079]
[0080] The elements in this time constraint matrix represent the time interval between the start time of the task represented by the row and the start time of the task represented by the column, and the start time of the task represented by the row is before the start time of the task represented by the column. If the first row and first column of the time constraint matrix represent task A, the second row and second column represent task B, and the third row and third column represent task C, then the element in the first row and first column represents that the time interval between tasks A and A is 0 hours, the element in the first row and second column represents that the time interval between tasks A and B is 1 hour, and so on. This shows the time interval between any two tasks among tasks A, B, and C.
[0081] Step 102: reducing the dimension of the time constraint matrix based on a non-negative matrix factorization method to obtain a reduced dimension matrix;
[0082] In an embodiment of the present invention, the non-negative matrix factorization method can represent a non-negative matrix as the product of two low-dimensional non-negative matrices, thereby achieving data dimensionality reduction and feature extraction. The time constraint matrix in the embodiment of the present invention is a non-negative matrix. Therefore, the non-negative matrix factorization method can be used to reduce the dimensionality of the time constraint matrix, and a base matrix and a coefficient matrix can be found for the time constraint matrix, so that the product of the base matrix and the coefficient matrix is approximately equal to the time constraint matrix. It should be noted that both the base matrix and the coefficient matrix are non-negative matrices.
[0083] The weighted sum of all column vectors in the basis matrix is the column vector in the time constraint matrix, and the weight coefficient is the element of the column vector corresponding to the coefficient matrix. By replacing the time constraint matrix with the coefficient matrix, the dimensionality of the time constraint matrix can be reduced to obtain the dimensionality reduction matrix of the data features of the time constraint matrix.
[0084] Step 103: Input the dimension reduction matrix and the execution time matrix into a preset task planning model, and assign corresponding tasks to be planned to at least one preset execution order.
[0085] In an embodiment of the present invention, by inputting the dimension reduction matrix and the execution time matrix of the time constraint matrix into the preset task planning model, the corresponding tasks to be planned can be assigned one by one according to the preset execution order, thereby obtaining the execution order of the tasks to be planned. It should be noted that the number of preset execution orders is the same as the number of tasks to be planned. Since the elements in the time constraint matrix are related to the limited time interval between any two tasks to be planned, and the elements in the execution time matrix are related to the limited execution time of all tasks to be planned, when the dimension reduction matrix and the execution time matrix of the time constraint matrix are input into the preset task planning model, it is equivalent to inputting all the models to be planned into the task planning model.
[0086] In a specific example, a task plan involves three tasks to be planned: Task A, Task B, and Task C. The predefined execution orders are 1, 2, and 3. The constraints for this task plan include a time constraint matrix and an execution time matrix. By reducing the time constraint matrix using non-negative matrix factorization to obtain a reduced matrix, and then inputting the reduced matrix and the execution time matrix into the predefined task planning model, Task A can be assigned to execution order 1, Task C to execution order 2, and Task B to execution order 3. The execution order for the tasks to be planned is now Task A, Task C, and then Task B.
[0087] In an embodiment of the present invention, a time constraint matrix and an execution time matrix of tasks to be planned are obtained; elements in the time constraint matrix are related to the limited time intervals between any two tasks to be planned; elements in the execution time matrix are related to the limited execution times of the tasks to be planned; the time constraint matrix is reduced in dimension based on a non-negative matrix decomposition method to obtain a reduced dimension matrix; the reduced dimension matrix and the execution time matrix are input into a preset task planning model, and corresponding tasks to be planned are assigned to at least one preset execution order, providing a solution to task planning problems based on the task planning model, achieving the solution of task planning problems under multiple constraints, and improving the solution speed and solution accuracy of task time planning. At the same time, the time constraint matrix is reduced in dimension, noise mixed in the data set is removed, and the generalization performance of the task planning model in handling task planning problems of different scales is improved, making the task planning model more robust and improving the anti-interference ability of the task planning model when facing various random noises, abnormal situations and attacks. Moreover, solving the task planning problem based on the reduced dimension matrix of the time constraint matrix saves storage space and computer resources and improves the calculation speed of the task planning model. In addition, the task planning model assigns corresponding tasks to be planned one by one, that is, determines the execution order of tasks to be planned one by one, avoiding deciding the execution order of all tasks to be planned at one time. The optional action space dimension is extremely high, which brings great difficulties to the establishment and training process of the task planning model.
[0088] Furthermore, in any of the above embodiments, step 103 includes:
[0089] Sub-step S11, traversing the execution order, and tracing back the currently traversed execution order by a preset number of orders to obtain a target execution order;
[0090] Sub-step S12: obtaining a backtracking constraint matrix corresponding to the currently traversed execution order based on the time constraint matrix; the elements in the backtracking constraint matrix are related to the limited time interval corresponding to the currently traversed execution order; the limited time interval corresponding to the currently traversed execution order is the limited time interval between the task corresponding to any execution order between the currently traversed execution order and the target execution order and all tasks;
[0091] Sub-step S13, inputting the backtracking constraint matrix, the task corresponding to the previous execution order of the currently traversed execution order, the dimensionality reduction matrix and the execution time matrix into the task planning model, and assigning corresponding tasks to be planned for the currently traversed execution order.
[0092] In the embodiment of the present invention, the execution order is traversed to allocate corresponding tasks to be planned to the currently traversed execution order one by one.
[0093] There may be correlations between different tasks to be planned, that is, the execution of different tasks to be planned may affect each other. In order to avoid the execution of tasks with a determined execution order affecting the execution of tasks to be planned with an undetermined execution order, when assigning corresponding tasks to be planned for the currently traversed execution order, the currently traversed execution order is traced back a preset number of times to obtain the target execution order, and based on the time constraint matrix, the backtracking constraint matrix corresponding to the currently traversed execution order is obtained. It should be noted that the stronger the correlation between tasks, the greater the number of backtrackings required.
[0094] Since the elements in the time constraint matrix are related to the limited time interval between any two tasks to be planned, and the elements in the backtracking constraint matrix corresponding to the currently traversed execution order are related to the limited time interval between the tasks corresponding to any execution order between the currently traversed execution order and the target execution order and all tasks, the backtracking constraint matrix corresponding to the currently traversed execution order can be obtained based on the time constraint matrix.
[0095] In a specific example, the tasks to be planned include Task A and Task B. The limited time interval between Task A and Task B can be expressed as T(A,B), that is, the minimum time interval between the start time of Task A and the start time of Task B is T(A,B). If the start time of Task A is T A , the start time of task B is T B , when task A is executed first and task B is executed later, T B -T A≥T(A,B). If the bounded time interval between tasks B and A is expressed as T(B,A), and T(A,B)≠T(B,A), then this means that the bounded time interval between tasks A and B is related to the execution order of tasks A and B, and there is a relationship between tasks A and B. This is equivalent to adding a constraint to the solution of the task scheduling problem, that is, the solution to the task scheduling problem must ensure that the execution of related tasks cannot affect each other.
[0096] In an embodiment of the present invention, when assigning corresponding tasks to be planned for the currently traversed execution order, the backtracking constraint matrix corresponding to the currently traversed execution order, the task corresponding to the previous execution order of the currently traversed execution order, the dimensionality reduction matrix of the time constraint matrix, and the execution time matrix are input into the task planning model, so as to achieve the assignment of corresponding tasks to be planned for the currently traversed execution order.
[0097] In an embodiment of the present invention, when assigning corresponding tasks to be planned to a certain execution order, the backtracking constraint matrix corresponding to the execution order is input into the task planning model, ensuring that the execution of tasks to be planned with related relationships will not affect each other, and ensuring the smooth progress of the planned tasks.
[0098] Furthermore, in any of the above embodiments, the task planning model includes a structural encoder, a sequential encoder, and a decoder; sub-step S13 includes:
[0099] Sub-step S21, inputting the backtracking constraint matrix, the dimensionality reduction matrix and the execution time matrix into the structure encoder to obtain a first vector;
[0100] Sub-step S22, inputting the task corresponding to the previous execution order of the currently traversed execution order into the sequential encoder to obtain a second vector;
[0101] Sub-step S23: input the first vector and the second vector into the decoder to obtain the tasks to be planned corresponding to the execution order of the current traversal.
[0102] In an embodiment of the present invention, the task planning model may include a structural encoder, a sequential encoder, and a decoder.
[0103] The execution order is traversed to assign corresponding tasks to be scheduled for the currently traversed execution order one by one. When assigning corresponding tasks to be scheduled for the currently traversed execution order, the backtracking constraint matrix, the reduced dimension matrix of the time constraint matrix, and the execution time matrix corresponding to the currently traversed execution order are input into a structure encoder to obtain a first vector, and the tasks corresponding to the execution order before the currently traversed execution order are input into a sequence encoder to obtain a second vector. The first and second vectors are then input into a decoder to obtain the tasks to be scheduled for the currently traversed execution order.
[0104] In an embodiment of the present invention, the sequential encoder uses a long short-term memory (LSTM) network for sequential encoding. The LSTM network can introduce a "gating" mechanism to model sequential data by selectively remembering and forgetting past information. Specifically, the sequential encoding process can be expressed as:
[0105]
[0106] Where W is the trainable parameter matrix in the preset neural network model, which is implemented using a linear neural network layer, b is the linear neural network layer bias, σ and tanh represent the activation functions used by the corresponding neural network layer, and t is the execution order of the current traversal. t-1 The task number of the previous execution order of the currently traversed execution order. Each time the sequential encoder assigns the corresponding task to be planned to the currently traversed execution order, it inputs the number x of the task corresponding to the previous execution order. t-1 , output o t The second vector is used as the input of the decoder part and outputs C t and h t Passed to the LSTM part that assigns the tasks to be planned for the execution order of the next traversal.
[0107] Furthermore, in any of the above embodiments, step 102 includes:
[0108] Sub-step S31, reducing the dimension of the time constraint matrix based on non-negative matrix factorization to obtain a basis matrix and a coefficient matrix;
[0109] Sub-step S32, when the relationship among the base matrix, the coefficient matrix and the time constraint matrix meets a preset accuracy condition, using the coefficient matrix as the dimensionality reduction matrix.
[0110] In an embodiment of the present invention, the time constraint matrix can be decomposed into two fixed-width base matrices and a coefficient matrix based on the non-negative matrix factorization method. When the product of the base matrix and the coefficient matrix is approximately equal to the time constraint matrix, the coefficient matrix is used as a dimensionality reduction matrix of the time constraint matrix. It should be noted that the task planning model obtained by training the neural network model using a fixed-width dimensionality reduction matrix can handle problems of different scales; at the same time, using the dimensionality reduction matrix for model training and problem solving can improve the model training speed and problem solving speed.
[0111] In the embodiment of the present invention, if the time constraint matrix X∈R n×n , that is, the time constraint matrix is a matrix with n rows and n columns. If the non-negative matrix decomposition method is used to reduce the dimension of the time constraint matrix, the basis matrix W∈Rn×k , coefficient matrix H e R k×n , the base matrix and the coefficient matrix with a fixed width of k columns can be obtained by transposing the matrix H.
[0112] Specifically, the time constraint matrix can be iteratively solved according to the non-negative matrix factorization formula, and when the relationship among the base matrix, the coefficient matrix and the time constraint matrix satisfies the preset accuracy condition, the coefficient matrix is taken as the dimension reduction matrix of the time constraint matrix.
[0113] The preset accuracy condition is:
[0114] ||X-W k H k || 2 <∈
[0115] The non-negative matrix factorization formula is:
[0116]
[0117]
[0118] Wherein, X is the time constraint matrix, W is the base matrix, H is the coefficient matrix, and ∈ is the preset threshold. The non-negative matrix factorization method generally uses an iterative solution. H k , W k respectively represent the base matrix W and the coefficient matrix H obtained by iterating to the kth round, represents the element of the i-th row and the a-th column in the base matrix W obtained by iterating to the kth round, represents the element of the b-th row and the j-th column in the coefficient matrix H obtained by iterating to the kth round. Therefore, the preset accuracy condition among the base matrix, the coefficient matrix and the time constraint matrix is that the square of the modulus value of the difference between the time constraint matrix and the product of the base matrix W and the coefficient matrix H obtained by iterating to the kth round is less than the preset threshold. If the relationship among the base matrix, the coefficient matrix and the time constraint matrix satisfies the preset accuracy condition, it means that the product of the base matrix and the coefficient matrix is approximately equal to the time constraint matrix.
[0119] Further, in any of the above embodiments, the sub-step S21 comprises:
[0120] Sub-step S41, encoding the backtracking constraint matrix, the dimension reduction matrix and the execution time matrix respectively to obtain a first feature vector, a second feature vector and a third feature vector;
[0121] Sub-step S42, splicing the first feature vector, the second feature vector and the third feature vector to obtain a fusion feature vector;
[0122] In substep S43, the fusion feature vector is mapped into a vector with the same dimension as the first feature vector, obtaining the first vector.
[0123] In the embodiment of the present application, the task planning model can include a structure encoder. The execution sequences are traversed to implement the allocation of the corresponding task to be planned for each currently traversed execution sequence. When determining the task to be planned corresponding to the currently traversed execution sequence, the backtracking constraint matrix corresponding to the currently traversed execution sequence, the dimension-reduced matrix of the time constraint matrix, and the execution time matrix can be input into the structure encoder to obtain a first vector.
[0124] Referring to Figure 2 , a schematic diagram of a structure encoder provided by an embodiment of the present application is shown.
[0125] Figure 2 In the formula, i is the currently traversed execution sequence, H is a coefficient matrix obtained by dimension-reducing the time constraint matrix, T w is an execution time matrix with n rows and 2 columns. By transposing the coefficient matrix H, a transposed matrix H* with n rows and h columns can be obtained. i b is a backtracking constraint matrix with n rows and b columns corresponding to the currently traversed execution sequence i. Specifically, the target execution sequence is obtained by backtracking b number of sequences from the currently traversed execution sequence i, and the backtracking constraint matrix corresponding to the currently traversed execution sequence i is obtained based on the time constraint matrix. The elements in the backtracking constraint matrix are related to the limited time interval between the tasks corresponding to any execution sequence between the currently traversed execution sequence and the target execution sequence and all tasks.
[0126] S i b is encoded to obtain a first feature vector v1 corresponding to the backtracking constraint matrix, v1 is a matrix with n rows and h columns; H* is encoded to obtain a second feature vector v2 corresponding to the transposed matrix of the coefficient matrix, v2 is a matrix with n rows and h columns; and T w is encoded to obtain a third feature vector v3 corresponding to the execution time matrix, v3 is a matrix with n rows and h columns. It should be noted that the first feature vector v1∈R h , the second feature vector v2∈R h , and the third feature vector v3∈R h , and R represents a real number set, that is, the dimensions of the first feature vector, the second feature vector, and the third feature vector are the same, and they are all h-dimensional vector spaces on real numbers.
[0127] The first feature vector, the second feature vector, and the third feature vector are spliced in the same dimension to obtain a fusion feature vector v, and the fusion feature vector v=[v1,v2,v3]∈R 3h, that is, the fused feature vector v is a 3h-dimensional vector space on real numbers. Map the fused feature vector to obtain a first vector r with the same dimensions as the first, second, and third feature vectors, that is, r is an h-dimensional vector space on real numbers, r∈R h . It should be noted that the first vector r is a matrix with n rows and h columns. The encoding and mapping processes in the embodiments of the present invention are both implemented using a linear neural network layer with a Leaky ReLU activation function. The Leaky ReLU function is a new neural network unit activation function that can improve the performance of deep neural networks, improve the problems of gradient disappearance and jitter, and better fit the model.
[0128] Furthermore, in any of the above embodiments, the tasks to be planned corresponding to the execution order of the current traversal are obtained by the decoder based on the attention mechanism.
[0129] In an embodiment of the present invention, inputting the first vector of the structure encoder and the second vector of the sequence encoder into the decoder can assign the corresponding task to be planned for the execution order of the current traversal. In an embodiment of the present invention, a pointer network can be used as the decoder part of the task planning model. The pointer network generates a new attention vector for each decision of the decoder to adjust the attention based on the input content. The pointer network generates a probability distribution for the input elements for each decision of the decoder. In an embodiment of the present invention, the pointer network can generate the probability of using any task to be planned as the task to be planned corresponding to the execution order of the current traversal.
[0130] The decoder uses the attention mechanism to determine the tasks to be planned for the execution order of the current traversal. The attention mechanism selects a small amount of useful information from a large amount of input information for focused processing while ignoring other information. This allows the task planning model to focus on specific parts of the input sequence during decoding, rather than relying solely on the decoder input. The attention mechanism calculates the attention distribution over all decoder input sequences, then calculates the weighted weights of the input sequences based on the attention distribution. This weighted weight is then used to calculate the tasks to be planned for the execution order of the current traversal.
[0131] In this embodiment of the present invention, the weight u calculated by directly using the decoder's input sequence is used as a pointer to the output sequence:
[0132]
[0133] p i =softmax(u i )
[0134] The first vector r and the second vector q input to the decoder are the vectors output by the structure encoder and the sequential encoder respectively. The jth component of the weight vector representing the i-th execution order, where j refers to the task to be planned assigned to the i-th execution order, v, W r and W q It is the parameter matrix that can be trained in the preset neural network model, and tanh is the corresponding neural network activation function. i Perform softmax normalization to obtain the probability P of taking any task to be planned as the task to be planned corresponding to the execution order i of the current traversal i . Among them, softmax is a mathematical function used to convert a set of arbitrary real numbers into real numbers representing probability distribution.
[0135] F is a set of tasks with a determined execution order. For tasks with a determined execution order, their weights are is set to -∞ so that the probability obtained by softmax normalization is 0.
[0136] In an embodiment of the present invention, the neural attention mechanism in the pointer network provides a solution for processing output dictionaries of variable sizes, thereby effectively coping with various combinatorial optimization problems.
[0137] Furthermore, in any of the above embodiments, the method further includes:
[0138] Sub-step S51: inputting the dimension reduction matrix and the execution time matrix into a preset neural network model to obtain the probability corresponding to the execution order; the probability is the probability of taking any of the tasks to be planned as the task to be planned corresponding to the execution order;
[0139] Sub-step S52, calculating the first time used by the neural network model to allocate corresponding tasks to be planned to all the execution orders using a roulette algorithm based on the probability;
[0140] Sub-step S53, calculating a second time used by the neural network model to allocate corresponding tasks to be planned to all the execution orders based on the maximum probability corresponding to the execution order;
[0141] Sub-step S54: updating the model parameters of the neural network model based on the first time and the second time to obtain the task planning model.
[0142] In the embodiment of the present application, the task planning model is obtained by training a preset neural network model. The training process of the task planning model can be as follows: the reduced dimension matrix of the time constraint matrix and the execution time matrix are input into the preset neural network model, and the neural network model can output the probability of regarding any to-be-planned task as the to-be-planned task corresponding to a certain execution order. Since the elements in the time constraint matrix are related to the limited time interval between any two to-be-planned tasks, and the elements in the execution time matrix are related to the limited execution time of all to-be-planned tasks, when the reduced dimension matrix of the time constraint matrix and the execution time matrix are input into the preset neural network model, all to-be-planned tasks are equivalent to being input into the neural network model.
[0143] The neural network model calculates the first time required by each to-be-planned task corresponding to each execution order based on the probability of regarding any to-be-planned task as the to-be-planned task corresponding to a certain execution order, and assigns the first time to each to-be-planned task corresponding to each execution order by using a roulette algorithm. In the roulette algorithm, the probability of selection of each to-be-planned task is proportional to the value of its fitness function, and the value of the fitness function of the to-be-planned task is the probability of regarding any to-be-planned task as the to-be-planned task corresponding to a certain execution order.
[0144] The neural network model assigns the second time required by each to-be-planned task corresponding to each execution order based on the maximum probability corresponding to each execution order, and updates the model parameters of the neural network model based on the first time and the second time to optimize the neural network model, thereby obtaining the task planning model.
[0145] In the embodiment of the present application, the optimization target of the neural network model is to execute all to-be-planned tasks in the shortest possible time under the condition of meeting the given constraint condition; that is, the first task is executed from 0 time, and the time c n of executing the last task is as early as possible, which can be expressed as:
[0146] min{c n}
[0147] s.t.c k+1 -c k ≥T(H k ,H k+1 )
[0148] T s ≤c k ≤T e
[0149] wherein, C k+1 represents the start time of the to-be-planned task H k+1 , C k represents the start time of the to-be-planned task H k , T(H k ,Hk+1 ) represents the task to be planned H k and the task to be planned H k+1 The time interval between the scheduled tasks H k Start time C k Need to be in T s -T e within the timeframe.
[0150] In a specific example, a deep reinforcement learning algorithm with self-supervised policy gradient (REINFORCE with Self-critical) is used to train the constructed neural network model M(θ).
[0151] Deep reinforcement learning (DRL) is a method that uses deep neural networks to learn through continuous interaction between an agent and its environment and a process of trial and error, aiming to learn methods that maximize the cumulative expected reward of a task. The training method of DRL effectively alleviates the high reliance on data during the training of deep neural network models. Most DRL methods provide an end-to-end solution, where the trained model allows the agent to make decisions directly based on its current state and interaction with the environment. Therefore, unlike traditional heuristic algorithms, DRL methods can automatically search for a heuristic algorithm by training the agent, significantly improving the efficiency of solving time-based planning problems without sacrificing accuracy.
[0152] During the training process, the neural network model can output the probability p of taking any task to be planned as the task to be planned corresponding to the execution order. i And the corresponding task to be planned X will be assigned to the execution order of the current traversal using the roulette algorithm based on probability i , and record the logarithmic probability of the sampling point After completing all execution order decisions, we get the strategy function π θ (a i |s i ), calculate the cumulative time of the neural network model using the roulette algorithm As a reward, we use the same neural network model with the same parameters and the same input conditions again, and output the probability The maximum value of the sample is the corresponding task to be planned for the execution order of the current traversal After completing all execution order decisions, we get the strategy function And calculate the output probability of the neural network model The cumulative time of the maximum value sampling method
[0153] For the network parameter θ of the neural network model, the optimization direction is to make the probability p of the neural network model selecting the policy function π with higher reward greater. The policy function π is defined as the objective function J(θ). At this time, the policy gradient of J(θ) can be expressed as:
[0154]
[0155] This policy gradient is used as the loss function of the neural network model for backpropagation to update the network parameters θ of the neural network model. Iterative training is performed to obtain the optimal policy, which is the task planning model. Specifically, the algorithm for the training process of the neural network model is as follows:
[0156]
[0157]
[0158] Wherein, j represents the task to be planned, and the relationship between the matrix dimensionality reduction time base matrix, the coefficient matrix and the time constraint matrix satisfies the preset threshold value in the preset accuracy condition of ∈=10 -2 , the number of backtracking orders of the current traversal execution order during structure encoding is b=5, the hidden layer dimension h=128, and the number of tasks to be planned in training is n=50.
[0159] The model is trained using the Adam (adaptive moment estimation) optimizer for gradient descent with an initial learning rate of 10 -3 The learning rate decay rate is 0.96. The training process consists of 100 epochs, each of which updates the training data and performs matrix dimensionality reduction. The batch size of the training data is 384. Each epoch has 100 steps, and validation is performed every 20 steps to evaluate the current model performance and save the optimal model parameters. "epoch" means that all samples in the training batch in the training dataset are trained 100 times, and "batch_size" indicates the number of samples in each training batch.
[0160] In this embodiment of the present invention, during the training and testing of the neural network model, the hidden layer dimension h was set to 128. Under the same conditions, the deep reinforcement learning method (DRL) proposed in this embodiment of the present invention was compared with a greedy strategy (Greedy) method commonly used to solve time planning problems and a genetic algorithm (GA) solution method. The results are shown in the following table:
[0161]
[0162]
[0163] Here, n represents the number of tasks to be planned. As can be seen from the table, deep reinforcement learning significantly improves the solution speed with limited accuracy loss, enabling fast time planning.
[0164] In an example use case of a mission planning model provided by the present invention, when using helicopters to rescue injured people in natural disasters such as earthquakes, multiple helicopters at the same takeoff point must take off within a specified execution time, and the takeoff time of any two helicopters must be no less than a specified time interval to reduce the risk of helicopter collisions during flight. Furthermore, the helicopters must complete the flight mission in the shortest possible time, minimizing the takeoff time of the last helicopter to improve the helicopter rescue efficiency.
[0165] The helicopter takeoff planning task involves three rescue helicopters that take off from the same takeoff point. The three helicopters are helicopter A, helicopter B, and helicopter C. If S is used to represent the set of tasks to be planned, S i Indicates the task to be planned, C i Indicates the task to be planned S i The start time of the helicopter takeoff plan is , where i = 1, 2, or 3. Then, S1 represents the takeoff mission of helicopter A, S2 represents the takeoff mission of helicopter B, and S3 represents the takeoff mission of helicopter C. C1 represents the takeoff time of helicopter A, C2 represents the takeoff time of helicopter B, and C3 represents the takeoff time of helicopter C. Furthermore, the constraints of this helicopter takeoff planning task include that the three helicopters must take off at the corresponding limited execution times, and the takeoff time of any two helicopters must not be less than the limited time interval.
[0166] If helicopter A's takeoff time is required to be between 1:00 PM and 10:00 PM, helicopter B's takeoff time is required to be between 12:00 PM and 8:00 PM, and helicopter C's takeoff time is required to be between 5:00 PM and 12:00 AM, then the limited execution time for the takeoff missions of the three helicopters is:
[0167] <![CDATA[待规划任务S i ]]> A B C Limited execution time [1,10] [0,8] [5,12]
[0168] Based on the limited execution time of the takeoff mission of the three helicopters, the execution time matrix T of the mission planning can be obtained: w :
[0169] The time constraint matrix X obtained based on the limited time interval between the takeoff missions of any two helicopters among the three helicopters is:
[0170]
[0171] The elements in the time constraint matrix represent the limited time interval between the start time of the task represented by the row and the start time of the task represented by the column, and the start time of the task represented by the row is before the start time of the task represented by the column.
[0172] The time constraint matrix X is iteratively decomposed using the non-negative matrix factorization method, and a preset threshold ∈=0.01 is set to obtain the basis matrix W and the coefficient matrix H. In this example, the width of the matrix after dimensionality reduction and the hidden layer dimension h of the neural network are both set to 2. Where H is:
[0173]
[0174] Input the coefficient matrix and execution time matrix into the task planning model to obtain the execution order of the three tasks to be planned: A, B, C, that is, the take-off task of helicopter A is assigned to execution order 1, the take-off task of helicopter B is assigned to execution order 2, and the take-off task of helicopter C is assigned to execution order 3.
[0175] Based on the time constraint matrix and execution time matrix, the execution time of each task is obtained as follows:
[0176] C=[1,2,7]
[0177] That is, the take-off time of helicopter A is 1 pm, the take-off time of helicopter B is 2 pm, and the take-off time of helicopter C is 7 pm.
[0178] It should be noted that for the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0179] Reference Figure 3 , which shows a schematic diagram of a task planning model provided by an embodiment of the present invention.
[0180] Figure 3 The task planning model in includes Encoder and Decoder, where the encoder includes a structural encoder and a sequential encoder. Figure 3 Where X(n,n) represents the time constraint matrix of the task to be planned with n rows and n columns, W(n,h) represents the basis matrix with n rows and h columns, H(h,n) represents the coefficient matrix with h rows and n columns, and T w Represents the execution time matrix of the task to be planned, i represents the execution order of the current traversal, S iIndicates the tasks to be planned corresponding to the execution order of the current traversal, S i-1 Indicates the tasks corresponding to the previous execution order of the currently traversed execution order, r is the first vector, and q is the second vector.
[0181] Using Nonnegative Matrix Factorization (NMF), the time constraint matrix of the task to be scheduled is decomposed into a basis matrix and a coefficient matrix. The product of the basis matrix and the coefficient matrix is approximately equal to the time constraint matrix. The coefficient matrix is the reduced-dimensional matrix of the time constraint matrix.
[0182] The currently traversed execution order is traced back a preset number of times to obtain the target execution order, and based on the time constraint matrix, the backtracking constraint matrix corresponding to the currently traversed execution order is obtained. The elements in the backtracking constraint matrix are related to the limited time intervals between the tasks corresponding to any execution order between the currently traversed execution order and the target execution order and all tasks.
[0183] The backtracking constraint matrix corresponding to the current traversal execution order, the dimension reduction matrix of the time constraint matrix, and the execution time matrix are input into the structure encoder to obtain a first vector r.
[0184] The tasks corresponding to the previous execution order of the current traversal and h i-1 , c i-1 Input the sequential encoder to get the second vector q, h i and c i Inputting the first vector r and the second vector q into the decoder can obtain the probability P corresponding to the execution order of the current traversal i , based on P i The tasks to be planned S corresponding to the current traversal order can be obtained i .
[0185] Reference Figure 4 , shows a structural block diagram of a task planning device provided in an embodiment of the present invention, which may specifically include the following modules:
[0186] Matrix acquisition module 401, used to obtain a time constraint matrix and an execution time matrix of the tasks to be planned; the elements in the time constraint matrix are related to the limited time intervals between any two tasks to be planned; the elements in the execution time matrix are related to the limited execution times of the tasks to be planned;
[0187] A dimension reduction matrix obtaining module 402 is configured to reduce the dimension of the time constraint matrix based on a non-negative matrix factorization method to obtain a dimension reduction matrix;
[0188] The matrix input module 403 is configured to input the dimension reduction matrix and the execution time matrix into a preset task planning model, and assign a corresponding to-be-planned task to at least one preset execution sequence.
[0189] In an optional embodiment of the present application, the matrix input module comprises:
[0190] The traversal submodule is configured to traverse the execution sequences, backtrack a preset number of sequences from a currently traversed execution sequence to obtain a target execution sequence.
[0191] The backtracking constraint matrix acquisition submodule is configured to acquire a backtracking constraint matrix corresponding to the currently traversed execution sequence based on the time constraint matrix; an element in the backtracking constraint matrix is related to a limited time interval corresponding to the currently traversed execution sequence; the limited time interval corresponding to the currently traversed execution sequence is a limited time interval between a task corresponding to any execution sequence between the currently traversed execution sequence and the target execution sequence and all tasks.
[0192] The input submodule is configured to input the backtracking constraint matrix, a task corresponding to a previous execution sequence of the currently traversed execution sequence, the dimension reduction matrix and the execution time matrix into the task planning model, and assign a corresponding to-be-planned task to the currently traversed execution sequence.
[0193] In an optional embodiment of the present application, the task planning model comprises a structure encoder, a sequence encoder and a decoder; and the input submodule comprises:
[0194] The first vector obtaining unit is configured to input the backtracking constraint matrix, the dimension reduction matrix and the execution time matrix into the structure encoder to obtain a first vector.
[0195] The second vector obtaining unit is configured to input a task corresponding to a previous execution sequence of the currently traversed execution sequence into the sequence encoder to obtain a second vector.
[0196] The to-be-planned task obtaining unit is configured to input the first vector and the second vector into the decoder to obtain a to-be-planned task corresponding to the currently traversed execution sequence.
[0197] In an optional embodiment of the present application, the dimension reduction matrix obtaining module comprises:
[0198] The dimension reduction submodule is configured to reduce the dimension of the time constraint matrix based on a non-negative matrix factorization method to obtain a basis matrix and a coefficient matrix.
[0199] The dimension reduction matrix is used as a submodule to take the coefficient matrix as the dimension reduction matrix when a relationship among the base matrix, the coefficient matrix and the time constraint matrix satisfies a preset accuracy condition.
[0200] In an optional embodiment of the present application, the first vector obtaining unit comprises:
[0201] The encoding subunit is configured to encode the backtracking constraint matrix, the dimension reduction matrix and the execution time matrix to obtain a first feature vector, a second feature vector and a third feature vector respectively.
[0202] The splicing subunit is configured to splice the first feature vector, the second feature vector and the third feature vector to obtain a fusion feature vector.
[0203] The mapping subunit is configured to map the fusion feature vector into a vector with the same dimension as the first feature vector to obtain the first vector.
[0204] In an optional embodiment of the present application, the to-be-planned task corresponding to the current execution order of iteration is obtained based on an attention mechanism by the decoder.
[0205] In an optional embodiment of the present application, the device further comprises:
[0206] The input module is configured to input the dimension reduction matrix and the execution time matrix into a preset neural network model to obtain a probability corresponding to the execution order; the probability is a probability of taking any to-be-planned task as the to-be-planned task corresponding to the execution order.
[0207] The first time calculation module is configured to calculate a first time used by the neural network model for assigning the to-be-planned task corresponding to all the execution orders based on the probability by using a roulette algorithm.
[0208] The second time calculation module is configured to calculate a second time used by the neural network model for assigning the to-be-planned task corresponding to all the execution orders based on a maximum probability corresponding to the execution order.
[0209] The model parameter updating module is configured to update model parameters of the neural network model based on the first time and the second time to obtain the task planning model.
[0210] For the device embodiment, the description is relatively simple because it is basically similar to the method embodiment, and the related parts can be referred to the part of the description of the method embodiment.
[0211] In addition, the embodiments of the present application also provide an electronic device, such as a computer, a server, a mobile phone, a tablet computer, a personal digital assistant (PDA) and the like. Figure 5As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.
[0212] Memory 503, used for storing computer programs;
[0213] The processor 501 is configured to execute the program stored in the memory 503 by performing the following steps:
[0214] Obtaining a time constraint matrix and an execution time matrix for the tasks to be planned; the elements in the time constraint matrix are related to the limited time intervals between any two tasks to be planned; and the elements in the execution time matrix are related to the limited execution times of the tasks to be planned;
[0215] Reducing the dimension of the time constraint matrix based on a non-negative matrix factorization method to obtain a reduced dimension matrix;
[0216] The dimension reduction matrix and the execution time matrix are input into a preset task planning model, and corresponding tasks to be planned are allocated to at least one preset execution order.
[0217] In an optional embodiment of the present invention, the step of inputting the dimension reduction matrix and the execution time matrix into a preset task planning model and assigning corresponding tasks to be planned to at least one preset execution order includes:
[0218] Traversing the execution order, and tracing back the currently traversed execution order by a preset number of orders to obtain a target execution order;
[0219] Based on the time constraint matrix, a backtracking constraint matrix corresponding to the currently traversed execution order is obtained; the elements in the backtracking constraint matrix are related to the limited time interval corresponding to the currently traversed execution order; the limited time interval corresponding to the currently traversed execution order is the limited time interval between the task corresponding to any execution order between the currently traversed execution order and the target execution order and all tasks;
[0220] The backtracking constraint matrix, the tasks corresponding to the previous execution order of the currently traversed execution order, the dimensionality reduction matrix and the execution time matrix are input into the task planning model to allocate corresponding tasks to be planned for the currently traversed execution order.
[0221] In an optional embodiment of the present invention, the task planning model includes a structure encoder, a sequence encoder, and a decoder; the step of inputting the backtracking constraint matrix, the task corresponding to the previous execution order of the currently traversed execution order, the dimensionality reduction matrix, and the execution time matrix into the task planning model, and assigning the corresponding to-be-planned task to the currently traversed execution order includes:
[0222] Inputting the backtracking constraint matrix, the dimension reduction matrix and the execution time matrix into the structure encoder to obtain a first vector;
[0223] Inputting the task corresponding to the previous execution order of the currently traversed execution order into the sequential encoder to obtain a second vector;
[0224] The first vector and the second vector are input into the decoder to obtain the tasks to be planned corresponding to the execution order of the current traversal.
[0225] In an optional embodiment of the present invention, the step of reducing the dimension of the time constraint matrix based on the non-negative matrix factorization method to obtain the reduced dimension matrix includes:
[0226] The time constraint matrix is reduced in dimension based on a non-negative matrix factorization method to obtain a basis matrix and a coefficient matrix;
[0227] When the relationship between the base matrix, the coefficient matrix, and the time constraint matrix satisfies a preset accuracy condition, the coefficient matrix is used as the dimension reduction matrix.
[0228] In an optional embodiment of the present invention, the step of inputting the backtracking constraint matrix, the dimensionality reduction matrix, and the execution time matrix into the structure encoder to obtain the first vector includes:
[0229] Encoding the backtracking constraint matrix, the dimensionality reduction matrix, and the execution time matrix respectively to obtain a first eigenvector, a second eigenvector, and a third eigenvector;
[0230] Concatenate the first eigenvector, the second eigenvector, and the third eigenvector to obtain a fused eigenvector;
[0231] The fused feature vector is mapped into a vector having the same dimension as the first feature vector to obtain the first vector.
[0232] In an optional embodiment of the present invention, the tasks to be planned corresponding to the execution order of the current traversal are obtained by the decoder based on the attention mechanism.
[0233] In an optional embodiment of the present invention, the method further includes:
[0234] Inputting the dimension reduction matrix and the execution time matrix into a preset neural network model to obtain the probability corresponding to the execution order; the probability is the probability of taking any of the tasks to be planned as the task to be planned corresponding to the execution order;
[0235] Calculating the first time used by the neural network model to assign corresponding tasks to be planned to all the execution orders using a roulette wheel algorithm based on the probability;
[0236] Calculating a second time used by the neural network model to allocate corresponding tasks to be planned to all the execution orders based on the maximum probability corresponding to the execution orders;
[0237] The model parameters of the neural network model are updated based on the first time and the second time to obtain the task planning model.
[0238] The communication bus mentioned in the terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.
[0239] The communication interface is used for communication between the above terminal and other devices.
[0240] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.
[0241] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0242] As Figure 6 shown in another embodiment provided by the present application, a computer readable storage medium 601 is also provided, and the computer readable storage medium stores instructions which, when executed on a computer, cause the computer to perform the task planning method described in the above embodiments.
[0243] In another embodiment provided by the present application, a computer program product containing instructions is also provided, and the instructions, when executed on a computer, cause the computer to perform the task planning method described in the above embodiments.
[0244] In the above embodiments, the implementation can be achieved by software, hardware, firmware or any combination thereof, entirely or partially. When implemented by software, the implementation can be in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the entire or partial process or function according to the embodiments of the present application is generated. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions can be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media sets. The available medium can be a magnetic medium (for example, floppy disk, hard disk, magnetic tape), an optical medium (for example, DVD), or a semiconductor medium (for example, solid state disk (SSD)) and the like.
[0245] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0246] Each embodiment in this specification is described in a related manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so the description is relatively simple. For related parts, refer to the description of the method embodiment.
[0247] The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.
Claims
1. A task planning method, characterized in that: The method comprises: Obtaining a time constraint matrix and an execution time matrix for the tasks to be planned; the elements in the time constraint matrix are related to the limited time intervals between any two tasks to be planned; and the elements in the execution time matrix are related to the limited execution times of the tasks to be planned; Reducing the dimension of the time constraint matrix based on a non-negative matrix factorization method to obtain a reduced dimension matrix; Inputting the dimension reduction matrix and the execution time matrix into a preset task planning model, and assigning corresponding tasks to be planned to at least one preset execution order; The step of inputting the dimension reduction matrix and the execution time matrix into a preset task planning model and assigning corresponding tasks to be planned to at least one preset execution order includes: Traversing the execution order, and tracing back the currently traversed execution order by a preset number of orders to obtain a target execution order; Based on the time constraint matrix, a backtracking constraint matrix corresponding to the currently traversed execution order is obtained; the elements in the backtracking constraint matrix are related to the limited time interval corresponding to the currently traversed execution order; the limited time interval corresponding to the currently traversed execution order is the limited time interval between the task corresponding to any execution order between the currently traversed execution order and the target execution order and all tasks; The backtracking constraint matrix, the tasks corresponding to the previous execution order of the currently traversed execution order, the dimensionality reduction matrix and the execution time matrix are input into the task planning model to allocate corresponding tasks to be planned for the currently traversed execution order.
2. The method according to claim 1, characterized in that The task planning model includes a structure encoder, a sequence encoder, and a decoder; the step of inputting the backtracking constraint matrix, the task corresponding to the previous execution order of the currently traversed execution order, the dimensionality reduction matrix, and the execution time matrix into the task planning model, and allocating the corresponding to-be-planned task to the currently traversed execution order includes: Inputting the backtracking constraint matrix, the dimension reduction matrix and the execution time matrix into the structure encoder to obtain a first vector; Inputting the task corresponding to the previous execution order of the currently traversed execution order into the sequential encoder to obtain a second vector; The first vector and the second vector are input into the decoder to obtain the tasks to be planned corresponding to the execution order of the current traversal.
3. The method according to claim 1, characterized in that The step of reducing the dimension of the time constraint matrix based on the non-negative matrix decomposition method to obtain the reduced dimension matrix includes: The time constraint matrix is reduced in dimension based on a non-negative matrix factorization method to obtain a basis matrix and a coefficient matrix; When the relationship between the base matrix, the coefficient matrix, and the time constraint matrix satisfies a preset accuracy condition, the coefficient matrix is used as the dimension reduction matrix.
4. The method according to claim 2, characterized in that The step of inputting the backtracking constraint matrix, the dimensionality reduction matrix, and the execution time matrix into the structure encoder to obtain a first vector comprises: Encoding the backtracking constraint matrix, the dimensionality reduction matrix, and the execution time matrix respectively to obtain a first eigenvector, a second eigenvector, and a third eigenvector; Concatenate the first eigenvector, the second eigenvector, and the third eigenvector to obtain a fused eigenvector; The fused feature vector is mapped into a vector having the same dimension as the first feature vector to obtain the first vector.
5. The method according to claim 2, characterized in that The tasks to be planned corresponding to the execution order of the current traversal are obtained by the decoder based on the attention mechanism.
6. The method according to claim 1, characterized in that The method further comprises: Inputting the dimension reduction matrix and the execution time matrix into a preset neural network model to obtain the probability corresponding to the execution order; the probability is the probability of taking any of the tasks to be planned as the task to be planned corresponding to the execution order; Calculating the first time used by the neural network model to assign corresponding tasks to be planned to all the execution orders using a roulette wheel algorithm based on the probability; Calculating a second time used by the neural network model to allocate corresponding tasks to be planned to all the execution orders based on the maximum probability corresponding to the execution orders; The model parameters of the neural network model are updated based on the first time and the second time to obtain the task planning model.
7. A task planning device, characterized in that: The device comprises: a matrix acquisition module, configured to acquire a time constraint matrix and an execution time matrix of the tasks to be planned; wherein the elements in the time constraint matrix are related to the limited time intervals between any two tasks to be planned; and the elements in the execution time matrix are related to the limited execution times of the tasks to be planned; A dimensionality reduction matrix obtaining module is used to reduce the dimension of the time constraint matrix based on a non-negative matrix decomposition method to obtain a dimensionality reduction matrix; a matrix input module, configured to input the dimension reduction matrix and the execution time matrix into a preset task planning model, and assign corresponding tasks to be planned to at least one preset execution order; Wherein, the matrix input module includes: A traversal submodule is used to traverse the execution order and trace back the currently traversed execution order by a preset number of orders to obtain a target execution order; A backtracking constraint matrix acquisition submodule is configured to acquire a backtracking constraint matrix corresponding to the currently traversed execution order based on the time constraint matrix; the elements in the backtracking constraint matrix are related to the limited time interval corresponding to the currently traversed execution order; the limited time interval corresponding to the currently traversed execution order is the limited time interval between the task corresponding to any execution order between the currently traversed execution order and the target execution order and all tasks; The input submodule is used to input the backtracking constraint matrix, the task corresponding to the previous execution order of the currently traversed execution order, the dimensionality reduction matrix and the execution time matrix into the task planning model, and assign corresponding tasks to be planned for the currently traversed execution order.
8. An electronic device, characterized in that: comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is configured to implement the method according to any one of claims 1 to 6 when executing a program stored in the memory.
9. One or more computer-readable media having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Task time logic constraint inference method and device based on constraint hierarchical network
CN116011792A
Traffic data recovery and abnormal value detection method based on feature non-negative matrix factorization
CN116561526A