Lect 6-Branch-Bound Hangarian
Lect 6-Branch-Bound Hangarian
J1 J2 J3 J4
A 9 2 7 8
B 6 4 3 7
C 5 8 1 8
D 7 6 9 4
First, select smallest value in each row and subtract it from all
elements of this row (e.g. in row1 the smallest value is 2)
J1 J2 J3 J4
A 7 0 5 6
B 4 1 0 4
C 4 7 0 7
D 3 2 5 0
Third, cover all columns and rows that have zero’s by minimum
number of lines. If the number of covering lines equal to the
number of rows, then begin the assignment process:
J1 J2 J3
A1 5 0 16
A2 1 0 17
A3 0 1 9
J1 J2 J3
A1 5 0 7
A2 1 0 8
A3 0 1 0
J1 J2 J3
A1 5 0 7
A2 1 0 8
A3 0 1 0
Notice that the number of covered lines are less than the number of rows(columns)
We select the smallest value from the uncovered cells and subtract it from all
uncovered cells. This yields
J1 J2 J3 J1 J2 J3
A1 4 0 6 A1 4 0 6
A2 0 0 7 A2 0 0 7
A3 0 1 0 A3 0 1 0
C1 C2 C3 C4 C5
C1 ∞ 0 6 3 2
C2 0 ∞ 4 1 2
C3 0 5 ∞ 1 0
C4 0 4 3 ∞ 5
C5 3 1 0 1 ∞
Step 2: find zeros of each column
C1 C2 C3 C4 C5
C1 ∞ 0 6 2 2
C2 0 ∞ 4 0 2
C3 0 5 ∞ 0 0
C4 0 4 3 ∞ 5
C5 3 1 0 0 ∞
C1 C2 C3 C4 C5
C1 ∞ 0 6 2 2
C2 0 ∞ 4 0 2
C3 0 5 ∞ 0 0
C4 0 4 3 ∞ 5
C5 3 1 0 0 ∞
Step 4 : Covering lines= number of lines
• c1
C1 C2
C2 C4 • c4 • c2
C4 C1
C3 C5 • c3 • c5
C5 C3
As observed from the above figure, we have 2 cycles: the first is c1, c2, c4, c1
and the second is c3, c5, c3. We deal with the small cycle c3, c5, c3. To break the
small cycle into 2 paths c3 c5 put C(3,5)=∞ then resolve the problem. And for
c5 c3 put C(5,3)=∞ and again resolve the problem.
Let’s start with the case C(3,5)=∞
C1 C2 C3 C4 C5
C1 ∞ 0 6 3 2
C2 0 ∞ 4 1 2
C3 0 5 ∞ 1 ∞
C4 0 4 3 ∞ 5
C5 3 1 0 1 ∞
step 1: all rows have zeros. Step 2: find zeros of column no. 5. Then Step 3: find
covering lines
C1 C2 C3 C4 C5
C1 ∞ 0 6 2 0
C2 0 ∞ 4 0 0
C3 0 5 ∞ 0 ∞
C4 0 4 3 ∞ 3
C5 3 1 0 0 ∞
C1 C2 C3 C4 C5
C1 ∞ 1 7 4 3
C2 2 ∞ 6 3 4
C3 1 6 ∞ 2 1
C4 1 5 4 ∞ 6
C5 7 5 ∞ 5 ∞
C1 C2 C3 C4 C5
C1 ∞ 0 6 3 2
C2 0 ∞ 4 1 2
C3 0 5 ∞ 1 0
C4 0 4 3 ∞ 5
C5 2 0 ∞ 0 ∞
C1 C2 C3 C4 C5
C1 ∞ 0 3 3 2
C2 0 ∞ 1 1 2
C3 0 5 ∞ 1 0
C4 0 4 0 ∞ 5
C5 2 0 ∞ 0 ∞
C1 C2 C3 C4 C5
C1 ∞ 0 3 3 2
C2 0 ∞ 1 1 2
C3 0 5 ∞ 1 0
C4 0 4 0 ∞ 5
C5 2 0 ∞ 0 ∞
Now, we have 2 cycles c1, c2, c1 and c3,c5,c4,c3. which is left as an exercise?