Hungarian Method

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

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.

Written by September 16, 2026 1 min read
Was this helpful?