Home > Operation Research calculators > Assignment Problem example (Using Hungarian method)

1. Assignment problem using Hungarian method example ( Enter your problem )
  1. Introduction
  2. Algorithm & Example-1
  3. Example-2
  4. Unbalanced Assignment Problem
  5. Maximization case in Assignment Problem
  6. Multiple optimal solutions in Assignment Problem
  7. Restrictions on Assignment Problem
  8. Restrictions and Unbalanced Assignment Problem
Other related methods
  1. Assignment problem using Hungarian method
  2. Travelling salesman problem using Hungarian method
  3. Travelling salesman branch and bound (penalty) method
  4. Travelling salesman branch and bound method
  5. Travelling salesman nearest neighbor method
  6. Travelling salesman diagonal completion method
  7. Crew assignment problem

3. Example-2
(Previous example)
5. Maximization case in Assignment Problem
(Next example)

4. Unbalanced Assignment Problem





Unbalanced Assignment Problem
If number of rows is not equal to number of columns then it is called Unbalanced Assignment Problem.
So to solve this problem, we have to add dummy rows or columns with cost 0, to make it a square matrix.
Example
Find Solution of Assignment problem using Hungarian method (MIN case)
Work\JobIIIIIIIV
A9141915
B7172019
C9182118
D10121819
E10152116


Solution:
The number of rows = 5 and columns = 4
   `I`  `II`  `III`  `IV`    
 `A` 9141915
 `B` 7172019
 `C` 9182118
 `D` 10121819
 `E` 10152116
   


Here given problem is unbalanced and add 1 new column to convert it into a balance.
   `I`  `II`  `III`  `IV`  `J_5`    
 `A` 91419150
 `B` 71720190
 `C` 91821180
 `D` 101218190
 `E` 101521160
   



Step-1: Find out the each row minimum element and subtract it from that row
   `I`  `II`  `III`  `IV`  `J_5`    
 `A`  9 `9=9-0` 14 `14=14-0` 19 `19=19-0` 15 `15=15-0` 0 `0=0-0` (-0) Minimum element of `1^(st)` row
 `B`  7 `7=7-0` 17 `17=17-0` 20 `20=20-0` 19 `19=19-0` 0 `0=0-0` (-0) Minimum element of `2^(nd)` row
 `C`  9 `9=9-0` 18 `18=18-0` 21 `21=21-0` 18 `18=18-0` 0 `0=0-0` (-0) Minimum element of `3^(rd)` row
 `D`  10 `10=10-0` 12 `12=12-0` 18 `18=18-0` 19 `19=19-0` 0 `0=0-0` (-0) Minimum element of `4^(th)` row
 `E`  10 `10=10-0` 15 `15=15-0` 21 `21=21-0` 16 `16=16-0` 0 `0=0-0` (-0) Minimum element of `5^(th)` row
   


Step-2: Find out the each column minimum element and subtract it from that column.
   `I`  `II`  `III`  `IV`  `J_5`    
 `A`  2 `2=9-7` 2 `2=14-12` 1 `1=19-18` 0 `0=15-15` 0 `0=0-0`
 `B`  0 `0=7-7` 5 `5=17-12` 2 `2=20-18` 4 `4=19-15` 0 `0=0-0`
 `C`  2 `2=9-7` 6 `6=18-12` 3 `3=21-18` 3 `3=18-15` 0 `0=0-0`
 `D`  3 `3=10-7` 0 `0=12-12` 0 `0=18-18` 4 `4=19-15` 0 `0=0-0`
 `E`  3 `3=10-7` 3 `3=15-12` 3 `3=21-18` 1 `1=16-15` 0 `0=0-0`
    (-7) Minimum element of `1^(st)` column (-12) Minimum element of `2^(nd)` column (-18) Minimum element of `3^(rd)` column (-15) Minimum element of `4^(th)` column (-0) Minimum element of `5^(th)` column


Step-3: 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( ).

Step-3: Make assignment in the opporunity cost table
(1) Rowwise cell `(C,J_5)` is assigned, so columnwise cell `(A,J_5)`,`(B,J_5)`,`(D,J_5)`,`(E,J_5)` crossed off.

(2) Columnwise cell `(B,I)` is assigned

(3) Columnwise cell `(D,II)` is assigned, so rowwise cell `(D,III)` crossed off.

(4) Columnwise cell `(A,IV)` is assigned


Rowwise & columnwise assignment shown in table
   `I`  `II`  `III`  `IV`  `J_5`    
 `A` 221 [0] (4) Columnwise cell `(A,IV)` is assigned 0 Columnwise `(A,J_5)` crossed off because
(1) Rowwise cell `(C,J_5)` is assigned
 `B`  [0] (2) Columnwise cell `(B,I)` is assigned524 0 Columnwise `(B,J_5)` crossed off because
(1) Rowwise cell `(C,J_5)` is assigned
 `C` 2633 [0] (1) Rowwise cell `(C,J_5)` is assigned
so columnwise cell `(A,J_5)`,`(B,J_5)`,`(D,J_5)`,`(E,J_5)` crossed off.
 `D` 3 [0] (3) Columnwise cell `(D,II)` is assigned
so rowwise cell `(D,III)` crossed off.
 0 Rowwise `(D,III)` crossed off because
(3) Columnwise cell `(D,II)` is assigned
4 0 Columnwise `(D,J_5)` crossed off because
(1) Rowwise cell `(C,J_5)` is assigned
 `E` 3331 0 Columnwise `(E,J_5)` crossed off because
(1) Rowwise cell `(C,J_5)` is assigned
   


Step-4: Number of assignments = 4, number of rows = 5
Which is not equal, so solution is not optimal.

Step-5: 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 step-6

Step-5: Cover the 0 with minimum number of lines
(1) Mark(✓) row `E` since it has no assignment

(2) Mark(✓) column `J_5` since row `E` has 0 in this column

(3) Mark(✓) row `C` since column `J_5` has an assignment in this row `C`.

(4) Since no other rows or columns can be marked, therefore draw straight lines through the unmarked rows `A,B,D` and marked columns `J_5`


Tick mark not allocated rows and allocated columns
   `I`  `II`  `III`  `IV`  `J_5`    
 `A` 221[0]0
 `B` [0]5240
 `C` 2633[0] ✓(3) (3) Mark(✓) row `C` since column `J_5` has an assignment in this row `C`.
 `D` 3[0]040
 `E` 33310 ✓(1) (1) Mark(✓) row `E` since it has no assignment
    
(2)
 (2) Mark(✓) column `J_5` since row `E` has 0 in this column


Step-6: 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.

Step-6: Develop the new revised table by selecting the smallest element, among the cells not covered by any line (say k = 1)
Subtract k = 1 from every element in the cell not covered by a line.
Add k = 1 to every elment in the intersection cell of two lines.

   `I`  `II`  `III`  `IV`  `J_5`    
 `A`  2 cell covered by a line 2 cell covered by a line 1 cell covered by a line 0 cell covered by a line 1 `1=0+1`
intersection cell of two lines
 `B`  0 cell covered by a line 5 cell covered by a line 2 cell covered by a line 4 cell covered by a line 1 `1=0+1`
intersection cell of two lines
 `C`  1 `1=2-1`
cell not covered by a line
 5 `5=6-1`
cell not covered by a line
 2 `2=3-1`
cell not covered by a line
 2 `2=3-1`
cell not covered by a line
 0 cell covered by a line
 `D`  3 cell covered by a line 0 cell covered by a line 0 cell covered by a line 4 cell covered by a line 1 `1=0+1`
intersection cell of two lines
 `E`  2 `2=3-1`
cell not covered by a line
 2 `2=3-1`
cell not covered by a line
 2 `2=3-1`
cell not covered by a line
 0 `0=1-1`
cell not covered by a line
 0 cell covered by a line
   


Repeat steps 3 to 6 until an optimal solution is obtained.


Step-3: Make assignment in the opporunity cost table
(1) Rowwise cell `(A,IV)` is assigned, so columnwise cell `(E,IV)` crossed off.

(2) Rowwise cell `(B,I)` is assigned

(3) Rowwise cell `(C,J_5)` is assigned, so columnwise cell `(E,J_5)` crossed off.

(4) Columnwise cell `(D,II)` is assigned, so rowwise cell `(D,III)` crossed off.


Rowwise & columnwise assignment shown in table
   `I`  `II`  `III`  `IV`  `J_5`    
 `A` 221 [0] (1) Rowwise cell `(A,IV)` is assigned
so columnwise cell `(E,IV)` crossed off.
1
 `B`  [0] (2) Rowwise cell `(B,I)` is assigned5241
 `C` 1522 [0] (3) Rowwise cell `(C,J_5)` is assigned
so columnwise cell `(E,J_5)` crossed off.
 `D` 3 [0] (4) Columnwise cell `(D,II)` is assigned
so rowwise cell `(D,III)` crossed off.
 0 Rowwise `(D,III)` crossed off because
(4) Columnwise cell `(D,II)` is assigned
41
 `E` 222 0 Columnwise `(E,IV)` crossed off because
(1) Rowwise cell `(A,IV)` is assigned
 0 Columnwise `(E,J_5)` crossed off because
(3) Rowwise cell `(C,J_5)` is assigned
   


Step-4: Number of assignments = 4, number of rows = 5
Which is not equal, so solution is not optimal.

Step-5: 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(✓) column `J_5` since row `E` has 0 in this column

(4) Mark(✓) row `A` since column `IV` has an assignment in this row `A`.

(5) Mark(✓) row `C` since column `J_5` has an assignment in this row `C`.

(6) Since no other rows or columns can be marked, therefore draw straight lines through the unmarked rows `B,D` and marked columns `IV,J_5`


Tick mark not allocated rows and allocated columns
   `I`  `II`  `III`  `IV`  `J_5`    
 `A` 221[0]1 ✓(4) (4) Mark(✓) row `A` since column `IV` has an assignment in this row `A`.
 `B` [0]5241
 `C` 1522[0] ✓(5) (5) Mark(✓) row `C` since column `J_5` has an assignment in this row `C`.
 `D` 3[0]041
 `E` 22200 ✓(1) (1) Mark(✓) row `E` since it has no assignment
    
(2)
 (2) Mark(✓) column `IV` since row `E` has 0 in this column
 
(3)
 (3) Mark(✓) column `J_5` since row `E` has 0 in this column


Step-6: Develop the new revised table by selecting the smallest element, among the cells not covered by any line (say k = 1)
Subtract k = 1 from every element in the cell not covered by a line.
Add k = 1 to every elment in the intersection cell of two lines.

   `I`  `II`  `III`  `IV`  `J_5`    
 `A`  1 `1=2-1`
cell not covered by a line
 1 `1=2-1`
cell not covered by a line
 0 `0=1-1`
cell not covered by a line
 0 cell covered by a line 1 cell covered by a line
 `B`  0 cell covered by a line 5 cell covered by a line 2 cell covered by a line 5 `5=4+1`
intersection cell of two lines
 2 `2=1+1`
intersection cell of two lines
 `C`  0 `0=1-1`
cell not covered by a line
 4 `4=5-1`
cell not covered by a line
 1 `1=2-1`
cell not covered by a line
 2 cell covered by a line 0 cell covered by a line
 `D`  3 cell covered by a line 0 cell covered by a line 0 cell covered by a line 5 `5=4+1`
intersection cell of two lines
 2 `2=1+1`
intersection cell of two lines
 `E`  1 `1=2-1`
cell not covered by a line
 1 `1=2-1`
cell not covered by a line
 1 `1=2-1`
cell not covered by a line
 0 cell covered by a line 0 cell covered by a line
   


Repeat steps 3 to 6 until an optimal solution is obtained.


Step-3: Make assignment in the opporunity cost table
(1) Rowwise cell `(B,I)` is assigned, so columnwise cell `(C,I)` crossed off.

(2) Rowwise cell `(C,J_5)` is assigned, so columnwise cell `(E,J_5)` crossed off.

(3) Rowwise cell `(E,IV)` is assigned, so columnwise cell `(A,IV)` crossed off.

(4) Columnwise cell `(D,II)` is assigned, so rowwise cell `(D,III)` crossed off.

(5) Columnwise cell `(A,III)` is assigned


Rowwise & columnwise assignment shown in table
   `I`  `II`  `III`  `IV`  `J_5`    
 `A` 11 [0] (5) Columnwise cell `(A,III)` is assigned 0 Columnwise `(A,IV)` crossed off because
(3) Rowwise cell `(E,IV)` is assigned
1
 `B`  [0] (1) Rowwise cell `(B,I)` is assigned
so columnwise cell `(C,I)` crossed off.
5252
 `C`  0 Columnwise `(C,I)` crossed off because
(1) Rowwise cell `(B,I)` is assigned
412 [0] (2) Rowwise cell `(C,J_5)` is assigned
so columnwise cell `(E,J_5)` crossed off.
 `D` 3 [0] (4) Columnwise cell `(D,II)` is assigned
so rowwise cell `(D,III)` crossed off.
 0 Rowwise `(D,III)` crossed off because
(4) Columnwise cell `(D,II)` is assigned
52
 `E` 111 [0] (3) Rowwise cell `(E,IV)` is assigned
so columnwise cell `(A,IV)` crossed off.
 0 Columnwise `(E,J_5)` crossed off because
(2) Rowwise cell `(C,J_5)` is assigned
   


Step-4: Number of assignments = 5, number of rows = 5
Which is equal, so solution is optimal

Optimal assignments are
   `I`  `II`  `III`  `IV`  `J_5`    
 `A`  1 Original cost 9 1 Original cost 14 [0] Original cost 19 0 Original cost 15 1 Original cost 0
 `B`  [0] Original cost 7 5 Original cost 17 2 Original cost 20 5 Original cost 19 2 Original cost 0
 `C`  0 Original cost 9 4 Original cost 18 1 Original cost 21 2 Original cost 18 [0] Original cost 0
 `D`  3 Original cost 10 [0] Original cost 12 0 Original cost 18 5 Original cost 19 2 Original cost 0
 `E`  1 Original cost 10 1 Original cost 15 1 Original cost 21 [0] Original cost 16 0 Original cost 0
   


Optimal solution is
WorkJobCost
`A``III`19
`B``I`7
`C``J_5`0
`D``II`12
`E``IV`16
Total54



This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then Submit Here



3. Example-2
(Previous example)
5. Maximization case in Assignment Problem
(Next example)





Share this solution or page with your friends.


 
Copyright © 2024. All rights reserved. Terms, Privacy
 
 

.