The Assignment Model
Assignment Model
This is a special type of transportation problem in
which each source should have the capacity to
fulfill the demand of any of the destinations.
2
Assignment Model
Many situations where the assignment of people,
machines, and so on may be called for: for example
Assignment of the workers to machines,
Clerks to various checkout counters,
Salesmen to different sales areas,
Service crews to different districts, etc
Assignment is a problem because people possess
varying abilities for performing different jobs and,
therefore those jobs by different people are different.
3
Assignment Model
Thus, in an assignment problem
the question is how the assignment should be
made in order that the total cost involved is
minimized
or
total value is maximized when pay-offs are
given in terms of, say, profit.
4
Assignment Model
The general assignment model with n workers and n
jobs can be written in n n matrix form as
Jobs
W 1 2 j n
O 1 c11 c12 c1j c1n
R 2
K .
E i ci1 cij cin
R .
S n cn1 cn2 cnj cnn
Cost or effectiveness matrix 5
Assignment Model
where
The element cij is the cost of assigning the worker
i to the job j (i, j = 1, 2, , n).
More meaningfully, it may be thought of as the time taken
by the worker i to complete the job j.
Without loss of generality, we assume that the
number of workers is equal to the number of jobs.
If there are more workers, we may introduce dummy jobs
and if there are less workers, we may introduce dummy
workers.
6
Assignment Model
Here the objective is to assign the jobs to the
workers such that the total processing time is
minimized.
One important assumption we make is that
each worker is assigned to one and only one job and
each job is done by one and only one worker.
7
Assignment Model
The assignment model is actually a special case of
the transportation model in which
the sources are workers, the destinations are jobs, and
the number of sources = the number of destinations.
Also from the last assumption we get that the
availabilities at each source equals 1 and the
demand at each destination equals 1, i.e.,
xij = 1 if worker i assigned to job j and
= 0 otherwise.
8
Mathematical formulation
Mathematically an assignment problem can be
stated as:
n n
Minimize the total cost min Z cij xij
i 1 j 1
n
subject to the constraints x
j 1
ij 1 for i 1,..., n
x
i 1
ij 1 for j 1,..., n
where 1, if ith job is assigned the jth job
xij
0,if ith job is not assigned the jth job
9
Assignment Model
Though we can apply the transportation algorithm
to solve the assignment model, a special simple
algorithm, called the Hungarian algorithm, is
used to solve such models.
10
The Hungarian algorithm
Consists of two phases.
First phase: row reductions and column
reductions are carried out.
Second phase: the solution is optimized in
iterative basis.
11
Example 1
Consider the assignment problem:
Job
I II III IV
W
A 8 6 5 7
O
R
B 6 5 3 4
K C 7 8 4 6
E
R D 6 7 5 6
12
The Hungarian algorithmPhase-1
1. If the no. of rows are not equal to the no. of
columns and vice versa, then a dummy row or
column must be added with zero cost elements.
2. Subtract the minimum value of each row from
the entries of that row. Therefore, there will be at
least one zero in each row of this new matrix
which is called the first reduced cost matrix.
3. In the reduced cost matrix, subtract the minimum
value of each column from the entries of that
column. As a result, there would be at least one
zero in each row and in each column of the
second reduced cost matrix.
Treat the resulting matrix as the input for phase 2.
13
The Hungarian algorithmPhase-2
Now we test whether an assignment can be made
as follows. If such an assignment is possible, it is
the optimal assignment.
(a) Examine the first row. If there is only one zero
in that row, surround it by a square ( 0 ) and cross
( ) all the other zeros in the column passing
through the surrounded zero.
Next examine the other rows and repeat the above
procedure for each row having only one zero.
If a row has more than one zero, do nothing to that row
and pass on to the next row.
14
The Hungarian algorithmPhase-2
4. (b) Now repeat the above procedure for columns
of the reduced cost matrix.
If there is no single zero in any row or column of the
reduced matrix, then arbitrarily choose a row or
column having the minimum zeros.
Arbitrarily, choose zero in the row or column and
cross the remaining zeros in that row or column.
Repeat step (a) and (b) until all zeros are either
assigned or crossed out.
15
The Hungarian algorithm
If there is now a surrounded zero in each row and
each column, the optimal assignment is obtained.
If a zero cell is arbitrarily chosen there may be an
alternate optimum.
16
The Hungarian algorithm
If the final stage is reached (that is all the zeros are
either surrounded or crossed) and
if there is no surrounded zero in each row and column, it
is not possible to get the optimal solution at this stage.
We have to do some more work. Again we
illustrate with a numerical example.
17
The Hungarian algorithm
Solve the following unbalanced assignment problem
(Only one job to one man and only one man to
one job):
7 5 8 4
5 6 7 4
8 7 9 8
Since the problem is unbalanced, we add a
dummy worker 4 with cost 0.
18
The Hungarian algorithm
3 1 4 0
1 2 3 0
1 0 2 1
0 0 0 0
Now all the zeros are either surrounded or crossed
but there is no surrounded zero in Row 2. Hence
assignment is NOT possible. We go to the next
step.
19
The Hungarian algorithm
5. Draw the minimum number of vertical and/or
horizontal lines through all the zeros as follows:
Mark ( ) to those rows where no assignment has been
made.
Mark ( ) to those columns which have zeros in the
marked rows.
Mark ( ) rows (not already marked) which have
assignments in marked columns.
The process may be repeated until no more rows or
column can be checked.
Draw straight lines through all unmarked rows and
marked columns.
20
The Hungarian algorithm
6. (a) Select the smallest element, say, u, from
among all elements uncovered by all the lines.
(b) Now subtract this u from all uncovered
elements but add this to all elements that lie at
the intersection of two lines.
7. Go to step 4 and repeat the procedure till an
optimal solution is attained.
21
Example-3
Solve the following assignment problem
I II III IV V
A 3 8 2 10 3
B 8 7 2 9 7
C 6 4 2 7 5
D 8 4 2 3 5
E 9 10 6 9 10
22
Example 3
Solve the following assignment problem
I II III IV V VI
A 9 22 58 11 19 27
B 43 78 72 50 63 48
C 41 28 91 37 45 33
D 74 42 27 49 39 32
E 36 11 57 22 25 18
F 3 56 53 31 17 28
23
Determine the maximum number of
assignments possible:
1. Tick all unassigned rows.
2. If a row is ticked and has a zero, then tick the
corresponding column (if the column is not yet
ticked).
3. If a column is ticked and has an assignment, then
tick the corresponding row (if the row is not yet
ticked).
4. Repeat steps 2 and 3 till no more ticking is possible.
5. Draw lines through unticked rows and ticked
columns. The number of lines represent the
maximum number of assignments possible.
24
Creating a new assignment matrix:
Identify the minimum number (say ) that have no
lines passing through them.
Update the Cij matrix using the following changes:
Cij = Cij , if the number has no lines passing
through it.
Cij = Cij, if the number has one line passing
through it (no change).
Cij = Cij + , if the number has two lines
passing through it.
25
Example:
Solve the following assignment problem
11 7 10 17 10
13 21 7 11 13
13 13 15 13 14
18 10 13 16 14
12 8 16 19 10
26
Theorem 1
Suppose that C = (cij) be the cost matrix for an n n
assignment problem and X = (xij) be an optimal
solution to this problem.
Let C' be the matrix formed by added a constant to
or subtracted from any row or column of the cost
matrix.
Then prove that the optimal solution of new
assignment problem remains unchanged.
27
Constrained assignment problem
Sometimes a worker cannot perform a certain job
or is not to be assigned a particular job.
For example, if a machine cannot be
accommodated in a particular location.
28
Constrained assignment problem
To solve the problem in such situations, we attach
a very highly prohibited cost, say () to the cell in
the matrix so that, there is absolutely no chance to
get the assignment with infinite cost in the optimal
solution.
The resulting problem can be solved using the
usual method.
29
Example 1
You are given about the cost of performing different
jobs by different persons. The job-person
combination marking indicates that the individual
cannot perform the particular job. Using this
information, state (i) the optimal assignment of jobs
and (ii) the cost of such assignment.
J1 J2 J3 J4 J5
M1 27 18 20 21
M2 31 24 21 12 17
M3 20 17 20 16
M4 22 28 20 16 27
30
Example 2
Find the minimum number of hours required to
complete the jobs J1, J2, J3 and J4 by the persons
M1, M2, M3 and M4 under the restriction that job J3
cannot be assigned to person M2. The assignment
table is given by
J1 J2 J3 J4
M1 4 4 10 5
M2 6 6 13 8
M3 5 8 2 2
M4 9 13 7 7
31