Hungarian Method is an efficient method for solving assignment problems.
This method is based on the following principle:
- If a constant is added to, or subtracted from, every element of
a row and/or a column of the given cost matrix of an assignment problem,
the resulting assignment problem has the same optimal solution as
the original problem.
Hungarian Algorithm
The objective of this section is to examine a computational method
- an algorithm - for deriving solutions to the assignment problems.
The following steps summarize the approach:
Steps in Hungarian Method
1. Identify the minimum element in each row and subtract it from every
element of that row.
2. Identify the minimum element in each column and subtract it from
every element of that column.
3. Make the assignments for the reduced matrix obtained from steps
1 and 2 in the following way:
- For each row or column with a single zero value cell that has
not be assigned or eliminated, box that zero value as an assigned cell.
- For every zero that becomes assigned, cross out (X) all other
zeros in the same row and the same column.
- If for a row and a column, there are two or more zeros and one
cannot be chosen by inspection, then you are at liberty to choose
the cell arbitrarily for assignment.
- The above process may be continued until every zero cell is either
assigned or crossed (X).
4. An optimal assignment is found, if the number of assigned cells
equals the number of rows (and columns). In case you have chosen a
zero cell arbitrarily, there may be alternate optimal solutions. If
no optimal solution is found, go to step 5.
5. Draw the minimum number of vertical and horizontal lines necessary
to cover all the zeros in the reduced matrix obtained from step 3
by adopting the following procedure:
- Mark all the rows that do not have assignments.
- Mark all the columns (not already marked) which have zeros in
the marked rows.
- Mark all the rows (not already marked) that have assignments
in marked columns.
- Repeat steps 5 (i) to (iii) until no more rows or columns can
be marked.
- Draw straight lines through all unmarked rows and marked columns.
You can also draw the minimum number of lines
by inspection.
6. Select the smallest element from all the uncovered elements. Subtract
this smallest element from all the uncovered elements and add it to
the elements, which lie at the intersection of two lines. Thus, we
obtain another reduced matrix for fresh assignment.
7. Go to step 3 and repeat the
procedure until you arrive at an optimal assignment.
For the time being we assume that number of jobs is equal to number of machines or persons. Later in the chapter, we will remove this restrictive assumption and consider a special case where no. of facilities and tasks are not equal.