Hungarian Method
Hungarian Method
Assume we have ‘n’ jobs to do on ‘m’ machines (i.e., one job to one
machine). Our goal is to assign jobs to machines for the least amount of
money possible (or maximum profit). Based on the notion that each
machine can accomplish each task, but at variable levels of efficiency.
Check to see if the number of rows and columns are equal; if they are, the
assignment problem is considered to be balanced. Then go to step 1. If it
is not balanced, it should be balanced before the algorithm is applied.
Step 1 – In the given cost matrix, subtract the least cost element of each
row from all the entries in that row. Make sure that each row has at least
one zero.
Examine the columns one by one until you find one with precisely
one unmarked zero. Encircle this single unmarked zero and cross
any other zero in its row to make an assignment to it. Continue until
you’ve gone through all of the columns.
Step 5 – Draw the least number of straight lines to cover all of the zeros
as follows:
(b) Label the columns with zeros in marked rows (if they haven’t already
been marked).
(c) Highlight the rows that have assignments in indicated columns (if they
haven’t previously been marked).
(d) Continue with (b) and (c) until no further marking is needed.
(f) Simply draw the lines through all rows and columns that are not
marked. If the number of these lines equals the order of the matrix, then
the solution is optimal; otherwise, it is not.
Step 6 – Find the lowest cost factor that is not covered by the straight
lines. Subtract this least-cost component from all the uncovered elements
and add it to all the elements that are at the intersection of these straight
lines, but leave the rest of the elements alone.
Step 7 – Continue with steps 1 – 6 until you’ve found the highest suitable
assignment.
Example 1
The present assignment is optimal because each row and column contain
precisely one encircled zero.
X1 X2 X3 X X
4 5
A 15 29 35 20 38
B 21 27 33 17 36
C 17 25 37 15 42
D 14 31 39 21 40
E 19 30 40 19 18
Row Reduction:
X1 X2 X3 X X
4 5
A 0 14 20 5 23
B 4 10 16 0 19
C 2 10 22 0 27
D 0 17 25 7 26
E 1 12 22 1 0
Column Reduction :
X1 X2 X3 X X
4 5
A 0 14 20 5 23
B 4 10 16 0 19
C 2 10 22 0 27
D 0 17 25 7 26
E 1 12 22 1 0
X1 X2 X3 X X
4 5
A 0 14 20 5 23
B 4 10 16 0 19
C 2 10 22 0 27
D 0 17 25 7 26
E 1 12 22 1 0