Business Mathematics and Statistics · Ch 10 — Operations Research (Transportation Problem, Assignment Problems, Decision Theory)
The Hungarian Method
The Hungarian Method
The Hungarian Method
The Hungarian Method finds the optimal one-to-one assignment in a square cost matrix without checking every possible permutation (which grows as and quickly becomes impractical).
Steps of the algorithm
- Row reduction: In every row, subtract that row's smallest entry from every entry in the row.
- Column reduction: In every column of the row-reduced matrix, subtract that column's smallest entry from every entry in the column.
- Cover all zeros in the resulting matrix using the minimum possible number of horizontal and vertical lines.
- Test optimality: If the number of lines used equals (the size of the matrix), an optimal assignment exists among the zeros — go to Step 6. If fewer than lines are needed, go to Step 5.
- Adjust the matrix: Find the smallest uncovered entry. Subtract it from every uncovered entry, and add it to every entry lying at the intersection of two covering lines; leave entries covered by only one line unchanged. Return to Step 3.
- Make the assignment: Select a set of independent zeros — one per row, one per column — from the final matrix. Compute the total cost by summing the corresponding entries in the original (pre-reduction) cost matrix.
Worked example
A company must assign three workers to three jobs at minimum total cost (₹ per job):
| 11 | 17 | 8 | |
| 9 | 7 | 12 | |
| 13 | 16 | 9 |
Step 1 — Row reduction (row minimums: , , ):
| 3 | 9 | 0 | |
| 2 | 0 | 5 | |
| 4 | 7 | 0 |
Step 2 — Column reduction (column minimums: , , ):
| 1 | 9 | 0 | |
| 0 | 0 | 5 | |
| 2 | 7 | 0 |
Step 3 — Cover the zeros: row covers its two zeros (); column covers its two zeros () — all zeros covered using 2 lines.
Step 4 — Test: → not yet optimal.
Step 5 — Adjust: the smallest uncovered entry is . Subtract 1 from every uncovered cell () and add 1 to the intersection cell (, covered by both lines):
| 0 | 8 | 0 | |
| 0 | 0 | 6 | |
| 1 | 6 | 0 |
Step 3 (repeat): column (covers ), column (covers ), row (covers ) — all five zeros covered using 3 lines.
Step 4 (repeat): → optimal. …
A set of zero-cost cells in the reduced matrix chosen so that no two lie in the same row or the same column — exactly one per row and one per column — giving a …