• 沒有找到結果。

Bipartite Matching Problem and Hungarian AlgorithmAlgorithm

MDVQ Transmission Scheme

4.3 Bipartite Matching Problem and Hungarian AlgorithmAlgorithm

The concept of the bipartite matching is to assign “tasks” to “individuals” subject to the constraint that each task can only be assigned to one individual and each individual is assigned to only one task. The objective is to find an assignment which leads to the minimum value of total cost. We only consider the balanced condition for which there are m individuals and m tasks. Figure 4.2 shows the structure of this problem. Each individual is associated with m cost values and so as each task. Let xi,j be a decision variable such that xi,j = 1 if the task j is assigned to the individual i. The bipartite matching problem can be formulated as a linear programming problem written as follows

Generally, this linear programming problem can be solved by the simplex method.

However, due to the additional property of the basic feasible solution, the efficiency of

Figure 4.2: Network structure of the bipartite matching problem.

the simplex method is dramatically reduced. In order to overcome this problem, several alternative algorithms have been proposed to solve the bipartite matching problem.

Among them, the Hungarian algorithm, which was developed by Kuhn in [24], finds a good solution based on the linear programming framework. Note that the linear programming problem is also referred as the primal problem.

According to the asymmetric form of duality, the dual problem of (4.9) is written as follows

maximize

m i=1

λi+

m j=1

µj (4.13)

subject to:

λi+ µj ≤ ci,j, for i = 1, . . . , m; j = 1, . . . , m (4.14)

λi, µj unrestricted (4.15)

where λi and µj are dual variables corresponding to constraints of xi,j in (4.10) and

(4.11), respectively. By applying the complementary slackness condition, we obtain

xi,j(ci,j− λi− µj) = 0, for i = 1, . . . , m; j = 1, . . . , m. (4.16)

From (4.14) and (4.16), we can formulate the feasible solution of the primal problem (4.9) as follows

xi,j = 0, if ci,j − λi− µj > 0

xi,j = 0 or 1, if ci,j − λi− µj = 0 (4.17)

We summarize the solution progress of the bipartite matching problem as follows

1. Find feasible solutions λi and µj of the dual problem (4.13).

2. Classify the indices (i, j) into two sets: P = {(i, j) : ci,j − λi − µj > 0} and Q ={(i, j) : ci,j− λi− µj = 0}.

3. Set xi,j = 0, for all (i, j) ∈ P . According to the primal constraints (4.10) and (4.11), try to find a feasible solution xi,j, for all (i, j)∈ Q. If such a solution can be found, the solution progress terminates. Otherwise, modify the dual problem and return to Step 2.

We use the bipartite matching matrix shown in Figure 4.3 to describe the details of the Hungarian algorithm. Consider the dual solution defined as follows

λi = min

j {ci,j} (4.18)

µj = min

i {ci,j− λi} (4.19)

From (4.18), the dual variable λi represents the smallest element in row i of the bi-partite matching matrix. For each i, all the elements in row i are subtracted by λi. This will generate at least one zero element in every row. We then select the dual variable µj as the smallest element in column j. By subtracting µj from every el-ement in column j, we obtain the reduced matrix, which has entries ci,j − λi − µj.

2

Note that in the reduced matrix, there exists at least one zero in each row and in each column and every entry is nonnegative. Thus, due to ci,j − λi − µj ≥ 0 for all (i, j), this process generates a feasible solution of the dual problem. An ex-ample of determining the reduced matrix of the bipartite matching problem with m = 4 is shown in Figure 4.4. From the reduced matrix, we separate the index (i, j) into two sets: P ={(1, 2), (1, 4), (2, 1), (2, 3), (3, 1), (3, 3), (3, 4), (4, 2), (4, 3), (4, 4)} and Q = {(1, 1), (1, 3), (2, 2), (2, 4), (3, 2), (4, 1)}. According to (4.17), we set xi,j = 0, for all (i, j) ∈ P . The remaining problem is how to decide to set xi,j = 0 or xi,j = 1, for (i, j)∈ Q.

Recall from the definition of the bipartite matching: each task can only be assigned to one individual and each individual is assigned to only one task. This implies that only an assignment can be made in each row and column. Therefore, if there is only one zero in a row or column of the reduced matrix, an assignment must be made in that zero cell. We begin to find such an assignment in the reduced matrix of Figure 4.4(c). For example, as in Figure 4.5, the cell (2, 4) can be selected because it is the only cell which contains the zero in column 4. We then set x2,4 = 1 and place a box around the zero in the cell (2, 4). With this choice, no other assignment can be made in row 2, and therefore we cross out all other zero cells in row 2. This process continues

2 10 3 17

(a) Original matrix (b) Matrix after subtracting

(c) Reduced matrix

Figure 4.4: Determining the reduced matrix.

until all the zero cells are either selected or crossed out. Figure 4.5 shows a final result.

If exactly m assignments have been made, we obtain the optimal solution because the primal feasibility, the dual feasibility, and the complementary slackness are all satisfied.

Figure 4.5 shows a typical example where exactly 4 assignments have been made. Thus, the optimal solution of the bipartite matching problem of Figure 4.4(a) equals

x1,3 = 1 x2,4 = 1 x3,2 = 1 x4,1 = 1

However, if fewer than m assignments are made, it is impossible to find a primal feasible solution corresponding to the chosen dual solution. Thus, we need to modify the

0 8 0 8

2 0 5 0

6 0 2 5

0 2 6 6

Figure 4.5: An optimal bipartite matching.

dual solution to introduce at least one additional zero into the reduced matrix. Assume that only k (k < m) assignments were made, after all the zeros are either selected or crossed out. Figure 4.6 shows such an example with k = 2. Before modifying the dual

(a) Original matrix (b) Reduced matrix 5 7 10

4 9 6

8 6 7

0 2 4

0 5 1

2 0 0

Figure 4.6: Original and reduced matrix.

solution, we need to cover all the zeros in the reduced matrix with k horizontal and/or vertical lines. This can be done by the following steps:

1. Count the number of uncovered zeros in each row and column.

2. Draw a line through the row or column with the most uncovered zeros.

3. Repeat Steps 1 and 2 until all zeros are crossed out.

Figure 4.7 shows a final result. Next, the dual solution is modified as follows:

0 2 4 0 5 1 2 0 0

Figure 4.7: Covering all zeros with k = 2 lines.

1. Replace λi by λi+ c0 for all uncovered rows.

2. Replace µj by µj− co for all covered columns.

where c0 is a positive constant. These two modifications have the following effects on the entries in the reduced matrix:

1. The uncovered entries decrease by c0.

2. The entries which are covered by both a horizontal and vertical line increase by c0.

3. The entries which are covered by a single horizontal or vertical line remain the same.

We summarize these effects in Table 4.1. The next question is how to select c0 to introduce at least one additional zero into the reduced matrix subject to the constraint that the feasibility (i.e., ci,j − λi− µj ≥ 0) of the dual solution remains unchanged. It can be seen from Table 4.1 that only the uncovered entries have the chance to become zeros. Because all of uncovered entries decrease by c0, selecting c0 as the minimum uncovered entry will not only result in at least one new zero into the reduced matrix, but it still also maintain the dual feasibility. The reduced matrix in Figure 4.7 indicates that c0 = 1. Following the modifications summarized in Table 4.1, we have the new

Table 4.1: Effects on the entries in the reduced matrix.

Cell type Change in (ci,j− λi− µj)

Uncovered row ci,j − (λi+ c0)− µj = (ci,j− λi− µj)− c0

Uncovered column Therefore, (ci,j− λi− µj) decreases by c0 Covered row ci,j − λi− µj = ci,j − λi− µj

Uncovered column Therefore, (ci,j− λi− µj) does not change Uncovered row ci,j − (λi+ c0)− (µj − c0) = ci,j − λi− µj

Covered column Therefore, (ci,j− λi− µj) does not change Covered row ci,j − λi− (µj − c0) = (ci,j − λi− µj) + c0 Covered column Therefore, (ci,j− λi− µj) increases by c0

reduced matrix shown in Figure 4.8. Note that an additional zero was introduced in

0 1 3 0 4 0 3 0 0

Figure 4.8: Modified matrix and optimal bipartite matching.

the cell (2, 3) and thus an optimal assignment is available.

Finally, we summarize the Hungarian algorithm in the following steps:

1. Convert the original balanced cost matrix into the reduced one.

2. Apply the complementary slackness condition to make assignments in the re-duced matrix. If exactly m assignments have been made, the optimal solution is obtained and thus the algorithm terminates. However, if only k (k < m) assignments were made, go to Step 3.

3. Cover all the zeros in the reduced matrix with k horizontal and/or vertical lines.

4. Select c0 as the minimum uncovered entry. Add c0 to all the entries which are covered by both a horizontal and vertical line. Subtract c0 from all uncovered entries. Go to Step 2.

相關文件