The Hungarian method is a combinatorial optimization algorithm which was developed and published by Harold Kuhn in 1955. This method was originally invented for the best assignment of a set of persons to a set of jobs. It is a special case of the transportation problem. The algorithm finds an optimal assignment for a given “n x n” cost matrix. “Assignment problems deal with the question how to assign n items (e.g. jobs) to n machines (or workers) in the best possible way. […] Mathematically an assignment is nothing else than a bijective mapping of a finite set into itself […]” 
The assignment constraints are mathematically defined as:
To make clear how to ...view middle of the document...
- In the third row we have two assignable “0”. We leave it as it is for now.
- In the fourth row we have one assignable “0” therefore we assign it. Consider that we can only assign each worker to each machine hence we can’t allocate any other “0” in the first column.
- Now we go back to the third row which now only has one assignable “0” for worker 2.
As soon as we can assign each worker to one machine, we have the optimal solution. In this case there is no need to precede any further steps. Remember also, if we decide on an arbitrary order in which we start allocating the “0”s then we may get into a situation where we have 3 assignments as against the possible 4. If we assign a “0” in the third row to worker 1 we wouldn’t be able to allocate any “0”s in column one and row two.
The rule to assign the “0”:
- If there is an assignable “0”, only 1 assignable “0” in any row or any column, assign it.
- If there are more than 1, leave it and proceed.
This rule would try to give us as many assignments as possible.
Now there are also cases where you won’t get an optimal solution for a reduced matrix after one iteration. The following example will explain it.
Example 2 – Minimization problem
In this example we have the fastest taxi company that has to assign each taxi to each passenger as fast as possible. The numbers in the matrix represent the time to reach the passenger.
We proceed as in the first example.
Step 1 – Subtract the row minimum from each row.
Step 2 – Subtract the column minimum from each column from the reduced matrix.
Step 3 – Assign one “0” to each row & column.
Now we have to assign the “0”s for every row respectively to the rule that we described earlier in example 1.
- In the first row we have one assignable “0” therefore we assign it and no other allocation in column 2 is possible.
- In the second row we have one assignable “0” therefore we assign it.
- In the third row we have several assignable “0”s. We leave it as it is for now and proceed.
- In the fourth and fifth row we have no assignable “0”s.
Now we proceed with the allocations of the “0”s for each column.
- In the first column we have one assignable “0” therefore we assign it. No other “0”s in row 3 are assignable anymore.
Now we are unable to proceed because all the “0”s either been assigned or crossed. The crosses indicate that they are not fit for assignments because assignments are already made.
We realize that we have 3 assignments for this 5x5 matrix. In the earlier example we were able to get 4 assignments for a 4x4 matrix. Now we have to follow another procedure to get the remaining 2 assignments (“0”).
Step 4 – Tick all unassigned rows.
Step 5 – If a row is ticked and has a “0”, then tick the corresponding column (if the column is not yet ticked).
Step 6 – If a column is ticked and has an assignment, then tick the...