The Application of Bipartite Matching in Assignment Problem

The optimized assignment of staff is of great significance for improving the production efficiency of the society. For specific tasks, the key to optimizing staffing is personnel scheduling. The assignment problem is classical in the personnel scheduling. In this paper, we abstract it as an optimal matching model of a bipartite graph and propose the Ultimate Hungarian Algorithm(UHA). By introducing feasible labels, iteratively searching for the augmenting path to get the optimal match(maximum-weight matching). And we compare the algorithm with the traditional brute force method, then conclude that our algorithm has lower time complexity and can solve the problems of maximum-weight matching more effectively.


INTRODUCTION
M OTIVATED by the increasing in labor costs, employing multi-skilled workers has become an important way to raise the personnel utilization. For a specific task, personnel scheduling is the key to optimizing staffing. Assignment problem is one of the classic problem in the staff scheduling. m workers match n tasks, and each worker has different efficiency in each task, determine a task allocation plan which makes the highest gross efficiency. Traditional approach to this problem is manually allocate the tasks according to the leader's understanding of the workers, which is time-consuming, laborious, inefficient and relying on experience. However, this approach can not meet the requirements of quantitative, rapid and automatic scientific management. Therefore, it is necessary to introduce the theories of operational research to solve the assignment problem with computer assistance.
In this paper, we abstract the maximum-weight matching model from assignment problem, and propose UHS to solve it. The main idea of UHS is to figure out the maximumweight matching by searching augmenting path. Compared to the traditional method, our new method liberates the human labor and find maximum-weight matching more precisely.

Assumption
When dealing with assignment problem, we use subsets of vertices to stand for workers and tasks, and edges between two vertex from different subsets means the worker and task can be matched. We assume that each worker's ability for tasks is quantifiable, which reflects in the weights of edges. Meanwhile, each worker can match up with only one task in our assumption.

Bipartite graph
Given a unidirectional graph G = (V, E), if the vertex set can be partitioned into V = P ∪ Q, P and Q are disjoint and all edges in E go between P and Q, then G called a Bipartite graph.

Matching
A Matching is a subset of edges M ⊆ E such that for all vertices v ∈ V, at most one edge of M is incident on v. A maximum matching is a matching M for any matching M , we have |M | ⊆ |M|. And maximum-weight matching is the matching of the largest sum of weights.

Augmenting path
A path is augmenting for a matching M if it alternates between edges in the matching and edges not in the matching, and the first and last vertices are unmatched.

Feasible Labeling
The majority of realistic matching problems are much more complex. This added complexity often stems from graph labeling, where edges or vertices labeled with quantitative attributes, such as weights, costs, preferences or any other specifications, which adds constraints to potential matches.
A common characteristic investigated within a labeled graph is a known as feasible labeling, where the label, or weight assigned to an edge, never surpasses in value to the addition of respective vertices' weights. This property can be thought of as the triangle inequality.
Where X is the set of nodes on one side of the bipartite graph, Y is the other set of nodes, l(x) is the label of x, etc., and w(x, y) is the weight of the edge between x and y.

Proof
Lemma: A feasible labeling on a perfect match returns a maximum-weighted matching.
Suppose each edge e in the graph G connects two vertices, and every vertex is covered exactly once. With this, we have the following inequality: Where M is any perfect matching in G created by a random assignment of vertices, and l(x) is a numeric label to node x. This means that is an upper bound on the cost of any perfect matching. Now let M be a perfect match in G, then So w(M ) ≤ w(M) and M is optimal.

Implementation
The algorithm starts by labeling all nodes on one side of the graph with the maximum weight. This can be done by finding the maximum-weighted edge and labeling the adjacent node with it. Additionally, match the graph with those edges. If a node has two maximum edges, do not connect them.
If the matching is perfect, the algorithm is done as there is a perfect matching of maximum weights. Otherwise, there will be two nodes that are not connected to any other node. If this is the case, begin iterating. Improve the labeling by finding the non-zero label vertex without a match, and try to find the best assignment for it. Formally, the UHA matching algorithm can be executed as defined in the Algorithm 1.
Each step will increase the size of the matching M or it will increase the size of the set of labeled edges, E l . This means that the process will eventually terminate since there are only a limited number of edges in the graph G.
When the process terminates, M will be a perfect matching. By the Kuhn-Munkres theorem, this means that the matching is a maximum-weight matching.

Input:
The labeling l, an equality graph G l = (V, E l ), an initial matching M in G l , and an unmatched vertex v ∈ V and u / ∈ M; Output: Maximum-weighted matching; 1: We will keep track of a candidate augmenting path starting at the vertex u; 2: If the algorithm finds an unmatched vertex v, add on to the existing augmenting path p by adding the u to v segment; 3: Flip the matching by replacing the edges in M with the edges in the augmenting path that are not in M (in other words, the edges in E l − M); 4: S ⊆ X and T ⊆ Y where S and T represent the candidate augmenting alternating path between the matching and the edges not in the matching; 5: Let N l (S) be the neighbors to each node that is in S along edges in E l such that N l (S) = {v|∀u ∈ S : (u, v) ∈ E l }; 6: If N l (S) = T, then we cannot increase the size of the alternating path (and therefore can not further augment), so we need to improve the labeling; 7: Let N l (S) be the neighbors to each node that is in S along edges in E l such that N l (S) = {v|∀u ∈ S : (u, v) ∈ E l }; 8: Let δ l be the minimum of l(u) + l(v) − w(u, v) over all of the u ∈ S and v / ∈ T; 9: Improve the labeling l to l : If r ∈ S, then l (r) = l(r) − δ l ; If r ∈ T, then l (r) = l(r) + δ l ; If r / ∈ S and r / ∈ T, then l (r) = l(r);

CONCLUSION
Due to the inefficiency of the traditional manual method and the brute force method, we propose UHA to efficiently solve the assignment problem. Compared with brute force method, we improve the time complexity from O(N!) to O(N 3 ).
When using this algorithm to solve assignment problem, we start with some Matching M, a valid labeling l, where l is defined as the feasible labelling. Then looking for an augmenting path in M until a best matching is found, if an augmenting path does not exist, improve the labeling and then go back to first step.
However, our method is not suitable for the assignment problems which the tasks have specific orders. In the future, we plan to optimize our algorithm to solve this problem.