Assignment Algorithm (Operations Research) Hungarian Method
Assignment Algorithm (Operations Research) Hungarian Method
ASSIGNMENT PROBLEMS
62.1 INTRODUCTION
Imagine, if in a printing press there is one machine and one
operator is there to operate. How would you employ the worker?
Again suppose there are two machines in the press and two
operators are engaged at different rates to operate them. Which
operator should operate which machine for maximising profit?
62.2 OBJECTIVES
After completion of this lesson you will be able to:
Jobs
1 2 3 ........ j ........ n Table
Persons 1
1 c 11 c 12 c 13 ........ c 1j ........ c 1n
2 c 21 c 22 c 23 ........ c 2j ........ c 2n
. . . . ............ .............
. . . . ............ .............
. . . . ............ .............
. . . . ............ .............
i c i1 c i2 c i3 ........ c ij ........ c in
. . . .
. ............. ............
. . .
. ............. ............
. . .
. ............. .............
. . .
n c n1 c n2 c n3 ........ c nj ........ c nn
where x ij =
{ 1; if ith person is assigned jth work
(a) Either all the zeros are assigned or crossed out, i.e., we get
the maximal assignment.
or
(b) At least two zeros are remained by assignment or by crossing
out in each row or column. In this situation we try to exclude
some of the zeros by trial and error method.
This completes the second step. After this step we can get
two situations.
modify the matrix with the help of step II and find the
required assignment.
This procedure will be more clear by the following examples.
Example A:
Four persons A,B,C and D are to be assigned four jobs I, II, III
and IV. The cost matrix is given as under, find the proper
assignment.
Man A B C D
Jobs
I 8 10 17 9
II 3 8 5 6
III 10 12 11 9
IV 6 13 9 7
Solution :
In order to find the proper assignment we apply the Hungarian
algorithm as follows:
I (A) Row reduction
Man A B C D
Jobs
I 0 2 9 1
II 0 5 2 3
III 1 3 2 0
IV 0 7 3 1
In this way all the zero’s are either crossed out or assigned.
Also total assigned zero’s = 4 (i.e., number of rows or columns).
Thus, the assignment is optimal.
From the table we get I → B; II → C: III → D and IV → A.
Example B:
There are five machines and five jobs are to be assigned and the
associated cost matrix is as follows. Find the proper assignment.
Machines
I II III IV V
A 6 12 3 11 15
B 4 2 7 1 10
Jobs C 8 11 10 7 11
D 16 19 12 23 21
E 9 5 7 6 10
Solution:
In order to find the proper assignment, we apply the Hungarian
method as follows:
IA (Row reduction)
Machines
I II III IV V
A 3 9 0 8 12
B 3 1 6 0 9
Jobs C 1 4 3 0 4
D 4 7 0 11 9
E 4 0 2 1 5
Assignment Problems :: 103
IB (Column reduction)
Machines
I II III IV V
A 2 9 0 8 8
B 2 1 6 0 5
Jobs C 0 4 3 0 0
D 3 7 0 11 5
E 3 0 2 1 1
II (Zero assignment)
Machines
I II III IV V
A 2 9 0 8 8
B 2 1 6 0 5
Jobs C 0 4 3 0 0
D 3 7 0 11 5
E 3 0 2 1 1
From the last table we see that all the zeros are either
assigned or crossed out, but the total number of assignment,
i.e., 4<5 (number of jobs to be assigned to machines). Therefore,
we have to follow step III and onwards as follows:
Step III
Machines
I II III IV V
A 2 9 0 8 8 √
B 2 1 6 0 5
Jobs C 0 4 3 0 0
D 3 7 0 11 5 √
E 3 0 2 1 1
Step IV: Here, the smallest element among the uncovered elements
is 2.
104 :: Mathematics
Note:
If we are given a maximization problem then convert it into
minimization problem, simply, multiplying by -1 to each entry in
the effectiveness matrix and then solve it in the usual manner.
Assignment Problems :: 105
Example C:
Solve the minimal assignment problem whose effectiveness matrix
is given by
A B C D
I 2 3 4 5
II 4 5 6 7
III 7 8 9 8
IV 3 5 8 4
Solution:
In order to find the proper assignment, we apply the Hungarian
method as follows:
Step I (A) A B C D
I 0 1 2 3
II 0 1 2 3
III 0 1 2 1
IV 0 2 5 1
I(B) A B C D
I 0 0 0 2
II 0 0 0 2
III 0 0 0 0
IV 0 1 3 0
Step II:
Since single zero neither exist in columns nor in rows, it is
usually easy to make zero assignments.
While examining rows successively, it is observed that row 4
has two zeros in both cells (4,1) and (4,4).
Now, arbitrarily make an experiemental assignment to one of
these two cells, say (4,1) and cross other zeros in row 4 and
column 1.
106 :: Mathematics
The tables given below show the necessary steps for reaching
the optimal assignment I → B, II → C, III → D, IV → A.
A B C D
I 0 0 0 2
II 0 0 0 2
III 0 0 0 0
IV 0 1 3 0
A B C D
I 0 0 0 2
II 0 0 0 2
III 0 0 0 0
IV 0 1 3 0
A B C D
I 0 0 0 2
II 0 0 0 2
III 0 0 0 0
IV 0 1 3 0
Wrokers
I II III IV
A 5 23 14 8
B 10 25 1 23
Tasks C 35 16 15 12
D 16 23 21 7
a b c d e
A 140 110 155 170 180
B 115 100 110 140 155
C 120 90 135 150 165
D 30 30 60 60 90
E 35 15 50 60 85
START
Row reduction
Column reduction
No Is Yes
zero assignment
possible
TERMINAL QUESTIONS
1. Solve the following assignment problems:
(a) Workers
I II III IV
A 1 19 10 4
Jobs B 6 21 7 19
C 31 12 11 8
D 12 19 17 3
(b) Persons
I II III IV
A 15 17 24 16
Jobs B 10 15 12 13
C 17 19 18 16
D 13 20 16 14
(c) Persons
A B C D
I 8 26 17 11
Jobs II 14 29 5 27
III 40 21 20 17
IV 19 26 24 10
110 :: Mathematics
I II III IV V
A 10 6 4 8 3
B 2 11 7 7 6
C 5 10 11 4 8
D 6 5 3 2 5
E 11 7 10 11 7
I II III IV
1 8 9 10 11
2 10 11 12 13
3 13 14 15 13
4 9 11 14 10
1. I → A, II → C, III → B, IV → D
2. A → e, B → c, C → b, D → a, E → d
2. A → V, B → I, C → IV, D → III, E → II
3. 1 → II, 2 → III, 3 → IV, 4 → I
or
1 → III, 2 → II, 3 → IV, 4 → I