Hungarian Method

Work in progress. This note is still being written and incomplete.

1 min read Last updated Fri Aug 28 2026 11:38:57 GMT+0000 (Coordinated Universal Time)

Solves a balanced assignment problem in polynomial time, avoiding the degeneracy the transportation methods would hit.

Steps

  • Row reduction: subtract the minimum entry of each row from every entry in that row.
  • Column reduction: subtract the minimum entry of each column from every entry in that column.
  • Cover all 0s in the resulting matrix using the minimum number of horizontal and vertical lines.
  • If the number of lines equals nn, an optimal assignment exists among the 0s. Stop.
  • Otherwise, find the smallest uncovered entry. Subtract it from every uncovered entry, and add it to every entry covered twice (at a line intersection). Repeat the covering step.

Reading the Assignment

Once nn lines are needed, select nn independent 0s (1 per row and column) by assigning rows/columns with a unique 0 first, then resolving remaining choices, until every agent is assigned a task.

Was this helpful?