1. Algorithm & Example1
Algorithm
Hungarian Method Steps (Rule)

Step1:

If number of rows is not equal to number of columns, then add dummy rows or columns with cost 0, to make it a square matrix.

Step2:

a. Identify the minimum element in each row and subtract it from each element of that row.
b. Identify the minimum element in each column and subtract it from every element of that column.

Step3:

Make assignment in the opporunity cost table
a. Identify rows with exactly one unmarked 0. Make an assignmment to this single 0 by make a square ( [0] ) around it and cross off all other 0 in the same column.
b. Identify columns with exactly one unmarked 0. Make an assignmment 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 arbitarily.
d. Continue this process until all 0 in rows/columns are either assigned or cross off( ).

Step4:

(a) If the number of assigned cells = the number of rows, then an optimal assignment is found and In case you have chosen a 0 cell arbitrarily, then there may be an alternate optimal solution exists.
(b) If optimal solution is not optimal, then goto Step5.

Step5:

Draw a set of horizontal and vertical lines to cover all the 0
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.
d. Repeat this process until no more rows or columns can be marked.
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 step6

Step6:

Develop the new revised opportunity cost table
a. Select the minimum element, say k, from the cells not covered by any line,
b. Subtract k from each element not covered by a line.
c. Add k to each intersection element of two lines.

Step7:

Repeat stpes 3 to 6 until an optimal solution is arrived.

Example1
Find Solution of Assignment problem using Hungarian method (MIN case)
_{Work}\^{Job}  I  II  III  IV  V  A  10  5  13  15  16  B  3  9  18  13  6  C  10  7  2  2  2  D  7  11  9  7  12  E  7  9  10  4  12 
Solution: The number of rows = 5 and columns = 5
 `I`  `II`  `III`  `IV`  `V`   `A`  10  5  13  15  16   `B`  3  9  18  13  6   `C`  10  7  2  2  2   `D`  7  11  9  7  12   `E`  7  9  10  4  12         
Here given problem is balanced.
Step1: Find out the each row minimum element and subtract it from that row
 `I`  `II`  `III`  `IV`  `V`   `A`  5 `5=105`  0 `0=55`  8 `8=135`  10 `10=155`  11 `11=165`  (5) Minimum element of `1^(st)` row  `B`  0 `0=33`  6 `6=93`  15 `15=183`  10 `10=133`  3 `3=63`  (3) Minimum element of `2^(nd)` row  `C`  8 `8=102`  5 `5=72`  0 `0=22`  0 `0=22`  0 `0=22`  (2) Minimum element of `3^(rd)` row  `D`  0 `0=77`  4 `4=117`  2 `2=97`  0 `0=77`  5 `5=127`  (7) Minimum element of `4^(th)` row  `E`  3 `3=74`  5 `5=94`  6 `6=104`  0 `0=44`  8 `8=124`  (4) Minimum element of `5^(th)` row        
Step2: Find out the each column minimum element and subtract it from that column.
 `I`  `II`  `III`  `IV`  `V`   `A`  5 `5=50`  0 `0=00`  8 `8=80`  10 `10=100`  11 `11=110`   `B`  0 `0=00`  6 `6=60`  15 `15=150`  10 `10=100`  3 `3=30`   `C`  8 `8=80`  5 `5=50`  0 `0=00`  0 `0=00`  0 `0=00`   `D`  0 `0=00`  4 `4=40`  2 `2=20`  0 `0=00`  5 `5=50`   `E`  3 `3=30`  5 `5=50`  6 `6=60`  0 `0=00`  8 `8=80`    (0) Minimum element of `1^(st)` column  (0) Minimum element of `2^(nd)` column  (0) Minimum element of `3^(rd)` column  (0) Minimum element of `4^(th)` column  (0) Minimum element of `5^(th)` column  
Step3: Make assignment in the opporunity cost tablea. Identify rows with exactly one unmarked 0. Make an assignmment to this single 0 by make a square ( [0] ) around it and cross off all other 0 in the same column. b. Identify columns with exactly one unmarked 0. Make an assignmment 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 arbitarily. d. Continue this process until all 0 in rows/columns are either assigned or cross off( ). Step3: Make assignment in the opporunity cost table (1) Rowwise cell `(A,II)` is assigned
(2) Rowwise cell `(B,I)` is assigned, so columnwise cell `(D,I)` crossed off.
(3) Rowwise cell `(D,IV)` is assigned, so columnwise cell `(C,IV)`,`(E,IV)` crossed off.
(4) Columnwise cell `(C,III)` is assigned, so rowwise cell `(C,V)` crossed off.
Rowwise & columnwise assignment shown in table
 `I`  `II`  `III`  `IV`  `V`   `A`  5  [0] (1) Rowwise cell `(A,II)` is assigned  8  10  11   `B`  [0] (2) Rowwise cell `(B,I)` is assigned so columnwise cell `(D,I)` crossed off.  6  15  10  3   `C`  8  5  [0] (4) Columnwise cell `(C,III)` is assigned so rowwise cell `(C,V)` crossed off.  0 Columnwise `(C,IV)` crossed off because (3) Rowwise cell `(D,IV)` is assigned  0 Rowwise `(C,V)` crossed off because (4) Columnwise cell `(C,III)` is assigned   `D`  0 Columnwise `(D,I)` crossed off because (2) Rowwise cell `(B,I)` is assigned  4  2  [0] (3) Rowwise cell `(D,IV)` is assigned so columnwise cell `(C,IV)`,`(E,IV)` crossed off.  5   `E`  3  5  6  0 Columnwise `(E,IV)` crossed off because (3) Rowwise cell `(D,IV)` is assigned  8         
Step4: Number of assignments = 4, number of rows = 5 Which is not equal, so solution is not optimal.
Step5: Draw a set of horizontal and vertical lines to cover all the 0 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.
d. Repeat this process until no more rows or columns can be marked.
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 step6
Step5: Cover the 0 with minimum number of lines (1) Mark(✓) row `E` since it has no assignment
(2) Mark(✓) column `IV` since row `E` has 0 in this column
(3) Mark(✓) row `D` since column `IV` has an assignment in this row `D`.
(4) Mark(✓) column `I` since row `D` has 0 in this column
(5) Mark(✓) row `B` since column `I` has an assignment in this row `B`.
(6) Since no other rows or columns can be marked, therefore draw straight lines through the unmarked rows `A,C` and marked columns `I,IV`
Tick mark not allocated rows and allocated columns
 `I`  `II`  `III`  `IV`  `V`   `A`  5  [0]  8  10  11   `B`  [0]  6  15  10  3  ✓(5) (5) Mark(✓) row `B` since column `I` has an assignment in this row `B`.  `C`  8  5  [0]  0  0   `D`  0  4  2  [0]  5  ✓(3) (3) Mark(✓) row `D` since column `IV` has an assignment in this row `D`.  `E`  3  5  6  0  8  ✓(1) (1) Mark(✓) row `E` since it has no assignment   ✓ (4) (4) Mark(✓) column `I` since row `D` has 0 in this column    ✓ (2) (2) Mark(✓) column `IV` since row `E` has 0 in this column   
Step6: Develop the new revised opportunity cost table a. Select the minimum element, say k, from the cells not covered by any line,
b. Subtract k from each element not covered by a line.
c. Add k to each intersection element of two lines.
Step6: Develop the new revised table by selecting the smallest element, among the cells not covered by any line (say k = 2) Subtract k = 2 from every element in the cell not covered by a line. Add k = 2 to every elment in the intersection cell of two lines.
 `I`  `II`  `III`  `IV`  `V`   `A`  7 `7=5+2` intersection cell of two lines  0 cell covered by a line  8 cell covered by a line  12 `12=10+2` intersection cell of two lines  11 cell covered by a line   `B`  0 cell covered by a line  4 `4=62` cell not covered by a line  13 `13=152` cell not covered by a line  10 cell covered by a line  1 `1=32` cell not covered by a line   `C`  10 `10=8+2` intersection cell of two lines  5 cell covered by a line  0 cell covered by a line  2 `2=0+2` intersection cell of two lines  0 cell covered by a line   `D`  0 cell covered by a line  2 `2=42` cell not covered by a line  0 `0=22` cell not covered by a line  0 cell covered by a line  3 `3=52` cell not covered by a line   `E`  3 cell covered by a line  3 `3=52` cell not covered by a line  4 `4=62` cell not covered by a line  0 cell covered by a line  6 `6=82` cell not covered by a line         
Repeat stpes 3 to 6 until an optimal solution is obtained.
Step3: Make assignment in the opporunity cost table (1) Rowwise cell `(A,II)` is assigned
(2) Rowwise cell `(B,I)` is assigned, so columnwise cell `(D,I)` crossed off.
(3) Rowwise cell `(E,IV)` is assigned, so columnwise cell `(D,IV)` crossed off.
(4) Columnwise cell `(C,V)` is assigned, so rowwise cell `(C,III)` crossed off.
(5) Rowwise cell `(D,III)` is assigned
Rowwise & columnwise assignment shown in table
 `I`  `II`  `III`  `IV`  `V`   `A`  7  [0] (1) Rowwise cell `(A,II)` is assigned  8  12  11   `B`  [0] (2) Rowwise cell `(B,I)` is assigned so columnwise cell `(D,I)` crossed off.  4  13  10  1   `C`  10  5  0 Rowwise `(C,III)` crossed off because (4) Columnwise cell `(C,V)` is assigned  2  [0] (4) Columnwise cell `(C,V)` is assigned so rowwise cell `(C,III)` crossed off.   `D`  0 Columnwise `(D,I)` crossed off because (2) Rowwise cell `(B,I)` is assigned  2  [0] (5) Rowwise cell `(D,III)` is assigned  0 Columnwise `(D,IV)` crossed off because (3) Rowwise cell `(E,IV)` is assigned  3   `E`  3  3  4  [0] (3) Rowwise cell `(E,IV)` is assigned so columnwise cell `(D,IV)` crossed off.  6         
Step4: Number of assignments = 5, number of rows = 5 Which is equal, so solution is optimal
Optimal assignments are
 `I`  `II`  `III`  `IV`  `V`   `A`  7 Original cost 10  [0] Original cost 5  8 Original cost 13  12 Original cost 15  11 Original cost 16   `B`  [0] Original cost 3  4 Original cost 9  13 Original cost 18  10 Original cost 13  1 Original cost 6   `C`  10 Original cost 10  5 Original cost 7  0 Original cost 2  2 Original cost 2  [0] Original cost 2   `D`  0 Original cost 7  2 Original cost 11  [0] Original cost 9  0 Original cost 7  3 Original cost 12   `E`  3 Original cost 7  3 Original cost 9  4 Original cost 10  [0] Original cost 4  6 Original cost 12         
Optimal solution is
Work  Job  Cost  `A`  `II`  5  `B`  `I`  3  `C`  `V`  2  `D`  `III`  9  `E`  `IV`  4   Total  23 
This material is intended as a summary. Use your textbook for detail explanation. Any bug, improvement, feedback then
