A limited resource multi-task matching method based on a greedy strategy
By combining the greedy strategy with the breadth-first search algorithm, an undirected weighted graph is constructed to optimize the resource package combination, which solves the problem of low efficiency in finding the global feasible solution to the combinatorial optimization problem and achieves efficient resource scheduling.
Patent Information
- Application Number
- CN202510060480.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-01-15
AI Technical Summary
When solving combinatorial optimization problems, especially NP-hard problems, existing technologies find it difficult to find a globally feasible solution within polynomial time complexity. Traditional methods require the introduction of a large number of parameters or complex algorithms, resulting in high computational complexity and low efficiency.
A greedy strategy is used for preliminary matching, combined with a breadth-first search algorithm. By constructing an undirected weighted graph and adjacency list, the combination and allocation of resource packages are optimized to avoid combinatorial explosion, reduce computational overhead, and find a globally feasible solution in polynomial time.
It efficiently finds a global feasible solution within polynomial time complexity, reduces computer time and space overhead, solves the after-effect problem, and simplifies the solution process.
Smart Images

Figure CN119558620B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a limited resource multi-task matching method based on a greedy strategy, and belongs to the field of scheduling optimization. Background Art
[0002] Combinatorial optimization problems often occur in fields such as logistics and transportation, manufacturing and production, and human resource management. They are characterized by complexity, multiple objectives, multiple constraints, and combinatorial explosion.
[0003] Traditional solutions are currently categorized into two main categories: exact computation and approximate computation. Exact computation includes methods such as dynamic programming, branch-and-bound, linear programming, and integer programming; approximate computation includes methods such as metaheuristics and deep learning. However, combinatorial optimization problems are often NP-hard, meaning that the complexity of their solution increases exponentially with the scale of the problem. Exact computational solutions are difficult to solve for large-scale problems. Furthermore, because combinatorial optimization problems often have multiple objectives and constraints, approximate computational solutions require a large number of parameters, resulting in complex algorithmic parameter conditions and an inability to find an optimal solution.
[0004] For the above problem, how to directly find a global feasible solution without introducing a large number of parameters and with polynomial time complexity, while making the solution simpler and faster becomes a problem that needs to be solved. Summary of the Invention
[0005] The present invention provides a limited resource multi-task matching method based on a greedy strategy. By cleverly utilizing the greedy strategy for preliminary matching, the problem scale is reduced. On this basis, the breadth-first search algorithm is used to make up for the deficiency of the greedy strategy that it is easy to fall into the local optimal solution, and a global feasible solution can be found more efficiently.
[0006] The technical solution of the present invention is:
[0007] According to a first aspect of the present invention, a method for matching multiple tasks with limited resources based on a greedy strategy is provided, comprising the following steps:
[0008] Step 1: For multiple task requirements under the resource scheduling project, a multi-task requirement table is constructed based on the task requirement number, the resource package attribute index of the task requirement, and the number of resource packages required by the task; the resource packages are combined according to a preset number of resources;
[0009] Step 2: Based on the multi-task requirement table, select all feasible solutions for the task requirements from limited resources; construct a multi-task feasible solution table based on the task requirement number, the resource package attribute value of the task requirement, and the feasible solutions of the task requirement;
[0010] Step 3: Based on the multi-task feasible solution table, use the adjacency list to construct a finite resource undirected weighted graph. In the finite resource undirected weighted graph, vertices represent different resources, edges represent combinations of resources, and edge weights represent the attribute values of resource packages.
[0011] Step 4: Prioritize the multiple task requirements under the resource scheduling project. Select the task requirements in order of priority and, based on a greedy strategy, traverse the multi-task feasible solution table to obtain a preliminary resource package screening table. Determine the number of feasible solutions for each task requirement in the preliminary resource package screening table. If the number of feasible solutions for each task requirement in the preliminary resource package screening table meets the number of resource packages required for the corresponding task requirement, use the feasible solution corresponding to the preliminary resource package screening table as the matching result for the multiple task requirements under the resource scheduling project. Otherwise, proceed to Step 5.
[0012] Step 5: For the task requirements that are not matched in Step 4, use the breadth-first search algorithm to find a path in the limited resource undirected weighted graph and multi-task feasible solution, and perform resource transfer and allocation.
[0013] Furthermore, according to the multi-task requirement table, all feasible solutions for the task requirements are screened from limited resources, specifically: resource packages in different combinations are obtained by combining a preset number of resources from limited resources, and all resource packages in these combinations are screened, and all resource packages whose "resource package attribute values" meet the resource package attribute indicators of the current task requirements are taken as feasible solutions to the current task.
[0014] Furthermore, the resource package attribute value is derived from the attribute values of each resource in the resource package according to a combination method; the combination method is:
[0015] ;
[0016] Where, Indicates the resource pack's attribute values; Indicates the first The first resource attribute values, Indicates the first The coefficient of determination of a resource.
[0017] Furthermore, the Step 4 is specifically as follows:
[0018] Create and initialize the resource package initial screening table;
[0019] Establish priorities for multiple task requirements under the resource scheduling project; select task requirements in order of priority and place the task requirement numbers in the resource package initial screening table;
[0020] Determine whether the number of feasible solutions required by the current task in the resource package initial screening table meets the number of resource packages required by the task or whether the multi-task feasible solution table has been accessed:
[0021] If it meets the requirements, select the next task;
[0022] If not, a feasible solution is selected from the multi-task feasible solution table: if any resource in the resource package corresponding to the feasible solution already exists in the resource package preliminary screening table, the feasible solution is skipped; if not, the feasible solution is released into the resource package preliminary screening table; until the number of feasible solutions required by the current task in the resource package preliminary screening table meets the number of resource packages required by the task or the multi-task feasible solution table is accessed.
[0023] Furthermore, the limited resource multi-task matching method based on the greedy strategy is used for electrolyte resource scheduling.
[0024] According to a second aspect of the present invention, a limited resource multi-task matching system based on a greedy strategy is provided, comprising a module of any one of the above-mentioned limited resource multi-task matching methods based on a greedy strategy.
[0025] According to a third aspect of the present invention, a processor is provided, which is used to run a program, wherein the program executes any one of the above-mentioned limited resource multi-task matching methods based on a greedy strategy when running.
[0026] The beneficial effects of the present invention are as follows: the present invention utilizes the advantages of the greedy strategy to select as many required resources for multiple tasks as possible at one time during the initial matching, without the need for overly complex prediction and judgment, and without the need to exhaustively enumerate every possible solution, thereby avoiding the situation of combinatorial explosion and reducing the time and space overhead of the computer; on this basis, the present invention further introduces the breadth-first search BFS algorithm, which can not only determine whether the multiple matching problem has a globally feasible solution, but also find the path of the resource graph within a polynomial time complexity, and transfer and allocate limited resources. Each matching does not need to consider the impact of the current choice on the future, thus solving the problem of after-effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 is a flow chart of the present invention;
[0028] Figure 2 This is an example of a resource map. DETAILED DESCRIPTION
[0029] To make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. It should be noted that, in the absence of conflict, the embodiments in this application and the features in the embodiments can be combined with each other in any way.
[0030] Example 1: Figure 1-2 As shown, according to a first aspect of an embodiment of the present invention, a method for matching multiple tasks with limited resources based on a greedy strategy includes the following steps:
[0031] Step 1: For multiple task requirements under the resource scheduling project, a multi-task requirement table is constructed based on the task requirement number, the resource package attribute index of the task requirement, and the number of resource packages required by the task; the resource packages are combined according to a preset number of resources;
[0032] Step 2: Based on the multi-task requirement table, select all feasible solutions for the task requirements from limited resources; construct a multi-task feasible solution table based on the task requirement number, the resource package attribute value of the task requirement, and the feasible solutions of the task requirement;
[0033] Step 3: Based on the multi-task feasible solution table, use the adjacency list to construct a finite resource undirected weighted graph. In the finite resource undirected weighted graph, vertices represent different resources, edges represent combinations of resources, and edge weights represent the attribute values of resource packages.
[0034] Step 4: Prioritize the multiple task requirements under the resource scheduling project. Select the task requirements in order of priority and, based on a greedy strategy, traverse the multi-task feasible solution table to obtain a preliminary resource package screening table. Determine the number of feasible solutions for each task requirement in the preliminary resource package screening table. If the number of feasible solutions for each task requirement in the preliminary resource package screening table meets the number of resource packages required for the corresponding task requirement, use the feasible solution corresponding to the preliminary resource package screening table as the matching result for the multiple task requirements under the resource scheduling project. Otherwise, proceed to Step 5.
[0035] Step 5: For the task requirements that are not matched in Step 4, use the breadth-first search algorithm to find a path in the limited resource undirected weighted graph and multi-task feasible solution, and perform resource transfer and allocation.
[0036] Furthermore, according to the multi-task requirement table, all feasible solutions for the task requirements are screened from limited resources, specifically: resource packages in different combinations are obtained by combining a preset number of resources from limited resources, and all resource packages in these combinations are screened, and all resource packages whose "resource package attribute values" meet the resource package attribute indicators of the current task requirements are taken as feasible solutions to the current task.
[0037] Furthermore, the resource package attribute value is derived from the attribute values of each resource in the resource package according to a combination method; the combination method is:
[0038] ;
[0039] Where, Indicates the resource pack's attribute values; Indicates the first The first resource attribute values, Indicates the first It should be noted that the resource package is combined according to the preset number of resources, and the preset number can be selected according to the determination coefficient. For example, for the electrolyte resource scheduling project, the determination coefficient is , that is, the volume of electrolyte. The determination coefficient of each resource is approximately 2.3t. The terminal device that performs the task can grab 4.6t of resources at a time. Therefore, the preset quantity is set to 2, that is, 2 electrolytic cells are combined into an electrolyte package as a resource package.
[0040] Furthermore, the Step 4 is specifically as follows:
[0041] Create and initialize the resource package initial screening table;
[0042] Establish priorities for multiple task requirements under the resource scheduling project; select task requirements in order of priority and place the task requirement numbers in the resource package initial screening table;
[0043] Determine whether the number of feasible solutions required by the current task in the resource package initial screening table meets the number of resource packages required by the task or whether the multi-task feasible solution table has been accessed:
[0044] If it meets the requirements, select the next task;
[0045] If not, a feasible solution is selected from the multi-task feasible solution table: if any resource in the resource package corresponding to the feasible solution already exists in the resource package preliminary screening table, the feasible solution is skipped; if not, the feasible solution is released into the resource package preliminary screening table; until the number of feasible solutions required by the current task in the resource package preliminary screening table meets the number of resource packages required by the task or the multi-task feasible solution table is accessed.
[0046] By applying the above technical solution, it can be seen that the present invention utilizes the advantages of the greedy strategy to select as many required resources for multiple tasks as possible at one time during the initial matching. This does not require overly complex predictions and judgments, and does not require exhaustive enumeration of every possible solution, thus avoiding combinatorial explosion and reducing computer time and space overhead. On this basis, the present invention further introduces a breadth-first search algorithm, which can not only determine whether the multiple matching problem has a globally feasible solution (i.e., if no path can be found for incompletely matched tasks, it can be determined that there is no globally feasible solution), but can also find paths in the resource graph within polynomial time complexity to transfer and allocate limited resources. Each matching does not need to consider the impact of the current choice on the future, thus solving the problem of after-effects.
[0047] According to the second aspect of an embodiment of the present invention, a finite resource multi-task matching system based on a greedy strategy is provided, including a module of any one of the above-mentioned finite resource multi-task matching methods based on a greedy strategy. Specifically comprising: a first module for executing Step 1: for multiple task requirements under a resource scheduling project, a multi-task requirement table is constructed based on the number of the task requirement, the attribute index of the resource package of the task requirement, and the number of resource packages of the task requirement; the resource packages are combined according to a preset number of resources; a second module for executing Step 2: according to the multi-task requirement table, all feasible solutions for the task requirements are screened from the limited resources; a multi-task feasible solution table is constructed based on the number of the task requirement, the attribute value of the resource package of the task requirement, and the feasible solutions of the task requirement; a third module for executing Step 3: according to the multi-task feasible solution table, an adjacency list is used to construct a finite resource undirected weighted graph, in which vertices in the finite resource undirected weighted graph represent different resources, edges represent combinations between resources, and the weights of edges represent the resources. Source package attribute value; the fourth module is used to execute Step 4: establish priorities for multiple task requirements under the resource scheduling project; select task requirements in order of priority, and based on the greedy strategy, traverse the multi-task feasible solution table to obtain the resource package preliminary screening table; judge the number of feasible solutions for each task requirement in the resource package preliminary screening table: when the number of feasible solutions for each task requirement in the resource package preliminary screening table meets the number of resource packages corresponding to the task requirements, the feasible solution corresponding to the resource package preliminary screening table is used as the matching result of the multiple task requirements under the resource scheduling project; otherwise, execute the fifth module; the fifth module is used to execute Step 5, for the task requirements that have not been matched in the fourth module, use the breadth-first search algorithm to find a path in the undirected weighted graph of limited resources and the multi-task feasible solution, and perform resource transfer and allocation. For the parts not described in detail in the above modules, please refer to the relevant description of the embodiment.
[0048] According to a third aspect of an embodiment of the present invention, a processor is provided, which is configured to run a program, wherein the program, when running, executes any one of the above-mentioned methods for matching multiple tasks with limited resources based on a greedy strategy.
[0049] In order to verify the effectiveness and feasibility of the invention, the following experiments were designed for verification:
[0050] An electrolyte resource scheduling project, P, has three downstream production line tasks and 20 electrolytic cells. The electrolyte in each electrolytic cell has six different metal element ratios and electrolyte volumes. Each downstream production line task requires two electrolytic cells to be combined into an electrolyte pack. The element ratios of each electrolyte pack must meet the downstream production line task requirements. The number of electrolyte packs and metal element ratios required for each downstream production line task are given in Table 1, and the corresponding data for the 20 electrolytic cells is given in Table 2.
[0051] Table 1 Experimental data example (number of electrolyte packages and metal element ratio required by downstream production line tasks)
[0052]
[0053] Table 2 Experimental data example (electrolyte volume and metal element ratio in 20 electrolytic cells)
[0054]
[0055] The specific steps of the method are as follows:
[0056] Step 1. For the three downstream production line task requirements, the task requirements are numbered T1, T2, and T3. The resource attributes of the task requirements include six different metal elements, and the resource package attribute index of the task requirements is the proportion index of the six different metal elements. Based on the combination of two electrolytic cells into one electrolyte package as a resource package, the number of resource packages required for the three downstream production line task requirements is 2, 6, and 2 respectively. Based on the task requirement number, the resource package attribute index of the task requirement, and the number of resource packages required, a multi-task requirement table as shown in Table 3 is constructed (the first column in Table 3 is the task requirement number, the second to seventh columns are the resource package attribute index of the task requirement, and the eighth column is the number of resource packages required for the task).
[0057] Table 3
[0058]
[0059] Step 2. The limited resources known to the project are 20 electrolytic cells; from the 20 electrolytic cells, resource packages in different combinations are obtained by combining 2 electrolytic cells, and all resource packages in these combinations are screened, and all resource packages whose "resource package attribute values" meet the resource package attribute indicators of the current task requirement are taken as feasible solutions to the current task. For example, as shown in Table 4, taking task requirement T1 as an example: from the 20 electrolytic cells, resource packages in different combinations are obtained by combining 2 electrolytic cells, and all resource packages in these combinations are screened, and all resource packages whose "resource package attribute values" meet the "resource package attribute indicators" of task requirement T1 are taken as feasible solutions to the current task. As can be seen from the first row of Table 4, the "resource package attribute values" in the second to seventh columns of the first row of Table 4 meet the "resource package attribute indicators" of the second to seventh columns of the first row of Table 3 regarding task requirement T1. Therefore, the resource package formed by the resource combination (E1, E2) corresponding to the "resource package attribute values" in the first row of Table 4 is a feasible solution to task requirement T1.
[0060] The multi-task feasible solution table is constructed based on the task requirement number, the resource package attribute value of the task requirement, and the feasible solution of the task requirement as shown in Table 4:
[0061] Table 4
[0062]
[0063] It should be noted that the resource package attribute value is obtained by combining the attribute values of each resource in the resource package. The attribute values of each resource are shown in Table 2.
[0064] Step 3. Based on the multi-task feasible solution table, use the adjacency list to construct a finite resource undirected weighted graph. In the finite resource undirected weighted graph, the vertices represent different resources, the edges represent the combination of resources, and the edge weights represent the attribute values of the resource packages.
[0065] For example, according to the feasible solution table of the task shown in Table 4, an adjacency list is used to construct an undirected weighted graph with limited resources. The vertices represent different electrolytic cells, the edges represent the combinations between electrolytic cells (i.e., electrolyte packages), and the weights represent the proportion of metal elements in the electrolyte packages, such as Figure 2 Some vertices and edges are displayed.
[0066] Step 4. Create and initialize the resource package screening table; establish the priority order of T1, T2, and T3 for multiple task requirements under the resource scheduling project; select the task requirements according to the priority order, initially select the highest priority task requirement, that is, T1, and put the task requirement number into the resource package screening table; select feasible solutions from the multi-task feasible solution table, first select (E1, E2), and then put them into the resource package screening table. At this time, the number of feasible solutions for the current task requirement in the resource package screening table is 1, so the number of resource packages that do not meet the task requirement (that is, the number of Quantity 2), and the multi-task feasible solution table has not been fully accessed at this time; then, a feasible solution (E1, E3) is selected from the multi-task feasible solution table, but E1 already exists in the resource package preliminary screening table, so this feasible solution is skipped; after skipping multiple feasible solutions, (E3, E4) is found. None of the resources in the resource package corresponding to the feasible solution (E3, E4) exist in the resource package preliminary screening table, so the feasible solution (E3, E4) is placed in the resource package preliminary screening table; similarly, the feasible solution is screened for the next priority task requirement. Table 5 shows an example of a resource package preliminary screening table. In the example shown in Table 5, the number of feasible solutions obtained for task requirement T3 is less than the number of resource packages required for task requirement 3, so the next step is executed.
[0067] Table 5
[0068]
[0069] Step 5. Use the breadth-first search algorithm to find a path for the unmatched downstream production line tasks in the limited resource undirected weighted graph and the multi-task feasible solution. After all downstream production line tasks on the path release the corresponding electrolyte packages step by step, they are assigned to the unmatched downstream production line tasks until all downstream production line task requirements are met or there is no path, and the algorithm ends. Example: T3 needs electrolyte package (E19, E20), but electrolyte package (E19, E20) is occupied by T2 and according to the multi-task feasible solution table, T2 has other electrolyte packages (E7, E8) that can be occupied. Then T2 releases electrolyte package (E19, E20) to T3 and occupies electrolyte package (E7, E8). The above process is automatically completed in the resource graph and multi-task feasible solution using the breadth-first search algorithm. The results are shown in Table 6:
[0070] Table 6
[0071]
[0072] It should be noted that the problem of matching multiple tasks with limited resources in combinatorial optimization is often solved using backtracking and bipartite graph methods. The essence of the backtracking method is to traverse all possibilities through brute force search until a feasible solution or optimal solution is found. In the problem of matching multiple tasks with limited resources, its time complexity is O(n!). The essence of the bipartite graph method is to divide resource packages and task requirements into two types of vertices, namely, the K point set is all feasible packages after the electrolytic cell combination, and the U point set is the task requirements.<K,U> The edges are all feasible combinations that meet the task requirements. Therefore, the model only needs to use a specific algorithm to find the maximum matching of the U point set. In the limited resource multi-task matching problem, the Push-Relabel algorithm is often used to find the maximum matching of the U point set, with a time complexity of O(V 2 ·E). As explained in the present invention, the time complexity is O(V+E). In the above, V and E represent the size of vertices and edges in the graph, respectively. To demonstrate the time advantage of the present invention, two experiments are designed. Each experiment is conducted ten times, and the average value is taken as the final result. Experiment 1: An electrolyte resource scheduling project P has a total of 3 downstream production line task requirements and 20 electrolytic cells; Experiment 2: An electrolyte resource scheduling project P has a total of 30 downstream production line task requirements and 200 electrolytic cells. The results are shown in Table 7 below:
[0073] Table 7
[0074]
[0075] As shown in Table 7, compared with the traditional optimization method, the present invention utilizes the characteristics of the greedy strategy and breadth-first search algorithm to solve the computational complexity caused by the large scale of the problem, greatly reduces the time complexity, and makes the optimization process simpler and faster.
[0076] The specific embodiments of the present invention are described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Various changes can be made within the knowledge of ordinary technicians in this field without departing from the scope of the present invention.
Claims
1. A limited resource multi-task matching method based on greedy strategy, characterized in that: The following steps are involved: Step 1: For multiple task requirements under the resource scheduling project, a multi-task requirement table is constructed based on the task requirement number, the resource package attribute index of the task requirement, and the number of resource packages required by the task; the resource packages are combined according to a preset number of resources; Step 2: Based on the multi-task requirement table, select all feasible solutions for the task requirements from limited resources; construct a multi-task feasible solution table based on the task requirement number, the resource package attribute value of the task requirement, and the feasible solutions of the task requirement; Step 3: Based on the multi-task feasible solution table, use the adjacency list to construct a finite resource undirected weighted graph. In the finite resource undirected weighted graph, vertices represent different resources, edges represent combinations of resources, and edge weights represent the attribute values of resource packages. Step 4: Prioritize the multiple task requirements under the resource scheduling project. Select the task requirements in order of priority and, based on a greedy strategy, traverse the multi-task feasible solution table to obtain a preliminary resource package screening table. Determine the number of feasible solutions for each task requirement in the preliminary resource package screening table. If the number of feasible solutions for each task requirement in the preliminary resource package screening table meets the number of resource packages required for the corresponding task requirement, use the feasible solution corresponding to the preliminary resource package screening table as the matching result for the multiple task requirements under the resource scheduling project. Otherwise, proceed to Step 5. Step 5: For the task requirements that were not matched in Step 4, use the breadth-first search algorithm to find a path in the limited resource undirected weighted graph and multi-task feasible solutions, and perform resource transfer and allocation; Combining a preset number of resources from limited resources to obtain resource packages in different combinations, screening all the resource packages in these combinations, and selecting all resource packages whose attribute values meet the attribute indicators of the resource packages required by the current task as feasible solutions for the current task; The resource package attribute value is derived from the attribute values of each resource in the resource package according to a combination method; the combination method is: ; Where, Indicates the resource pack's attribute values; Indicates the first The first resource attribute values, Indicates the first The coefficient of determination of a resource.
2. The method for matching multiple tasks with limited resources based on a greedy strategy according to claim 1, characterized in that: The Step 4 is specifically as follows: Create and initialize the resource package initial screening table; Establish priorities for multiple task requirements under the resource scheduling project; select task requirements in order of priority and place the task requirement numbers in the resource package initial screening table; Determine whether the number of feasible solutions required by the current task in the resource package initial screening table meets the number of resource packages required by the task or whether the multi-task feasible solution table has been accessed: If it meets the requirements, select the next task; If not, a feasible solution is selected from the multi-task feasible solution table: if any resource in the resource package corresponding to the feasible solution already exists in the resource package initial screening table, the feasible solution is skipped; If it does not exist, the feasible solution will be released into the resource package preliminary screening table; until the number of feasible solutions required by the current task in the resource package preliminary screening table meets the number of resource packages required by the task or the multi-task feasible solution table is accessed.
3. The method for matching multiple tasks with limited resources based on a greedy strategy according to claim 1, characterized in that: The limited resource multi-task matching method based on greedy strategy is used for electrolyte resource scheduling.
4. A limited resource multi-task matching system based on a greedy strategy, characterized in that: A module comprising the limited resource multi-task matching method based on a greedy strategy as described in any one of claims 1-3.
5. A processor, characterized in that: The processor is used to run a program, wherein the program, when running, executes the limited resource multi-task matching method based on a greedy strategy according to any one of claims 1 to 3.
Citation Information
Patent Citations
Complex mobile crowdsourcing task allocation method based on greedy strategy
CN110378663A
Urban crowdsourcing distribution task optimization scheduling method based on path planning
CN110826968A