Vous êtes sur la page 1sur 9

OPERATIONS RESEARCH

Chapter 2
Transportation and Assignment
Problems

Prof. Bibhas C. Giri

Professor of Mathematics
Jadavpur University
West Bengal, India
E-mail : bcgiri.jumath@gmail.com
MODULE-3: Assignment Problem and Its
Solution by Hungarian Method, and
Travelling Salesman Problem

2.1 Assignment Problem

The assignment problem is a special type of transportation problem where the objec-
tive is to minimize the cost of allocating a number of jobs to a number of persons or fa-
cilities so that one person or facility is assigned to only one job. The assignment model
is useful in solving problems such as assignment of machines to jobs, assignment of
salesmen to sales territories, travelling salesman problem, etc. It may be noted that
with n facilities and n jobs, there are n! possible assignments. One way of finding an
optimal assignment is to consider all the n! possible arrangements, evaluate their total
costs, and select the assignment with minimum cost. However, due to heavy compu-
tational burden, this method is not suitable. For solving assignment problem, we will
discuss an efficient method which was developed by a Hungarian Mathematician D.
Konig.

2.1.1 Mathematical Formulation of Assignment Problem


Consider the problem of assignment of a company which has n machines of different
capacities for performing n different jobs and one machine can only be assigned to
only one job. The objective is to minimize the total cost of assignment. The cost
matrix for this problem is given in Table 2.1. This cost matrix is same as that of a
transportation problem except that the availability at each of the machines is unity
and the requirement at each of the destinations is also unity. In Table 2.1, cij is the cost

2
Machines Jobs Availability
J1 J2 ··· Jn
M1 c11 c12 ··· c1n 1
M2 c21 c22 ··· c2n 1
.. .. .. .. .. ..
. . . . . .
Mn cn1 cn2 ··· cnn 1
Requirement 1 1 ··· 1

Table 2.1: Cost matrix for assignment problem

associated with assigning the ith machine to the jth job. To formulate the assignment
problem in mathematical programming terms, we define the activity variables xij =



 1, if machine i is assigned to job j


 0, otherwise
Then the mathematical model for the assignment problem can be stated as

n ∑
n
Minimize Z = cij xij
i=1 j=1

n
subject to xij = 1 for all i (availability)
j=1
∑n
xij = 1 for all j (requirement)
i=1

and xij = 0 or 1 for all i and j

Theorem 2.1 (Reduction Theorem): In an assignment problem, if we add (or subtract)


a constant to every element of a row (or column) of the cost matrix (cij ), then an assignment
plan that minimizes the total cost for the new cost matrix also minimizes the total cost for
∗ ∑ ∑
the original cost matrix. In other words, if xij = xij minimizes Z = ni=1 nj=1 cij xij with
∑n ∑n ∗ ∗ ∑n ∑n ∗
i=1 xij = 1, j=1 xij = 1; xij = 0 or 1 then xij also minimizes Z = i=1 j=1 cij xij where

cij = cij − ui − vj for all i, j =1, 2, ..., n and ui , vj are real numbers.
Proof: We write

n ∑
n ∑
n ∑
n
Z∗ = ∗
cij xij = (cij − ui − vj )xij
i=1 j=1 i=1 j=1
∑n ∑ n ∑n ∑ n ∑
n ∑
n
= cij xij − ui xij − xij vj
i=1 j=1 i=1 j=1 i=1 j=1
 

n ∑
n  ∑
n ∑
n 
 
=Z− ui − vj since x = x = 1 
 ij ij
i=1 j=1 i=1 j=1

This shows that the minimization of the new objective function Z ∗ yields the same
∑ ∑
solution as the minimization of the origin objective function Z, because ui and vj
are independent of xij .

Corollary 2.1: If (xij ), i = 1, 2, ..., n; j = 1, 2, ..., n is an optimal solution of an assignment



problem with cost (cij ) then it is also optimal solution of the problem with cost (cij ) where


cij = cij for all i, j = 1, 2, · · · , n; j , k

cik = cik − α, where α = a constant.

Proof: The proof is left as an exercise to the reader.

Theorem 2.2: If an assignment problem with cost (cij > 0) is such that minimum
∑n ∑n
i=1 j=1 cij xij = 0 then (xij ) provides an optimal assignment.

Proof: The proof is left as an exercise.

2.2 Hungarian Method for Solving Assignment Problem

The Hungarian method is an efficient method for finding the optimal solution of an
assignment problem. The method works on the principle of reducing the given cost
matrix to a matrix of opportunity costs. Opportunity costs show the relative penalties
associated with assigning a machine to a job. Hungarian method reduces the cost
matrix to the extent of having at least one zero in each row and column so as to make
optimal assignment. In the following, an algorithm for finding the optimal solution
of an assignment problem is given.

Step 1 Identify the minimum element in each row and subtract it from each element
of that row.
Step 2 Identify the minimum element in each column and subtract it from each ele-
ment of that column.

Step 3 Draw the least possible number of horizontal and vertical lines to cover all the
zeros. If the number of lines equals the order of the cost matrix then go to step
5; otherwise, go to step 4.

Step 4 Identify the smallest element among the uncovered elements left after draw-
ing the horizontal and vertical lines in step 3. Subtract this element from all
the uncovered elements and add the same element to the elements lying at the
intersections of the horizontal and vertical lines. Then go to step 3.

Step 5 For each row or column with a single zero, box that zero as an assigned cell. For
every zero that becomes assigned, cross out all other zeros in the same column
or row. If for a row or a column, there are two or more zeros then choose one
cell arbitrarily for assignment. The process is to be continued until every zero
is either assigned with box or crossed out. Cells having a box indicate optimal
assignment. In case a zero cell is chosen arbitrarily then there may be alternate
optimal solution.

Example 2.1: A Company has four men available for work on four separate jobs. Only
one man can work on any one job. The cost of assigning each man to each job is given
in Table 2.2. Assign men to jobs in such a way that the total cost of assignment is
minimum.

Job
I II III IV
A 20 25 22 28
B 15 18 23 17
Person
C 19 17 21 24
D 25 23 24 24

Table 2.2: Table for Example 2.1

Solution: We will use the Hungarian algorithm to solve this problem. Following steps
1 and 2, the cost matrix reduces to the form as shown in Table 2.3.

Now, we draw minimum number of horizontal and vertical lines to cover all the zeros.
The least number of lines is 3 (see Table 2.4 ) which less than 4, the order of the matrix.
I II III IV
A 0 5 1 7
B 0 3 7 1
C 2 0 3 6
D 2 0 0 0

Table 2.3: Reduced cost matrix

The smallest of the uncovered elements is 1. So, we subtract 1 from all the uncovered
elements and add 1 to the elements lying at the intersections of the horizontal and
vertical lines. Table 2.5 shows the revised matrix. Next, we draw the least number of
horizontal and vertical lines covering all the zeros, see Table 2.6. Since the number of
lines = 4 = the order of the matrix, optimality condition is satisfied.

I II III IV
..
0... 5 1 7 I II III IV
A .
.. A 0 4 0 6
0... 3 7 1
. B 0 2 6 0
B .. V
· · · 2· . · · · · · 0· · · · · · 3· · · · · · 6· · · C 3 0 3 6
..
C . D 3 0 0 0
..
· · · 2· . · · · · · 0· · · · · · 0· · · · · · 0· · ·
..
D . Table 2.5

Table 2.4

I II III IV

· · · 0· · · · · · 4· · · · · · 0· · · · · · 6· · · I II III IV
A A 0 4 0
S
 6
· · · 0· · · · · · 2· · · · · · 6· · · · · · 0· · ·
B 0
S
 2 6 0
B V
· · · 3· · · · · · 0· · · · · · 3· · · · · · 6· · · C 3 0 3 6
C D 3 0
S
 0 0
S

· · · 3· · · · · · 0· · · · · · 0· · · · · · 0· · ·
D Table 2.7

Table 2.6

The optimal assignment is obtained as A → I, B → IV , C → II, D → III, see Table 2.7.


The minimum cost of assignment is Rs.(20 + 17 + 17 + 24) = Rs.78.
2.2.1 Variation of Assignment Problem
Unbalanced Assignment Problem - If the number of facilities is not equal to the number
of jobs then the problem is called an unbalanced assignment problem. In such a case,
fictitious rows and/or columns are added in the cost matrix to make it a square matrix.
Then, we apply Hungarian method to find the solution of the balanced assignment
problem.

Maximization Problem - When the facilities are to be assigned to a number of jobs so


as to maximize the overall performance or profit of the assignment, the Hungarian
method can be applied to solve such a maximization problem by converting every
element of the matrix to an opportunity loss. The conversion is accomplished by sub-
tracting all the elements of the given matrix from the highest element. It turns out
that minimizing opportunity loss produces the same assignment solution as the orig-
inal maximization problem.

Restrictions on Assignments - If a particular resource (say, man or machine) cannot be


assigned to perform a particular activity then the cost of performing that particular
activity by that particular resource is considered to be very large (taken usually a large
positive M or ∞) so as to prohibit the entry of this pair of resource-activity into the
final solution.

Negative Cost - If the cost matrix of an assignment problem contains some negative
costs then we add to each element of the rows or columns a quantity sufficient to
make all the cell elements non-negative.

2.2.2 The Travelling Salesman Problem


Suppose that a salesman plans to visit each of n cities once and only once and return
back to the city from where he started. The distance between each pair of cities is
known. The objective is to determine the shortest route which the salesman can take.
Since there are n cities, there are (n − 1)! possible ways for his tour. Let cij be the

 between city i to city j and


distance


 1, if the salesman goes directly from city i to city j (i , j)
xij = 

 0, otherwise
Since each city can be visited only once, we have


n−1
xij = 1, j = 1, 2, ..., n; i , j
i=1
Again, since the salesman has to leave each city except city n, we have

n
xij = 1, i = 1, 2, ..., n − 1; i , j
j=1

The objective function is then


n−1 ∑
n
Minimize Z = cij xij
i=1 j=1

Since cij = cji is not required, therefore, cij = ∞ for i = j. However, all cij ’s must be
non-negative, i.e., cij ≥ 0 and cij + cjk ≥ cjk for all i, j, k.

Example 2.2: A travelling salesman plans to visit five cities I, II, III, IV and V. The
travel time (in hours) between these cities is shown in Table 2.8. How should he sched-

To
I II III IV V
I ∞ 2 5 7 1
II 6 ∞ 3 8 2
From III 8 7 ∞ 4 7
IV 12 4 6 ∞ 5
V 1 3 2 8 ∞

Table 2.8

ule his touring plan in order to minimize the total travel time, if he visits each city once
a week?

Solution: We apply the Hungarian method to solve the given problem treating it as
an assignment problem. The solution is obtained as given in Table 2.9.

I II III IV V
I ∞ 1 3 6 0
II 4 ∞ 0 6 0
III 4 3 ∞ 0 3
IV 8 0 1 ∞ 1
V 0 2 0 7 ∞

Table 2.9
We see that the optimal assignment forms two subloops: I → V → I and II →
III → IV → II. This is not the solution of the traveling salesman problem as the
sequence of cities visited is not in cyclical order. We will now try for the next best
solution which satisfies the restriction of the traveling salesman problem. The next
minimum (non-zero) element in the Table 2.9 is 1 which occurs in the cells (I, II), (IV,
III) and (IV, V). We try make an assignment in any one of these cells. Let us make
an assignment in the cell (I, II) instead of zero assignment in the cell (I,V). Then no
other assignment is possible in the first row and second column. Next, we make an
assignment in the cell (IV, V) instead of the cell (IV, II). Thus we get a feasible solution
as I → II → III → IV → V → I. The assignment is shown in Table 2.10.

I II III IV V
I ∞ 1 3 6 0
II 4 ∞ 0 6 0
III 4 3 ∞ 0 3
IV 8 0 1 ∞ 1
V 0 2 0 7 ∞

Table 2.10

The cost corresponding to the feasible solution is 15. If, instead of making assignment
in the cell (IV, V), we make an assignment in the cell (IV, III) then we do not get a
feasible solution as in that case both II and IV are followed by III.

Vous aimerez peut-être aussi