Chapter-4 AP - Formatted
Chapter-4 AP - Formatted
4 : ASSIGNMENT PROBLEM
Introduction
Mathematical formulation of AP
Some theorems
Solution methods of AP
Enumeration method
Simplex method
Transportation method
The Hungarian method
Variations of the AP
Multiple optimal solution
Unbalanced AP
Problem with infeasible (restricted) assignment
Maximization case in AP
Review Exercise
CHAPTER 4
ASSIGNMENT PROBLEM
4.1 Introduction :
Consider the following situation:
A company does custom metalworking for a number of local plants. It currently has three jobs say A,
B and C to be done. It also has three machines say X, Y and Z on which to do the work. Any one of the jobs can
be processed completely on any one of the machines. Furthermore, the cost of processing any job on any
machine is known. It is shown in the following table.
Machine
Job
25
31
35
15
20
24
22
19
17
The assignment of jobs to machines must be on one-to-one basis; that is, each job must be assigned exclusively
to one and only one machine. The objective is to assign the jobs to the machines so as to minimize total cost.
The assignment problem (AP) is a particular sub - class of the transportation problem. It can be stated
in the general form as follows: Given n - facilities, n - jobs and the effectiveness of each facility for each job,
the problem is to assign each facility to one and only one job in such a way that the measure of the effectiveness
is optimized (maximized or minimized). Here the facilities represent sources and the jobs represent the
destinations or sinks in the transportation language.
Associated to each assignment problem there is a matrix called the cost or effectiveness matrix [cij]
where cij is the cost or measure of effectiveness of assigning ith job to the jth facility. An assignment plan is
optimal if it also minimizes (optimizes) the total cost or effectiveness of doing all the jobs.
Distribute m - units (jobs) (one available at each of the origin J1, J2, ..., Jm) to the m - destination
requiring only 1 unit (job) in a way which minimizes the total cost. We can see that the problem is similar to the
transportation problem.
See the following table whose entries give the cost of assigning a particular job to a particular facility
and try to compare it with the transportation table with sources and sinks for which the cost of transporting one
unit of an item is given.
118
Facilities ( destinations)
F1
F2
F3
Fm
ai
J1
C11
C12
C13
C1m
J2
C21
C22
C23
C2m
Job
Jm
Cm1
Cm2
Cm3
Cmm
bj
The only difference between standard assignment and a transportation problem is that here always number of
origins is equal to the number of destinations and at each origin always one unit is available and always one unit
is required at each destination. Here, the cost matrix is always square. Thus, each job can be assigned to only
one facility.
4.2 Mathematical formulation of the AP :
Let xij = 1, if i - th job is assigned to j - th facility
subject to
m m
z= c x
ij ij
i =1 j =1
m
x =1
ij
i =1
m
x =1
ij
j =1
and
(4.1)
, j = 1, 2, ..., m
, i = 1, 2, ..., m
xij = 0 or 1
(4.2)
(4.3)
(4.4)
The condition (4.4) is similar to the condition (3.4) of a transportation problem which states that xij 0.
We can see that the assignment problem is thus a special case of a transportation problem where m = n and ai =
bj = 1. Due to this similarity with the transportation problem, we can handle AP by transportation technique
also.
119
It may however be easily observed that any basic feasible solution of an AP contains (2m - 1) - variables out
of which (m - 1) - variables are zero. Due to this high degree of degeneracy the computational techniques given
in Chapter 3 of a TP become very inefficient. A separate computational method is required to solve AP.
The basic principles on which the solution of an AP is based can be stated as the following two
theorems :
m m
z= c x
ij ij
i =1 j =1
m
m
x = x =1
ij
ij
i =1
j =1
, xij 0 then
m m
z* = c * x where cij* = cij ui vj , for i, j = 1, 2, ..., m and ui , vj
ij ij
i =1 j =1
Proof :
m m
z* = c * x
ij ij
i =1 j =1
m m
= (c u v ) x
ij i
j ij
i =1 j =1
m m
m m
m m
= c x ux v x
ij ij
i ij
j ij
i =1 j =1
i =1 j =1
i =1 j =1
m
m
m
m
= z u x v x
i
ij
j
ij
i =1 j =1
j =1 i =1
m
m
= z u v
i
j
i =1
j =1
m
m
Q x = x =1
ij
ij
i =1
j =1
m
m
*
*
and
v are added / subtracted from z to give z are independent of xij . Therefore, z is
u
i
j
i =1
j =1
minimum when z is minimum. Hence, xij = xij* also minimizes z*.
Now
120
Theorem 4.3.2 : If all cij 0 and we have obtained a solution with xij = xij* such that
m m
*
c x = 0 , then the present solution is an optimal solution
ij ij
i =1 j =1
m m
Proof : As neither of the cij is negative, the value of z = cij xijcannot be negative. Hence its minimum
i =1 j =1
*
value is zero which is attained at xij = xij . Hence, the present solution is optimal.
4.4 Solution methods of AP :
An assignment problem can be solved by following four methods out of which the Hungarian method
is more suitable for solving the assignment problems.
Enumeration method
Simplex method
Transportation problem
Hungarian method.
4.4.1 Enumeration method : It may be noted that with n - facilities and n - jobs there are n ! possible
assignments. One way of finding an optimum assignment is to write all n ! possible arrangements, evaluate their
total cost (in terms of the given measure of effectiveness) and select the assignment with minimum cost. The
method leads to a computational problem of formidable size even when the value of n is moderate. Even for n =
10, the possible number of arrangements is 3628800.
4.4.2 Simplex method : An assignment problem can be solved by simplex method after converting it into zero one integer programming problem. But as there would be n n - decision variables and 2n (i.e. n + n) equalities, it is again difficult to solve it manually.
4.4.3 Transportation method : Article 4.2 clearly depicts why an assignment problem should not be solved by
the transportation method.
4.4.4 The Hungarian method : The Hungarian method was developed by H. Kuhn and is based upon the work
of two Hungarian mathematicians; D. Konig and J. Egervary. For application of the algorithm, it is assumed
that all of the cijs of the starting cost matrix are non-negative integers and the assignment problem is of
minimization case.
121
Step 1 : Subtract the minimum of each row of the effectiveness matrix, from all the elements of the respective
rows.
Step 2 : Further, modify the resulting matrix by subtracting the minimum element of each column from all the
elements of the column.
Step 3 : Draw, the minimum number of horizontal and vertical lines to suppress all the zeros. Let the number of
lines drawn be N.
(i)
(ii)
If N < n, go to step 4.
Step 4 : Find the smallest uncovered element ( that is not covered by the lines drawn). Subtract it from all
uncovered entries. Add it to all entries on the intersection of the two lines.
Step 8 : Exactly one marked zero in each row and each column is obtained. The assignment corresponding
to these marked zeroes will give the optimum assignment.
This method is also known as Floods technique or Reduced Matrix Method.
122
be processed completely on any one of the machines. Furthermore, the cost of processing any job on any
machine is known. It is shown in the following table.
Machine
Jo
b
A
B
C
Suppose we decide to assign job A to machine X. The table shows that the cost of this assignment is 25.
Because this machine X could just as well process job B for 15, it is clear that our assignment of job A to
machine X is not the best decision. Therefore, when we arbitrary assign job A to machine X, we are in effect
sacrificing the opportunity to save 10( i.e 25-15). This sacrifice is more generally referred to as an opportunity
cost. Thus we say that the opportunity cost of the assignment of job A to machine X is 10 with respect to the
lowest-cost assignment for machine X (column X). Similarly a decision to assign job C to machine X would
involve an opportunity cost of 7 (i.e 22-15). Finally, since the assignment of job B to machine X is the best
assignment, we can say that the opportunity cost of this assignment is zero (i.e 15-15). These are the job
opportunity costs with regard to machine X. When we subtract the lowest cost of column Y, from all the costs
in this column, we would have the job-opportunity costs with regard to machine Y. Same way for Z.
In addition to these job opportunity costs, there are the machine-opportunity costs. We could, for example,
assign job A to machine X, Y, or Z. If we assigned job A to machine Y, there would be an opportunity cost
attached to this decision. The assignment of job A to machine Y costs 31, while the assignment of job A to
machine X costs only 25. Therefore, the opportunity cost of assigning job A to machine Y is 6 (i.e 31-25).
Similarly, the opportunity cost of assigning job A to machine Z is 10 (i.e 35-25). The steps 1 and 2 in the above
method are called determining the opportunity costs tables.
Example 4.1 Suppose that there are three applicants for three jobs and that the cost incurred by the applicants to
fill the jobs are given in the following table.
123
J1
J2
J3
only.
Determine the assignment of applicants to jobs such that the total cost is minimized.
Step 1 Applying Step 1 of the Hungarian algorithm, we subtract the minimum of each row from all the entries
of the respective rows.
3
Step 2 We now subtract the minimum of each column from all entries of the respective columns.
2
Step 3 We now draw minimum number of horizontal or vertical lines to suppress all the zeroes.
124
Step 4 Smallest uncovered entry is 1. We subtract it from all uncovered entries and add it to the entry on the
intersection of the two lines.
1
Step 5 We now again draw minimum number of horizontal and vertical lines to suppress all the zeroes.
1
Now we observe that the third row has exactly one zero entry which is uncovered. Mark it with . Cancel that
row and column.
1
It is clear that the first zero of row 2 should be now marked with . Thus, the optimal assignment is
1
125
J2
J3
26
23
27
23
22
24
24
20
23
i.e. persons A, B, and C are assigned jobs J2 , J1 and J3 respectively. Thus x12 = 1, x21 = 1 and x33 = 1 and the rest
of all xij s are zero. This assignment causes the total cost to be minimized at c12 + c21 + c33 = 23 + 23 + 23 = 69.
Example 4.2 Consider the assignment problem shown below. In this problem, 5 different jobs are assigned to 5
different operators such that the total processing time is minimized. The matrix entries represent processing
times in hours.
Operator
O1
O2
O3
O4
O5
Jo
J1
10
12
15
12
J2
16
14
14
11
J3
13
14
J4
12
10
11
13
10
J5
13
15
11
15
5 5
z= c x
ij ij
i =1 j =1
126
Step 3 We now draw minimum number of horizontal or vertical lines to suppress all the zeroes.
2
Step 4 The smallest uncovered entry is 1. We subtract it from all uncovered entries and add it to entries on the
intersection of the lines.
Step 5 We now again draw minimum number of lines to suppress all the zeroes.
127
Now row 5 has exactly one uncovered zero entry. Mark it with .Cancel the respective row and column.
It is clear that row 3 has only one uncovered zero entry. Mark it with and finally row 4 will have the zero
entry in the cell (4, 2).
128
So the final solution will be x15 = 1, x21 = 1, x33 = 1, x42 = 1, x54 = 1 and the rest of xijs are zero and the optimal
assignment is
Job
Operator Time
J1
O5
J2
O1
J3
O3
J4
O2
10
J5
O4
11
43
assignment problem. In such problems, dummy rows (or columns) are added in the matrix so as to complete it
to form a square matrix. The dummy rows or columns will contain all costs elements as zeroes. Now, the
hungarian method may be used to solve the problem.
129
Method 1 : Select the greatest element of the given cost matrix and then subtract each element of the matrix
from the greatest element to get the modified matrix.
Note that the new matrix will be [cij*] where cij* = crk - cij where crk is the greatest element and [cij] is
the original cost matrix.
m m
Now (say) xij = xij* maximizes . z = c x
ij ij
i =1 j =1
Then
m m
z* = c * x
ij ij
i =1 j =1
m m
= ( c c )x
rk ij ij
i =1 j =1
m m
m m
= c x c x
rk ij
ij ij
i =1 j =1
i =1 j =1
m m
= c x z
rk ij
i =1 j =1
So if xij = xij* maximizes z, it also minimizes z*.
Method 2 : Multiply each element of the matrix by (- 1) to get the modified matrix. Note that in this case the
new matrix is [cij*] where cij* = (- cij ). So if
m m
z = c x . Then
ij ij
i =1 j =1
m m
z * = ( c ) x
ij ij
i =1 j =1
Example 4.3 Five different machines can do any of the required five jobs with different profits resulting from
each assignment as given below.
130
Machine
Jo
b
2
3
4
5
Solution : As this is an assignment problem of profit maximization type, we convert it into an assignment
problem of cost minimization type by forming a new modified matrix obtained by subtracting each entry of the
matrix from the greatest entry 62 of the matrix. Resultant problem we will solve as problem of minimization
cost.
Machine
Jo
b
2
131
We now apply the Hungarian method to this problem and perform the step 1 and step 2 of finding the
opportunity cost matrices as follows.
10
12
10
16
13
19
16
13
15
10
15
15
21
28
23
21
24
23
33
33
16
13
15
15
33
21
24
23
Step 4 The smallest uncovered entry is 4. Subtract 4 from all uncovered entries and add it to all entries on the
intersection of the lines.
14
16
11
19
33
17
20
19
132
14
16
11
19
33
17
20
19
Step 6 Mark the zero entry with that occurs exactly once in a row and cancel that row or column.
14
16
11
19
33
17
20
19
After the above steps row 2 has the last entry zero mark it with . Now row 1 will have the third entry zero
uncovered. Mark it with .
So the row 4 will have only one entry in cell (4, 4) with zero. Therefore optimal assignment is done.
A
14
16
11
19
33
17
20
19
Thus, x13 = x25 = x31 = x44 = x52 = 1 and rest all xij = 0.
133
Machine Profit
40
36
40
36
62
214
Example 4.4 Suppose that the cost matrix for assigning four workers to four jobs is as given in the following
table. The three occurrences of M indicate that it is impossible to assign at that cell. Determine the optimal
assignment and the corresponding minimum total cost.
W1
30
23
25
W2
34
16
24
W3
22
19
21
W4
21
23
14
20
M-23
M-26
18
M-8
15
M-16
M-9
M-21
Step 3 Minimum lines required to cover the zeroes = 3 < 4 ( number of rows)
134
Step 4
M-26
11
M-20
M-21
Step 5 As the number of lines required to cover all zeroes = 4 = (number of rows). The optimal assignment can
be made. (left for the reader to fill details)
Worker Job
Total cost
W1
J4
25
W2
J3
16
W3
J2
19
W4
J1
21
81
Example 4.5 Suppose that there are six people applying for fire jobs; and it is desired to fill each job with
exactly one person. The costs for filling the jobs with six people are given in the following table.
J1
J2
J3
J4
J5
P1
27
23
22
24
27
P2
28
27
21
26
24
P3
28
26
24
25
28
P4
27
25
21
24
24
P5
25
20
23
26
26
P6
26
21
21
24
27
Determine the optimal assignment plan, i.e. the plan whereby the cost of assigning the people is minimized.
Solution : This is a case of unbalanced assignment problem. So we introduce a fictitious (dummy) job J6 with all
entries zero. After that we apply the Hungarian method. Here we will not require to do row reduction because
the last column J6 contains all zeroes. So we will perform only column reduction.
135
Step 4 The reader will perform the steps and check for himself
1
Step 6 Zero assigning shows that P3 has to be assigned J6 because there is exactly one zero entry. Again,
canceling that row and column, P1 is assigned to J4. So the new solution is
1
136
Solution 1
Solution 2
Person
Job
Cost
Person
Job
Cost
P1
J4
24
P1
J4
24
P2
J3
21
P2
J5
24
P3
J6
P3
J6
P4
J5
24
P4
J3
21
P5
J1
25
P5
J2
20
P6
J2
21
P6
J1
26
115
115
Here, it may be noted that P3 J6 means P3 is not assigned to any job J1 to J5.
REVIEW EXERCISE
Q. Three jobs A, B, C are to be assigned to three machines X, Y, Z. The processing costs (Rs.) are given in the
matrix below. Find the allocation that minimizes the overall processing cost.
137
Q. Five men are available to do five different jobs. The time (in hours) that each man takes to do each job is
known and is given below. Find the assignment that will minimize the total time taken.
Jobs
Men
Q. Find the minimum cost solution for the 5 5 - assignment problem whose cost coefficients are given below:
Ans. 1 3, 2 2, 3
Q. A company has
138
return in rupees of assigning i - th machine (i = 1, 2, ..., 5) to the j - th job (j = 1, 2, ..., 5). Assign the five jobs to
the five machines so as to maximize the total expected profit.
Q. Solve the assignment problem represented by the following matrix which gives the distances from the
customers A, B, C, D, E to the depots a, b, c, d and e. Each depot has one car. How should the cars be assigned
to the customers so as to minimize the distance traveled ?
160
130
175
190
200
135
120
130
160
175
140
110
125
170
185
50
50
80
80
110
55
35
80
80
105
139
Q. Four engineers are available to design four projects. Engineer 2 is not competent to design the project B.
Given the following time (in days) estimates needed by each engineer to design a given project, find how
should the engineers be assigned to projects so as to minimize the total design time for four projects.
Project
Engineer
12
10
10
10
15
11
10
16
10
Q. A department head has four tasks to be performed and three subordinates. The subordinates differ in
efficiency. The estimate of the time, each subordinate would take to perform, is given below in the matrix. How
should he allocate the tasks, one to each man, so as to minimize the total man - hours ?
Man
Tasks
26
15
II
13
27
III
35
20
15
IV
18
30
20
Ans. I A, II C, III B, time 35 man - hours.
140
Job
II
III
IV
4
Ans. A I, B IV, C III, D II, E V.
Job
31
62
29
42
15
41
12
19
39
55
71
40
17
29
50
41
22
22
35
40
38
42
27
33
19
30
29
16
20
23
72
30
30
50
41
20
Ans. A 5, B 2, C 1, D 3, E 4, F 6.
141