Target allocation method based on binary search and KM algorithm
By transforming the target allocation problem into a binary graph matching problem, and combining binary search and KM algorithm, the problem that traditional methods are difficult to ensure global optimal solutions is solved, and efficient and accurate target allocation is achieved to meet real-time and dual optimization needs.
Patent Information
- Application Number
- CN202411621113.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-03-25
AI Technical Summary
Traditional goal allocation methods are difficult to ensure the global optimal solution. Especially under the requirements of real-time and dual optimization problems, the existing methods have problems of large computational volume and low efficiency.
The target allocation method based on binary search and KM algorithm is adopted to transform the target allocation problem into a binary graph matching problem, and the target allocation problem that minimizes the maximum value is solved through the fusion of binary search and KM algorithm.
This method quickly locates target elements through binary search, combines KM algorithm to adjust the top mark and find augmented path, and can effectively find the target-resource matching solution that maximizes/minimizes the total benefits, overcomes the limitations of traditional methods, and provides efficient, accurate and flexible target allocation solutions.
Smart Images

Figure CN119692661A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of resource allocation, and in particular relates to a target allocation method based on binary search and KM algorithm. Background Art
[0002] Target allocation has a wide range of applications in various fields. For example, in logistics distribution, there are multiple distribution centers and numerous customer orders. Reasonable allocation of orders to different distribution centers (similar to target allocation) can improve distribution efficiency and reduce costs. In emergency rescue missions, there are multiple rescue locations (targets) and different types of rescue teams (resources), such as firefighting, medical, and rescue teams. Reasonable allocation of rescue teams to rescue locations can minimize disaster losses. When disasters such as earthquakes and floods occur, fast and accurate target allocation can save more lives.
[0003] Traditional target allocation methods include enumeration and greedy algorithms. The enumeration method lists all possible target allocation schemes and then selects the best one. When the number of targets and resources increases slightly, the amount of calculation increases exponentially. The enumeration method can hardly get the result within an acceptable time and is not real-time. The greedy algorithm takes the best choice in the current state in each step of selection. In target allocation, resources may be allocated to the easiest target first. This method cannot guarantee the global optimal solution. Summary of the invention
[0004] 1. Technical issues to be resolved
[0005] The technical problem to be solved by the present invention is how to provide a target allocation method based on binary search and KM algorithm to solve the problem that the traditional target allocation method cannot guarantee a global optimal solution.
[0006] (II) Technical solution
[0007] In order to solve the above technical problems, the present invention proposes a target allocation method based on binary search and KM algorithm, which comprises the following steps:
[0008] S1. Model the problem and determine the optimization function;
[0009] Transform the target allocation problem into a planning model and determine the optimization function that minimizes the maximum problem;
[0010] S2. Convert the planning problem into a bipartite graph matching problem;
[0011] Assume that there is an edge between each target in U and each subject that performs the assigned task, and each edge is set with a weight, forming a bipartite graph; in the bipartite graph, the optimization function is transformed into: among all the allocation schemes, solve a maximum matching so that the maximum weight in the allocation scheme is the minimum, that is, a double optimization problem;
[0012] S3, establish a target allocation method that integrates binary search and KM algorithm;
[0013] The solution space in the target allocation problem is determined, and then the target-resource matching solution with maximum weight matching is obtained based on the target allocation method that combines binary search and KM algorithm.
[0014] (III) Beneficial effects
[0015] The present invention proposes a target allocation method based on binary search and KM algorithm, and the present invention proposes a target allocation method based on binary search and KM algorithm, which is used to solve the target allocation problem (double optimization problem) of minimizing the maximum value (cost or time or distance). Binary search quickly locates the target element by continuously halving the search interval, and its time complexity is O (log n), which has significant advantages in processing ordered data search problems. The KM algorithm is mainly used to solve the maximum weight matching problem of the bipartite graph. It obtains the optimal matching result by continuously adjusting the top mark and finding the augmented path. The target is regarded as a node on one side of the bipartite graph, the resource is regarded as a node on the other side, and the matching benefit between the target and the resource (such as combat effectiveness, cost-effectiveness, etc.) is regarded as the weight of the edge. The KM algorithm can find the target-resource matching solution that maximizes / minimizes the total benefit. In the context that the existing technology cannot well meet the requirements of target allocation in real time and double optimization problems, the target allocation method based on binary search and KM algorithm is expected to combine the advantages of the two, overcome the limitations of traditional methods, and provide an efficient, accurate and flexible target allocation solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is the allocation result of the naive KM algorithm;
[0017] Figure 2 This is the allocation result of the KM algorithm based on binary search of the present invention. DETAILED DESCRIPTION
[0018] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the drawings and examples.
[0019] The purpose of the present invention is to provide a target allocation method for minimizing the maximum path or time so that all targets can be eliminated by firepower in the shortest time. The present invention is applicable to the situation where the number of targets is less than or equal to the number of firepower.
[0020] The present invention proposes a target allocation method based on binary search and KM algorithm. The method first converts the planning problem into a bipartite graph matching problem according to the optimization function, and then uses binary search to divide the interval of the optimal solution into halves each time. Convergence is reached when only one value is left in the final interval.
[0021] A target allocation method based on binary search and KM algorithm, the steps are as follows:
[0022] S1. Model the problem and determine the optimization function;
[0023] Transform the target allocation problem into a planning model and determine the optimization function that minimizes the maximum problem;
[0024] S2. Convert the planning problem into a bipartite graph matching problem;
[0025] Assume that there is an edge between each target in U and each subject that performs the assigned task, and each edge is set with a weight, forming a bipartite graph; in the bipartite graph, the optimization function is transformed into: among all the allocation schemes, solve a maximum matching so that the maximum weight in the allocation scheme is the minimum, that is, a double optimization problem;
[0026] S3, establish a target allocation method that integrates binary search and KM algorithm;
[0027] The solution space in the target allocation problem is determined, and then the target-resource matching solution with maximum weight matching is obtained based on the target allocation method that combines binary search and KM algorithm.
[0028] In step S1, the target allocation problem is first transformed into a planning model, and an optimization function that minimizes the maximum problem is determined.
[0029] Assume there are m targets and n allocation objects, n>=m, and define the decision variable x ij , where x ij Indicates whether to assign the jth allocation object to the ith target, usually x ij =1 means allocation, x ij = 0 means no allocation. For each target i, there is a function f associated with allocation i (x), whose meaning depends on the assignment situation. For example, in robot task assignment, f i (x) represents the time required to reach the i-th target. The optimization function for minimizing the maximum value problem can be expressed as It is stipulated that each allocation object is assigned to at most one target, so the constraint is
[0030] In step S2, it is assumed that there is an edge between each target in U and each subject that performs the assigned task, and each edge is set with a weight, forming a bipartite graph; in the bipartite graph, the optimization function is transformed into: among all the allocation schemes, solve a maximum matching so that the maximum weight in the allocation scheme is the smallest, that is, a double optimization problem.
[0031] Assume that the target vertex set U = {u1, u2, ..., u m}, where m is the number of targets; the entities that perform the assigned tasks constitute a vertex set V = {v1, v2, ..., v n}, where n is the number of entities that perform the assigned tasks. To simplify the problem, assume that each target u in U i With each subject v in V j There is an edge, and the weight of the edge is defined as w ij , i = 1, 2, ..., m; j = 1, 2, ..., n, represents the subject v j Execution target u i The time or distance required. In a bipartite graph, there are m*n edges in total, and the final optimization function is transformed into: among all allocation schemes, solve a maximum matching so that the maximum weight in the allocation scheme is the minimum, that is, a double optimization problem.
[0032] It should be noted that when n>=m, the maximum matching can generate m edges, and the matching scheme is not unique. The dual optimization problem is to find one of the matching schemes in which the weight value of the edge with the maximum weight is smaller than the weight value of the edge with the maximum weight in all other schemes.
[0033] In step S3, the solution space in the target allocation problem is determined, and then a target allocation method based on the fusion of binary search and KM algorithm is used to obtain a target-resource matching solution with maximum weight matching.
[0034] In order to achieve the goal of minimizing the maximum execution time, we first need to determine the solution space in the target allocation problem. Obviously, the solution space is [min(w ij ), max(w ij )]. In each binary search iteration:
[0035] ① Determine the middle value. For example, in robot task allocation, the search is for the minimum weight, and the middle value is the middle proportion of the current search interval.
[0036] ② According to the middle value, remove the edges in the original bipartite graph whose weight is greater than the middle value to obtain a new bipartite graph. Input the new bipartite graph into the KM algorithm to re-solve the maximum matching. If there is a solution, record the allocation plan and narrow the search interval to the upper half, that is, the part from the left end point of the interval to the middle value; otherwise, narrow it to the lower half, that is, the part from the middle value to the right end point of the interval.
[0037] ③ When the left boundary of the search interval is greater than the right boundary, stop searching and return the allocation result. For the specific algorithm, refer to Table 1.
[0038] Table 1 Binary search strategy
[0039]
[0040] The steps of the KM algorithm in step S3 are as follows:
[0041] S31, initialize the top label: suppose the two vertex sets of the bipartite graph are U = {u1,u2,...,u m} and V = {v1,v2,...,v n}, where m and n are the number of targets and agents, respectively. For each vertex u in the vertex set U i , i = 1, 2, ..., m, its top mark l (u i ) is initialized to the same value as u i The maximum weight of the connected edges; for each vertex v in the vertex set V i , i = 1, 2, ..., n, its top mark l (v i ) is initialized to 0.
[0042] S32. Construct equal subgraph: equal subgraph G l is satisfied by w ij = l(u i )+l(v j ) i ,v j ) is a subgraph composed of .
[0043] S33. Find augmenting paths: In equal subgraphs, use the Hungarian algorithm to find augmenting paths. An augmenting path is a path that starts from an unmatched vertex, passes through a path where matched edges and unmatched edges appear alternately, and finally reaches another unmatched vertex. If an augmenting path is found, the number of matches can be increased by exchanging the matched edges and unmatched edges on the path.
[0044] S34, adjust the top label: If no augmenting path is found in the equal subgraph, the top label needs to be adjusted. Let S be the set of vertices in the U set that have been visited when searching for augmenting paths in the equal subgraph, and T be the set of vertices in the Y set that have been visited. Calculate Then for each u i ∈S,l(u i )=l(u i )-α; for each v j ∈T,l(v j )=l(v j)+α. After adjusting the top scale, reconstruct the equal subgraph and continue to search for the augmenting path.
[0045] S35. Repeat the steps until the maximum weight match is obtained: keep repeating the two steps of finding the augmenting path and adjusting the top label until there is a perfect match in the equal subgraph (when the number of vertices in the bipartite graph U is equal to the number of vertices in V, the vertices in U match the vertices in V one by one) or it is determined that no more matching edges can be added. At this time, the match obtained is the maximum weight match.
[0046] Embodiment 1:
[0047] The invention provides a target allocation method based on binary search and KM algorithm.
[0048] Figure 1 is the allocation result of the naive KM algorithm, Figure 2 The distribution results of the present invention can be found by comparison. Figure 2 The longest path in the allocation result is 341, which is Figure 1 The longest path 412 of the naive KM algorithm allocation result is 71 units shorter, thereby achieving an improved effect, namely minimizing the longest path.
[0049] A target allocation method based on binary search and KM algorithm, the steps are as follows:
[0050] (1) Model the problem and determine the optimization function;
[0051] (2) Convert the planning problem into a bipartite graph matching problem;
[0052] (3) Establish a target allocation method that integrates binary search and KM algorithm.
[0053] In step (1), the target allocation problem is first transformed into a linear programming model. Assume that there are m targets and n allocation objects (n>=m), and define the decision variable x ij , where x ij Indicates whether to assign the jth allocation object to the ith target (usually x ij =1 means allocation, x ij = 0 means no allocation). For each target i, there is a function f associated with allocation i (x), its meaning depends on the allocation situation. For example, in firepower allocation, f i (x) represents the time required to hit the i-th target. The minimization problem can be expressed as It is stipulated that each allocation object is assigned to at most one target, so the constraint is
[0054] In step (2), let the target vertex set U = {u1,u2,...,um}, where m is the number of targets; the entities that perform the assigned tasks constitute a vertex set V = {v1,v2,...,v n}, where n is the number of entities that perform the assigned tasks. To simplify the problem, assume that each target u in U i With each subject v in V j There is an edge, and the weight of the edge is defined as w ij (i=1,2,...,m;j=1,2,...,n), represents the subject v j Execution target u i The time or distance required. In the bipartite graph, there are m*n edges in total, and the final optimization function is transformed into: among all the allocation schemes, solve a maximum matching so that the maximum weight in the allocation scheme is the minimum, that is, a double optimization problem.
[0055] In step (3), in order to achieve the goal of minimizing the maximum execution time, we first need to determine the solution space in the target allocation problem. Obviously, the solution space is [min(w ij ),max(w ij )]. In each binary search iteration:
[0056] ① Determine the middle value. For example, in firepower allocation, the search is for the minimum weight, and the middle value is the middle proportion of the current search interval.
[0057] ② According to the middle value, remove the edges in the original bipartite graph whose weight is greater than the middle value to obtain a new bipartite graph. Input the new bipartite graph into the KM algorithm to re-solve the optimal matching. If there is a solution, record the allocation plan and narrow the search interval to the upper half; otherwise, narrow it to the lower half.
[0058] ③ When the left boundary of the search interval is greater than the right boundary, stop searching and return the allocation result. For the specific algorithm, refer to Table 1.
[0059] Table 1 Binary search strategy
[0060]
[0061] The steps of the KM algorithm in step (3) are as follows:
[0062] ① Initialize the top label: Let the two vertex sets of the bipartite graph be U = {u1,u2,...,u m} and V = {v1,v2,...,v n}, where m and n are the number of targets and agents, respectively. For each vertex u in the vertex set U i (i=1,2,...,m), its top mark l(u i ) is initialized to the same value as u iThe maximum weight of the connected edges; for each vertex v in the vertex set V i (i=1,2,...,n), its top mark l(v i ) is initialized to 0.
[0063] ②Construct equal subgraph: equal subgraph G l is satisfied by w ij = l(x i )+l(y j ) i ,v j ) is a subgraph composed of .
[0064] ③ Find augmenting paths: In equal subgraphs, use the Hungarian algorithm to find augmenting paths. An augmenting path is a path that starts from an unmatched vertex, passes through a path where some matched edges and unmatched edges appear alternately, and finally reaches another unmatched vertex. If an augmenting path is found, the number of matches can be increased by exchanging the matched edges and unmatched edges on the path.
[0065] ④ Adjust the top label: If no augmenting path is found in the equal subgraph, the top label needs to be adjusted. Let S be the set of vertices in the U set that have been visited when searching for augmenting paths in the equal subgraph, and T be the set of vertices in the Y set that have been visited. Calculate Then for each u i ∈S,l(u i )=l(u i )-α; for each v j ∈T,l(v j )=l(v j )+α. After adjusting the top scale, reconstruct the equal subgraph and continue to search for the augmenting path.
[0066] ⑤ Repeat the steps until the maximum weighted match is obtained: Repeat the two steps of finding the augmenting path and adjusting the top label until there is a perfect match in the equal subgraph (when the number of left and right vertices of the bipartite graph is equal, all vertices are matched) or it is determined that no more matching edges can be added. At this time, the match obtained is the maximum weighted match.
[0067] Example 2
[0068] Figure 1 is the allocation result of the naive KM algorithm, Figure 2The blue circle in the two figures represents the missile, and the green five-pointed star represents the target. The positions of the six missiles are (80, 100), (170, 100), (250, 100), (330, 100), (414, 100), (500, 100), and the positions of the four targets are (550, 275), (550, 380), (550, 300), and (550, 240). Each missile can attack any target, and the distance from each missile to the target is calculated using the Euclidean distance.
[0069] By comparison, we can find Figure 2 The longest path in the allocation result is 341, which is Figure 1 The longest path 412 of the naive KM algorithm allocation result is 71 units shorter, thereby achieving an improved effect, namely minimizing the longest path.
[0070] The present invention proposes a target allocation method based on binary search and KM algorithm, which is used to solve the target allocation problem (dual optimization problem) of minimizing the maximum value (cost or time or distance). Binary search quickly locates the target element by continuously halving the search interval, and its time complexity is O (logn), which has significant advantages in processing ordered data search problems. The KM algorithm is mainly used to solve the maximum weight matching problem of the bipartite graph. It obtains the optimal matching result by continuously adjusting the top mark and finding the augmented path. The target is regarded as a node on one side of the bipartite graph, the resource is regarded as a node on the other side, and the matching benefit between the target and the resource (such as combat effectiveness, cost-effectiveness, etc.) is regarded as the weight of the edge. The KM algorithm can find the target-resource matching solution that maximizes / minimizes the total benefit. In the context that the existing technology cannot well meet the requirements of target allocation in real time and dual optimization problems, the target allocation method based on binary search and KM algorithm is expected to combine the advantages of both, overcome the limitations of traditional methods, and provide an efficient, accurate and flexible target allocation solution.
[0071] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A target allocation method based on binary search and KM algorithm, characterized in that: The method comprises the following steps: S1. Model the problem and determine the optimization function; Transform the target allocation problem into a planning model and determine the optimization function that minimizes the maximum problem; S2. Convert the planning problem into a bipartite graph matching problem; Assume that there is an edge between each target in U and each subject that performs the assigned task, and each edge is set with a weight, forming a bipartite graph; in the bipartite graph, the optimization function is transformed into: among all the allocation schemes, solve a maximum matching so that the maximum weight in the allocation scheme is the minimum, that is, a double optimization problem; S3, establish a target allocation method that integrates binary search and KM algorithm; The solution space in the target allocation problem is determined, and then the target-resource matching solution with maximum weight matching is obtained based on the target allocation method that combines binary search and KM algorithm.
2. The target allocation method based on binary search and KM algorithm as claimed in claim 1, characterized in that: In S1, Assume there are m targets and n allocation objects, n>=m, and define the decision variable x ij , where x ij Indicates whether to assign the jth allocation object to the i-th target, x ij =1 means allocation, x ij = 0 means no allocation; for each target i, there is a function f associated with allocation i (x), whose meaning depends on the allocation; the optimization function for the minimization maximum problem is expressed as It is stipulated that each allocation object is assigned to at most one target, so the constraint is 3. The target allocation method based on binary search and KM algorithm as claimed in claim 2, characterized in that: In robot task allocation, f i (x) represents the time required to reach the i-th target.
4. The target allocation method based on binary search and KM algorithm as claimed in claim 2, characterized in that: In S2, let the target vertex set U = {u1,u2,...,u m }, where m is the number of targets; the entities that perform the assigned tasks constitute a vertex set V = {v1,v2,...,v n }, where n is the number of entities that perform the assigned tasks; assuming that each target u in U i With each subject v in V j There is an edge, and the weight of the edge is defined as w ij , i=1,2,...,m;j=1,2,...,n, represents the subject v j Execution target u i The time or distance required; in the bipartite graph, there are m*n edges in total, and the final optimization function is transformed into: among all allocation schemes, solve a maximum matching so that the maximum weight in the allocation scheme is the smallest, that is, a double optimization problem.
5. The target allocation method based on binary search and KM algorithm as claimed in claim 4, characterized in that: When n>=m, the maximum matching can generate m edges, and the matching scheme is not unique. The dual optimization problem is to find one of the matching schemes in which the weight value of the edge with the maximum weight is smaller than the weight value of the edge with the maximum weight in all other schemes.
6. The target allocation method based on binary search and KM algorithm as claimed in claim 4, characterized in that: In S3, the solution space in the target allocation problem is determined to be [min(w ij ),max(w ij )].
7. The target allocation method based on binary search and KM algorithm as claimed in claim 4, characterized in that: In S3, in each binary search iteration, the middle value is determined, and according to the middle value, the edges with weights greater than the middle value in the original bipartite graph are removed to obtain a new bipartite graph, and the new bipartite graph is input into the KM algorithm to re-solve the maximum matching. If there is a solution, the allocation scheme is recorded, and the search interval is narrowed to the upper half, that is, the part from the left end point of the interval to the middle value; Otherwise, it will be reduced to the lower half, that is, the part from the middle value to the right endpoint of the interval.
8. The target allocation method based on binary search and KM algorithm as claimed in claim 7, characterized in that: When the left boundary of the search interval is greater than the right boundary, the search stops and the allocation result is returned.
9. The target allocation method based on binary search and KM algorithm as claimed in claim 7, characterized in that: In S3, the KM algorithm includes the following steps: S31, initialize the top label: suppose the two vertex sets of the bipartite graph are U = {u1,u2,...,u m } and V = {v1,v2,...,v n }, where m and n are the number of targets and subjects respectively; for each vertex u in the vertex set U i , i = 1, 2, ..., m, its top mark l (u i ) is initialized to the same value as u i The maximum weight of the connected edges; for each vertex v in the vertex set V i , i = 1, 2, ..., n, its top mark l (v i ) is initialized to 0; S32. Construct equal subgraph: equal subgraph G l is satisfied by w ij = l(u i )+l(v j ) i ,v j ) composed of a subgraph; S33. Find augmenting paths: In equal subgraphs, use the Hungarian algorithm to find augmenting paths. An augmenting path is a path that starts from an unmatched vertex, passes through a path where some matched edges and unmatched edges appear alternately, and finally reaches another unmatched vertex. If an augmenting path is found, the number of matches is increased by exchanging the matched edges and unmatched edges on the path. S34, adjust the top label: If no augmenting path is found in the equal subgraph, the top label needs to be adjusted; let S be the set of vertices in the U set that have been visited when searching for augmenting paths in the equal subgraph, and T be the set of vertices in the Y set that have been visited; calculate Then for each u i ∈S,l(u i )=l(u i )-α; for each v j ∈T,l(v j )=l(v j )+α; after adjusting the top mark, rebuild the equal subgraph and continue to find the augmenting path; S35. Repeat the steps until the maximum weight match is obtained: keep repeating the two steps of finding the augmenting path and adjusting the top label until there is a perfect match in the equal subgraph or it is determined that no more matching edges can be added. At this time, the match obtained is the maximum weight match.
10. The target allocation method based on binary search and KM algorithm as claimed in claim 9, characterized in that: A perfect match means that when the number of vertices in the bipartite graph U is equal to the number of vertices in V, the vertices in U match the vertices in V one by one.