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

6. Multiple optimal solutions in Assignment Problem
(Previous example)
8. Restrictions and Unbalanced Assignment Problem
(Next example)

7. Restrictions on Assignment Problem





Restrictions on Assignment Problem
Sometimes it may happen that a particular resource can not be assigned to a particular activity.
In such case cost is considered to be very large (say M), so as to prohibit the entry into the final solution.
Example
Find Solution of Assignment problem using Hungarian method (MAX case)
Work\JobABCDE
A82x54
B109284
C5496x
D36287
E561043


Solution:
The number of rows = 5 and columns = 5
   `A`  `B`  `C`  `D`  `E`    
 `A` 82M54
 `B` 109284
 `C` 5496M
 `D` 36287
 `E` 561043
   


Here the problem is of Maximazition type and convert it into minimization by substracting it from maximum value 10
   `A`  `B`  `C`  `D`  `E`    
 `A`  2 `2=10-8` 8 `8=10-2`M 5 `5=10-5` 6 `6=10-4`
 `B`  0 `0=10-10` 1 `1=10-9` 8 `8=10-2` 2 `2=10-8` 6 `6=10-4`
 `C`  5 `5=10-5` 6 `6=10-4` 1 `1=10-9` 4 `4=10-6`M
 `D`  7 `7=10-3` 4 `4=10-6` 8 `8=10-2` 2 `2=10-8` 3 `3=10-7`
 `E`  5 `5=10-5` 4 `4=10-6` 0 `0=10-10` 6 `6=10-4` 7 `7=10-3`
   


Here given problem is balanced.

Step-1: Find out the each row minimum element and subtract it from that row
   `A`  `B`  `C`  `D`  `E`    
 `A`  0 `0=2-2` 6 `6=8-2` M M 3 `3=5-2` 4 `4=6-2` (-2) Minimum element of `1^(st)` row
 `B`  0 `0=0-0` 1 `1=1-0` 8 `8=8-0` 2 `2=2-0` 6 `6=6-0` (-0) Minimum element of `2^(nd)` row
 `C`  4 `4=5-1` 5 `5=6-1` 0 `0=1-1` 3 `3=4-1` M M (-1) Minimum element of `3^(rd)` row
 `D`  5 `5=7-2` 2 `2=4-2` 6 `6=8-2` 0 `0=2-2` 1 `1=3-2` (-2) Minimum element of `4^(th)` row
 `E`  5 `5=5-0` 4 `4=4-0` 0 `0=0-0` 6 `6=6-0` 7 `7=7-0` (-0) Minimum element of `5^(th)` row
   


Step-2: Find out the each column minimum element and subtract it from that column.
   `A`  `B`  `C`  `D`  `E`    
 `A`  0 `0=0-0` 5 `5=6-1` M M 3 `3=3-0` 3 `3=4-1`
 `B`  0 `0=0-0` 0 `0=1-1` 8 `8=8-0` 2 `2=2-0` 5 `5=6-1`
 `C`  4 `4=4-0` 4 `4=5-1` 0 `0=0-0` 3 `3=3-0` M M
 `D`  5 `5=5-0` 1 `1=2-1` 6 `6=6-0` 0 `0=0-0` 0 `0=1-1`
 `E`  5 `5=5-0` 3 `3=4-1` 0 `0=0-0` 6 `6=6-0` 6 `6=7-1`
    (-0) Minimum element of `1^(st)` column (-1) Minimum element of `2^(nd)` column (-0) Minimum element of `3^(rd)` column (-0) Minimum element of `4^(th)` column (-1) 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 `(A,A)` is assigned, so columnwise cell `(B,A)` crossed off.

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

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

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


Rowwise & columnwise assignment shown in table
   `A`  `B`  `C`  `D`  `E`    
 `A`  [0] (1) Rowwise cell `(A,A)` is assigned
so columnwise cell `(B,A)` crossed off.
5M33
 `B`  0 Columnwise `(B,A)` crossed off because
(1) Rowwise cell `(A,A)` is assigned
 [0] (2) Rowwise cell `(B,B)` is assigned825
 `C` 44 [0] (3) Rowwise cell `(C,C)` is assigned
so columnwise cell `(E,C)` crossed off.
3M
 `D` 516 [0] (4) Columnwise cell `(D,D)` is assigned
so rowwise cell `(D,E)` crossed off.
 0 Rowwise `(D,E)` crossed off because
(4) Columnwise cell `(D,D)` is assigned
 `E` 53 0 Columnwise `(E,C)` crossed off because
(3) Rowwise cell `(C,C)` is assigned
66
   


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 `C` since row `E` has 0 in this column

(3) Mark(✓) row `C` since column `C` 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 `C`


Tick mark not allocated rows and allocated columns
   `A`  `B`  `C`  `D`  `E`    
 `A` [0]5M33
 `B` 0[0]825
 `C` 44[0]3M ✓(3) (3) Mark(✓) row `C` since column `C` has an assignment in this row `C`.
 `D` 516[0]0
 `E` 53066 ✓(1) (1) Mark(✓) row `E` since it has no assignment
    
(2)
 (2) Mark(✓) column `C` 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 = 3)
Subtract k = 3 from every element in the cell not covered by a line.
Add k = 3 to every elment in the intersection cell of two lines.

   `A`  `B`  `C`  `D`  `E`    
 `A`  0 cell covered by a line 5 cell covered by a line M `M=M+3`
intersection cell of two lines
 3 cell covered by a line 3 cell covered by a line
 `B`  0 cell covered by a line 0 cell covered by a line 11 `11=8+3`
intersection cell of two lines
 2 cell covered by a line 5 cell covered by a line
 `C`  1 `1=4-3`
cell not covered by a line
 1 `1=4-3`
cell not covered by a line
 0 cell covered by a line 0 `0=3-3`
cell not covered by a line
 M `M=M-3`
cell not covered by a line
 `D`  5 cell covered by a line 1 cell covered by a line 9 `9=6+3`
intersection cell of two lines
 0 cell covered by a line 0 cell covered by a line
 `E`  2 `2=5-3`
cell not covered by a line
 0 `0=3-3`
cell not covered by a line
 0 cell covered by a line 3 `3=6-3`
cell not covered by a line
 3 `3=6-3`
cell not 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,A)` is assigned, so columnwise cell `(B,A)` crossed off.

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

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

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

(5) Rowwise cell `(C,D)` is assigned


Rowwise & columnwise assignment shown in table
   `A`  `B`  `C`  `D`  `E`    
 `A`  [0] (1) Rowwise cell `(A,A)` is assigned
so columnwise cell `(B,A)` crossed off.
5M33
 `B`  0 Columnwise `(B,A)` crossed off because
(1) Rowwise cell `(A,A)` is assigned
 [0] (2) Rowwise cell `(B,B)` is assigned
so columnwise cell `(E,B)` crossed off.
1125
 `C` 11 0 Columnwise `(C,C)` crossed off because
(3) Rowwise cell `(E,C)` is assigned
 [0] (5) Rowwise cell `(C,D)` is assignedM
 `D` 519 0 Rowwise `(D,D)` crossed off because
(4) Columnwise cell `(D,E)` is assigned
 [0] (4) Columnwise cell `(D,E)` is assigned
so rowwise cell `(D,D)` crossed off.
 `E` 2 0 Columnwise `(E,B)` crossed off because
(2) Rowwise cell `(B,B)` is assigned
 [0] (3) Rowwise cell `(E,C)` is assigned
so columnwise cell `(C,C)` crossed off.
33
   


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

Optimal assignments are
   `A`  `B`  `C`  `D`  `E`    
 `A`  [0] Original cost 8 5 Original cost 2 M Original cost M 3 Original cost 5 3 Original cost 4
 `B`  0 Original cost 10 [0] Original cost 9 11 Original cost 2 2 Original cost 8 5 Original cost 4
 `C`  1 Original cost 5 1 Original cost 4 0 Original cost 9 [0] Original cost 6 M Original cost M
 `D`  5 Original cost 3 1 Original cost 6 9 Original cost 2 0 Original cost 8 [0] Original cost 7
 `E`  2 Original cost 5 0 Original cost 6 [0] Original cost 10 3 Original cost 4 3 Original cost 3
   


Optimal solution is
WorkJobCost
`A``A`8
`B``B`9
`C``D`6
`D``E`7
`E``C`10
Total40



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



6. Multiple optimal solutions in Assignment Problem
(Previous example)
8. Restrictions and Unbalanced Assignment Problem
(Next example)





Share this solution or page with your friends.


 
Copyright © 2023. All rights reserved. Terms, Privacy
 
 

.