The problem is to find the lowest-cost way to assign the jobs.
The problem can be represented in a matrix of the costs of the workers doing the jobs.
The Hungarian method is a combinatorial optimization algorithm that solves the assignment problem in polynomial time and which anticipated later primal-dual methods.
It was developed and published in 1955 by Harold Kuhn, who gave the name "Hungarian method" because the algorithm was largely based on the earlier works of two Hungarian mathematicians: Dénes Kőnig and Jenő Egerváry.
The Hungarian method finds a perfect matching and a potential such that the matching cost equals the potential value. In fact, the Hungarian method finds a perfect matching of tight edges: an edge ) which has the property that the edges oriented from T to S form a matching M.
Initially, y is 0 everywhere, and all edges are oriented from S to T (so M is empty).
To show that every edge in M remains after adjusting y, it suffices to show that for an arbitrary edge in M, either both of its endpoints, or neither of them, are in Z. It is easy to see that if v is in Z then u must be too, since every edge in M is tight.
Now suppose, toward contradiction, that is a tight edge from T to S and is thus in M.
If the goal is to find the assignment that yields the maximum cost, the problem can be altered to fit the setting by replacing each cost with the maximum cost subtracted by the cost.
The algorithm is easier to describe if we formulate the problem using a bipartite graph. It is easy to see that the cost of each perfect matching is at least the value of each potential: the total cost of the matching is the sum of costs of all edges; the cost of each edge is at least the sum of potentials of its endpoints; since the matching is perfect, each vertex is an endpoint of exactly one edge; hence the total cost is at least the total potential.