LPP Vle
LPP Vle
Table of Contents
Introduction............................................................................. 3
HUNGARIAN METHOD FOR SOLVING ASSIGNMENT PROBLEMS ...... 5
Variations of Assignment Problems ........................................... 14
1. Negative cost............................................................... 14
2. Maximisation Problem ................................................... 14
3. Impossible Assignment ................................................. 15
4. Unbalanced Assignment Problem .................................... 15
Exercises ............................................................................... 17
References ............................................................................ 19
Suggested Readings ............................................................... 19
Introduction
In all practical situations manager has to delegate jobs to men or machine to run
his project. Such problems come under the category of Assignment problems.
These problems are similar to Transportation Problems which help us to find the
minimum cost of assigning n jobs to n facilities. Variety of problems come under
this category. For example assigning n periods to n teachers, n beds to n
patients, n horses to n riders at a minimum cost.
n n
Minimize C = ∑ ∑
=i 1=j 1
cij xij
n
Subject to ∑=
x
j =1
ij 1 ∀
= i 1, 2,...., n
∑
i =1
xij 1
= ∀=j 1, 2,...., n
xij = 0, 1
n n
(P1) min C = ∑ ∑
=i 1=j 1
cij xij
n
subject to ∑=
x
j =1
ij 1, ∀ i 1, 2,....n
=
∑=
x
i =1
ij 1, ∀ j 1, 2,....n
=
xij 0,1
= i, j 1,....n
∀=
n n
(P2) min C = ∑ ∑
=i 1=j 1
cij xij
n
subject to ∑=
x
j =1
ij 1, ∀ i 1, 2,....n
=
∑=
x
i =1
ij 1, ∀ j 1, 2,....n
=
xij 0,1
= i, j 1,....n
∀=
Firstly we observe that the constraints of the two problems are same and hence
any feasible solution of one is also feasible solution of the other.
Also corresponding to any common feasible solution, the value of the total
cost differ by a constraint, which can be seen as follows:
n n
C = ∑ ∑
=i 1=j 1
cij xij
n n
= ∑ ∑
=i 1=j 1
(cij ± ai ± bj )xij
n n n n n n
= ∑ ∑
=i 1=j 1
cij xij ± ∑ ∑
=i 1=j 1
ai xij ± ∑ ∑
=i 1=j 1
bj xij
n
n n n
C ± ∑ ai ∑ xij ± ∑ bj ∑ xij
=
=i 1 = j 1 j 1=i 1
=
n n
C ± ∑ ai .1 ± ∑ bj
=
=i 1=j 1
n
( In a finite summation, order of summation can be interchanged and ∑
i =1
xij = 1
n
and ∑
j =1
xij = 1 )
=C+K
n n
± ∑ ai ± ∑ bj
where K =
=i 1=j 1
Now to prove the theorem, consider any optimal solution of (P1), say
*
{x }i , j ±1,...n with optimal cost C * say.
ij
We claim that {xij* } is also an optimal solution of (P2), for if not, then
there exists a feasible solution {xij } of (P2) with corresponding cost C < C * .
Now {xij }i , j =1,....n is also a feasible solution of (P1) with corresponding cost
Ĉ say
ˆ+K
C= C
*
Also C= C* + K
ˆ + K < C* + K
C < C* ⇒ C
⇒ Ĉ < C *
Thus we arrive at a contradiction to the fact that C* is the optimal cost for the
problem (P1).
Hence our assumption that {xij* }i , j =1,....n is not optimal for (P2) is wrong.
Thus, any optimal solution of (P1) is also optimal for (P2).
Similarly, it can be shown that any optimal solution of (P2) is also optimal
for (P1).
Step I. Subtract the minimum cost of each row from each entry of the
corresponding row and modify the table. Again subtract the minimum of
each column from each cost entry of the corresponding column. Modify
the cost-matrix.
Step II. We cover the zeros with minimum number of horizontal and vertical
lines. What should be the minimum number of such lines, is decided as
follows:
(a) Search for a row with a single zero, encircle it and cross out the
zeros in the corresponding column. Repeat the procedure until there
is no row with a single zero. If there are still more zeros then go to
(b).
(b) Search for a column with a single zero, encircle it and cross-out the
zeros in the corresponding row. Repeat this process until there is no
column with a single zero. If there are still more zeros then repeat
(a) and (b). Now if there are still more zeros and no row or no
column with a single zero, then go to (c).
(c) Search for a row with a double zero, encircle the first zero and
cross-out the zeros in the corresponding row and column both. If
there are still more zeros then repeat (a), (b) and if necessary (c)
until all the zeros are either crossed out or encircled.
Step IV. See the minimum of uncovered costs and subtract it from all the
uncovered costs and add the same at the intersection of horizontal and
vertical lines. We modify the table and apply step II. if n2 < n, we
repeat step IV and go on repeating steps II and IV until the number of
horizontal and vertical lines nk = n. Then step III gives the optimal
assignment and optimal cost. Following are some examples solved by
Hungarian method.
Example 2. Find the optimal assignment for a problem with following cost
matrix.
I II III IV V
A 8 4 2 6 1
B 0 9 5 5 4
C 3 8 9 2 6
D 4 3 1 0 3
E 9 5 8 9 5
Subtract the row minima from each row and modify the table
I II III IV V
A 7 3 1 5 0
B 0 9 5 5 4
C 1 6 7 0 4
D 4 3 1 0 3
E 4 0 3 4 0
Subtract the column minima from each column and modify the table
I II III IV V
7 3 0 5 0
0 9 4 5 4
1 6 6 0 4
4 3 0 0 3
4 0 2 4 0
Now to cover the zeros with minimum number of horizontal and vertical lines.
To know the minimum number of such lines, we identify the first row
with single zero, i.e. the second row, encircle the zero and cross-out the zeros in
the corresponding column, if there are any. Then the 3rd row is with a single zero,
encircle it and cross-out the zeros in the corresponding column. Again fourth row
is with a single zero, encircle it and cross out the zeros in the corresponding
column. Then the first row is with a single zero, encircle it and cross out the zeros
in the corresponding column and then the fifth row is with a single zero encircle it
and now there are no more zeros. Minimum number of lines to cover the zeros
= Number of encircled zeros = five = Number of rows and columns of the given
problem. Hence optimal solution is achieved. For the optimal assignment follow
the circled cells in the above tale.
So optimal assignment is
A→V
B→I
C → IV
D → III
E → II
Now go over to the original table to see the cost of the above assignment.
1+0+2+1+5=9
EXAMPLE 3 Five men are available to do five different jobs. From past records
the time that each man takes to do each job is known and is given in the
following table:
J1 J2 J3 J4 J5
I 2 9 2 7 1
II 6 8 7 6 1
III 4 6 5 3 1
IV 4 2 7 3 1
IV 5 3 9 5 1
Find how the men should be assigned to finish all the jobs in minimum
time.
Step I. Subtract the row-minima from each row and modify the table.
1 8 1 6 0
5 7 6 5 0
3 5 4 2 0
3 1 6 2 0
4 2 8 4 0
Now subtract the column minima from each column and modify the
table.
0 7 0 4 0
4 6 5 3 0
2 4 3 0 0
2 0 5 0 0
3 1 2 2 0
Step II We cover the zeros with minimum number of horizontal and vertical
lines and this minimum number is determined as follows:
Search for a row with a single zero, encircle it and cross-out the zeros
in the corresponding column. Continue this until there is no row with a single
zero. But there are still more zeros, so search for a column with a single zero,
encircle it and cross-out the zeros in the corresponding row.
Now there are no more zeros left. We see that number of encircled
zeros is four. So minimum number of lines covering all the zeros is n1 = 4 < 5 =
Total number of rows and columns of the problem.
0 9 0 6 2
2 6 3 3 0
0 4 1 0 0
0 0 3 0 0
1 1 5 2 0
We see that n2 = 4 < 5. Again proceed to the next step. Subtract the
minimum of the uncovered elements i.e. '1' from the uncovered elements and
add the same at the intersection of horizontal and vertical lines and again apply
step II.
0 9 0 6 3
1 5 2 2 0
0 4 1 0 1
0 0 3 0 1
0 0 4 1 0
While applying step II, at a certain stage there is no row with a single zero and no
column with a single zero, so we see that the 3rd row is the first row with double
zero, we encircle the first zero and cross out the zeros in corresponding row and
column both. And then again apply step II until all the zeros are encircled or
crossed off
Now the number of lines n3 = 5 ∴ optimal assignment is reached.
Following the circled cells in the above table the optimal assignment is
I → J3
II → J5
III → J1
IV → J4
V → J2
and minimum cost = 2 + 1 + 4 + 3 + 3 = 13.
Example 4
Solve the following cost minimizing assignment problem:
Machine
I II III IV V VI
A 5 4 7 9 1 2
B 3 8 5 4 9 6
Job
C 2 8 1 9 7 5
D 8 6 5 7 9 3
E 7 4 9 8 3 5
F 5 6 8 7 4 9
Step I: Subtract the row minima from each row and modify the table
I II III IV V VI
A 4 3 6 8 0 1
B 0 5 2 1 6 3
C 1 7 0 8 6 4
D 5 3 2 4 6 0
E 4 1 6 5 0 2
F 1 2 4 3 0 5
Subtract the column minima from each column and modify the table. Only the 2nd
and 4th columns get changed and all others remain unchanged as their
corresponding minima are zero. . So the modified table is as follows:
I II III IV V VI
A 4 2 6 7 0 1
B 0 4 2 0 6 3
C 1 6 0 7 6 4
D 5 2 2 3 6 0
E 4 0 6 4 0 2
F 1 1 4 2 0 5
Now we cover the zeros with minimum number of horizontal and vertical lines.
This minimum number is determined as follows: Search for a row with a single
zero, Ist row is with single zero encircle it and cross out the zeros in the
corresponding column V. Now 3rd row is will single zero, encircle it and there is no
zero in the corresponding column III. Now 4th row is with single zero, encircle it
and there is no zero in the corresponding column VI. Again tth row is with single
zero, encircle it and there is no zero in the corresponding column II. Now as there
is no row with a single zero, we identify the 1st column with a single zero and
cross out the zeros ion the corresponding row (2rnd row). Now all the zeros are
either encircled or crossed and number of circled cells is 5
∴ n1 =5 < 6 (the number of rows and columns of given problem).
Following the same method as above we see that the minimum number of lines
covering the zeros in n2 = 6 = number of rows and columns of the given problem.
A → V
B → IV
C → III
D → VI
E → II
F → I
We go over to the original table to see the corresponding cost of assignment and
optimal cost is 1 + 4 + 1 + 3 + 4 + 5 = 18.
EXAMPLE 5 A team of 5 horses and 5 riders has enter3ed a show contest. The
number of penalty points to be expected when each rider rides any horse is
shown as follows:
R1 R2 R3 R4 R5
H1 5 3 4 7 1
H2 2 3 7 6 5
H3 4 1 5 2 4
H4 6 8 1 2 3
H5 4 2 5 7 1
How should the horses be allotted to the riders so as to minimise expected loss of
the team?
Step I Subtract the row minima from each row and modify the table.
R1 R2 R3 R4 R5
H1 4 2 3 6 0
H2 0 1 5 4 3
H3 3 0 4 1 3
H4 5 7 0 1 2
H5 3 1 4 6 0
Now subtract the column minima from each column and modify the table.
R1 R2 R3 R4 R5
H1 4 2 3 5 0
H2 0 1 5 3 3
H3 3 0 4 0 3
H4 5 7 0 0 2
H5 3 1 4 5 0
Following the method for finding the minimum number of lines, we have four
encircled zeros, therefore n1 =4 < 5 (the total number of rows and columns).
Subtract the minima of the uncovered elements from the uncovered elements and
add the same at the intersection of horizontal and vertical lines. So the modified
table is as follows:
R1 R2 R3 R4 R5
H1 4 1 2 4 0
H2 0 0 4 2 3
H3 4 0 4 0 4
H4 6 7 0 0 3
H5 3 0 3 4 0
Again following the method of covering the zeros with minimum number of
horizontal and vertical lines, we see that
H1 → R5
H2 → R1
H3 → R4
H4 → R3
H5 → R2
and the total loss to the team is obtained by adding the penalty points in the
original table corresponding to the circled cells of last table.
I II III
A 3 4 6
B 7 5 8
C 2 6 9
I II III
A 6 5 3
B 2 4 1
C 7 3 0
Apply Hungairan method. Subtract 3 for 1st row, '1' from 2nd row and '0' from 3rd
row.
3 2 0
1 3 0
7 3 0
Now subtract '1' from 1st column, '2' from 2nd column and '0' from 3rd column.
2 0 0
0 1 0
6 1 0
Minimum number of lines covering all the zeros is three, which is the number of
rows and columns of the given problem.
∴ Optimal assignment is
A → II
B → I
C → III
Optimal profit = 4 + 7 + 9 = 20
2 6 7
3 −5 8
10 −2 4
Solution: Here we add '5' to each cell, so that there is no cell left with −ve cost.
Without loss of generally we can do so for the optimal assignment remains
unaltered when we add constant to any row or column. Then we solve by
Hungarian method and optimal cost is obtained by adding the costs in the original
table corresponding to the circled cells of optimal table.
2. Maximisation Problem
In this case we subtract all the cost entries from the maximum cost of the table
and the convert it into minimisation problem and then solve by Hungarian
method. Finally the optimal objective function value is found by adding all the
costs of the original table corresponding to the circled cells of the optimal table.
3. Impossible Assignment
J1 J2 J3
M1 2 4 5
M2 9 − 6
M3 8 7 −
In such a case we assign a very high cost compared to the given costs
of the table. So here we assign cost '10' to the impossible cells and then solve by
Hungarian method. As it is a minimisation problem, the method takes care that
the optimal assignment does not occur in the impossible cells.
If the problem is m×n type (m < n), then we make it balanced problem by adding
n − m dummy rows with zero cost in all the cells of the rows and then solve by
Hungarian method.
EXAMPLE 7 Find the minimum cost solution for the assignment problem, where
cost co-efficients are as given below:
I II III IV
1 4 5 3 2
2 1 4 −2 3
3 4 2 1 −5
Solution: We see that the above problem is with −ve cost as well as an
unbalanced one.
We first add '5' to each entry, so that the cost co-efficient are all non-
negative, so that the table becomes
9 10 8 7
6 9 3 8
9 7 6 0
Now we make it a balanced one by introducing a dummy row with zero cost in all
the dummy cells
9 10 8 7
6 9 3 8
9 7 6 0
0 0 0 0
Now subtract row minima from each row and modify the table.
2 3 1 0
3 6 0 5
9 7 6 0
0 0 0 0
Subtracting column minima from each column, the table remains the same. Now
to cover the zeros with minimum number of horizontal and vertical lines.Now
apply steps II and IV.
2 3 1 0
3 6 0 5
9 7 6 0
0 0 0 0
0 1 1 0
1 4 0 5
7 5 6 0
0 0 2 2
∴ Optimal assignment is
1 → I
2 → III
3 → IV
4 → II
Exercises
1. Six men are available for six different jobs. From past records, the time in
hours taken by different persons for different jobs are given below
Jobs 1 2 3 4 5 6
Men
A 2 9 2 7 9 1
B 6 8 7 6 14 1
C 4 6 5 3 8 1
D 4 2 7 3 10 1
E 5 3 9 5 12 1
F 9 8 12 13 9 1
Find out an allocation of men to different jobs, which will lead to minimum
operation time.
E→2 F→5
2. A car rental company has one car available at each of its five locations. There
are five customers located in five different cities who requires a each. The
rental payment to the company will begin after customer has received the car.
All the cars of same make and model so that the customer has no preference.
The distance in miles from each car location to each customer are given in
table below. The company would like to assign the cars to the customers in
such a way as to minimise the total distance concerned by the cars before the
cars are delivered to the customers.
Jobs 1 2 3 4 5
Men
A 160 130 175 190 200
B 135 120 130 100 175
C 140 110 155 170 185
D 50 50 80 80 110
E 55 35 70 80 105
Ans. A → 5, B → 3, C → 2 D → 1, E → 4,. Total Miles : 570.
3. Three persons are being considered for 3 open positions. Each person has
been given a rating fo each position as shown in the following table.
I II III
1 7 5 6
2 8 4 7
3 9 6 4
Assign each person to one any only one position in such a way that the sum of
ratings for all 3 persons is maximum.
1 2 3 4 5
A 8 4 2 6 1
B 0 − 5 5 4
C 3 8 9 2 6
D 4 3 1 0 3
E 9 5 8 − 5
Ans. : A → 5, B → 1, C → 4, D → 3, E → 2, Min. cost = 9
1 2 3
I 9 26 15
II 13 27 6
III 35 20 15
IV 18 30 20
Ans. Tak I → M1, Task II → M3; Task III → M2. Total time : 35 hours.
6. Find the minimum cost solution of the following assignment problem, whose
cost coefficients are as given below:
I II III IV
1 4 5 3 2
2 1 4 −2 3
3 4 2 1 −5
Ans. : 1 → I, 2 → III, 3 → IV, Minimum cost = 4 − 2 − 5 = −3.
References
1. Hamdy A. Taha, Operations Research: An Introduction, Eighth edition,
Prentice-Hall India, 2006.
2. G. Hadley, Linear Programming, Narosa Publishing House, 2002.
3. Mokhtar S. Bazaraa, John J. Jarns and Hanif D. Sherali, Linear
Programming and Network flows, Second edition, John Wiley and sons,
India, 2004.
Suggested Readings
1. Louis Brickman, Mathematical Introduction to Linear Programming and
Game Theory, Springer series.
2. Paul R., An Introduction to Linear Programming and Game Theory, Wiley,
1988.