Hungarian Method Steps
Hungarian Method Steps
Step- If number of rows is not equal to number of columns, then add dummy rows or columns with cost 0, to make it a
1: square matrix.
Step- a. Identify the minimum element in each row and subtract it from each element of that row.
2:
b. Identify the minimum element in each column and subtract it from every element of that column.
b. Identify columns with exactly one unmarked 0. Make an assignment to this single 0 by make a square ( [0] ) around
it and cross off all other 0 in the same rows.
c. If a row and/or column has two or more unmarked 0 and one cannot be chosen by inspection, then choose the cell
arbitrarily.
d. Continue this process until all 0 in rows/columns are either assigned or cross off( ).
Step- (a) If the number of assigned cells = the number of rows, then an optimal assignment is found and In case you have
4: chosen a 0 cell arbitrarily, then there may be an alternate optimal solution exists.
Step- Draw a set of horizontal and vertical lines to cover all the 0
5:
a. Tick(✓) mark all the rows in which no assigned 0.
b. Examine Tick(✓) marked rows, If any 0 cell occurs in that row, then tick(✓) mark that column.
c. Examine Tick(✓) marked columns, If any assigned 0 exists in that columns, then tick(✓) mark that row.
e. Draw a straight line for each unmarked rows and marked columns.
f. If the number of lines is equal to the number of rows then the current solution is the optimal, otherwise goto step-
6
Step-
Repeat steps 3 to 6 until an optimal solution is arrived.
7: