• No results found

Assignment Problem 1955; Kuhn

1957; Munkres SAMIRKHULLER

Department of Computer Science,

Assignment Problem

A

69 Keywords and Synonyms

Weighted bipartite matching Problem Definition

Assume that a complete bipartite graph,G(X;Y;XY), with weightsw(x,y) assigned to every edge (x,y) is given. A matching M is a subset of edges so that no two edges in M have a common vertex. A perfect match- ing is one in which all the nodes are matched. As- sume thatjXj=jYj=n. Theweighted matching prob- lemis to find a matching with the greatest total weight, wherew(M) =Pe2Mw(e). SinceGis a complete bipartite

graph, it has a perfect matching. An algorithm that solves the weighted matching problem is due to Kuhn [4] and Munkres [6]. Assume that all edge weights are nonnega- tive.

Key Results

Define afeasible vertex labeling`as a mapping from the set of vertices inGto the reals, where

`(x) +`(y)w(x;y):

Call`(x) the label of vertexx. It is easy to compute a feasi- ble vertex labeling as follows:

8y2Y `(y) = 0 and

8x2X `(x) = max

y2Y w(x;y):

Define theequality subgraph,G`, to be the spanning sub-

graph ofG, which includes all vertices ofGbut only those edges (x,y) that have weights such that

w(x;y) =`(x) +`(y):

The connection between equality subgraphs and maxi- mum-weighted matchings is provided by the following theorem.

Theorem 1 If the equality subgraph, G`, has a perfect matching, M*, then M*is a maximum-weighted matching in G.

In fact, note that the sum of the labels is an upper bound on the weight of the maximum-weighted perfect match- ing. The algorithm eventually finds a matching and a fea- sible labeling such that the weight of the matching is equal to the sum of all the labels.

High-Level Description

The above theorem is the basis of an algorithm for find- ing a maximum-weighted matching in a complete bipar- tite graph. Starting with a feasible labeling, compute the equality subgraph and then find a maximum matching in this subgraph (here one can ignore weights on edges). If the matching found is perfect, the process is done. If it is not perfect, more edges are added to the equality sub- graph by revising the vertex labels. After adding edges to the equality subgraph, either the size of the matching goes up (an augmenting path is found) or the Hungarian tree continues to grow.1In the former case, the phase termi- nates and a new phase starts (since the matching size has gone up). In the latter case, the Hungarian tree, grows by adding new nodes to it, and clearly this cannot happen more thanntimes.

LetSbe the set of free nodes inX. Grow Hungarian trees from each node inS. LetTbe the nodes inYencoun- tered in the search for an augmenting path from nodes in

S. Add all nodes fromXthat are encountered in the search toS.

Note the following about this algorithm:

S=XnS:

T=YnT:

jSj>jTj:

There are no edges fromStoTsince this would imply that one did not grow the Hungarian trees completely. As the Hungarian trees in are grown inG`, alternate nodes in the

search are placed intoSandT. To revise the labels, take the labels inSand start decreasing them uniformly (say, by), and at the same time increase the labels inTby. This ensures that the edges fromStoTdo not leave the equality subgraph (Fig.1).

As the labels inSare decreased, edges (inG) fromSto

Twill potentially enter the equality subgraph,G`. As we

increase, at some point in time, an edge enters the equal- ity subgraph. This is when one stops and updates the Hun- garian tree. If the node fromTadded toTis matched to a node inS, both these nodes are moved toSandT, which yields a larger Hungarian tree. If the node fromTis free, an augmenting path is found and the phase is complete. One phase consists of those steps taken between increases in the size of the matching. There are at mostnphases, wherenis the number of vertices inG(since in each phase

1This is the structure of explored edges when one starts BFS si-

multaneously from all free nodes inS. When one reaches a matched node inT, one only explores the matched edge; however, all edges incident to nodes inSare explored.

70

A

Asynchronous Consensus Impossibility

Assignment Problem, Figure 1

SetsSandTas maintained by the algorithm

the size of the matching increases by 1). Within each phase the size of the Hungarian tree is increased at mostntimes. It is clear that inO(n2) time one can figure out which edge fromStoTis the first to enter the equality subgraph (one simply scans all the edges). This yields anO(n4) bound on the total running time. How to implement it inO(n3) time is now shown.

More Efficient Implementation Define the slack of an edge as follows:

slack(x;y) =`(x) +`(y)w(x;y): Then

= min

x2S;y2T

slack(x;y):

Naively, the calculation ofrequiresO(n2) time. For every

vertexy2T, keep track of the edge with the smallest slack, i. e.,

slack[y] = min

x2Sslack(x;y):

The computation ofslack[y] (for ally2T) requiresO(n2) time at the start of a phase. As the phase progresses, it is

easy to update all theslackvalues inO(n) time since all of them change by the same amount (the labels of the ver- tices inSare going down uniformly). Whenever a nodeu

is moved fromStoSone must recompute the slacks of the nodes inT, requiringO(n) time. But a node can be moved fromStoSat mostntimes.

Thus each phase can be implemented in O(n2) time.

Since there arenphases, this gives a running time ofO(n3).

For sparse graphs, there is a way to implement the algo- rithm inO(n(m+nlogn)) time using min cost flows [1], wheremis the number of edges.

Applications

There are numerous applications of biparitite match- ing, for example, scheduling unit-length jobs with inte- ger release times and deadlines, even with time-dependent penalties.

Open Problems

Obtaining a linear, or close to linear, time algorithm. Recommended Reading

Several books on combinatorial optimization describe al- gorithms for weighted bipartite matching (see [2,5]). See also Gabow’s paper [3].

1. Ahuja, R., Magnanti, T., Orlin, J.: Network Flows: Theory, Algo- rithms and Applications. Prentice Hall, Englewood Cliffs (1993) 2. Cook, W., Cunningham, W., Pulleyblank, W., Schrijver, A.: Combi-

natorial Optimization. Wiley, New York (1998)

3. Gabow, H.: Data structures for weighted matching and near- est common ancestors with linking. In: Symp. on Discrete Algo- rithms, 1990, pp. 434–443

4. Kuhn, H.: The Hungarian method for the assignment problem. Naval Res. Logist. Quart.2, 83–97 (1955)

5. Lawler, E.: Combinatorial Optimization: Networks and Matroids. Holt, Rinehart and Winston (1976)

6. Munkres, J.: Algorithms for the assignment and transportation problems. J. Soc. Ind. Appl. Math.5, 32–38 (1957)

Asynchronous Consensus

Outline

Related documents