@4 - Assignment Problem
@4 - Assignment Problem
@4 - Assignment Problem
Person
I1 I2 I3 I4
J1 5 9 3 6
Job J2 8 7 8 2
J3 6 10 12 7
J4 3 10 8 6
A solution to the assignment problem is feasible when every task is assigned to exactly one resource
and every resource gets exactly one task.
SOLVING THE ASSIGNMENT PROBLEM—HUNGARIAN ALGORITHM
The Hungarian algorithm consists of the four steps below. The first two steps are executed
once, while Steps 3 and 4 are repeated until an optimal assignment is found. The input of the
algorithm is n by n square matrix with only nonnegative elements.
Step 1: Subtract row minima
For each row, find the lowest element and subtract it from each element in that row.
Step 2: Subtract column minima
Similarly, for each column, find the lowest element and subtract it from each element in that
column.
Step 3: Algorithm for allocation
• If a row (or column) has exactly one assignable zero, make the assignment. The other zeros
in the corresponding column (or row) is not assignable.
• If a row or column has more than one assignable zero, do not make any assignment. Move
to the next row or column and go to Step l. Terminate when no assignment is possible.
If total number of assignment is equal to number of row or column, then it is an optimal
solution otherwise go to next step.
Step 4: Cover all zeros with a minimum number of lines
i. Tick all unassigned rows.
ii. If a row is ticked and has a zero, then tick the corresponding
column (if the column is not yet ticked).
iii. If a column is ticked and has an assignment, then tick the
corresponding row (if the row is not yet ticked).
iv. Repeat Steps ii. and iii. till no more ticking is possible.
v. Draw lines through unticked rows and ticked columns. The number
of lines represent the maximum number of assignments possible.
Step 5: Create additional zeros
Find the smallest element (call it k) that is not covered by a line in Step
4. Subtract k from all uncovered elements and add k to all elements that
are covered twice.
Example: 1 Person
I1 I2 I3 I4
J1 5 9 3 6
Job J2 8 7 8 2
J3 6 10 12 7
J4 3 10 8 6
For the cost matrix in above Table, the row minimum in the four rows are 3, 2, 6 and
3, respectively.
Row reductions Column Reductions
Person Person
I1 I2 I3 I4 I1 I2 I3 I4
J1 5-3 = 2 9-3=6 3-3=0 6-3=3 J1 2 2 0 3
Job J2 8-2=6 7-2=5 8-2=6 2-2=0 Job J2 6 1 6 0
J3 6-6=0 10-6=4 12-6=6 7-6=1 J3 0 0 6 1
J4 3-3=0 10-3=7 8-3=5 6-3=3 J4 0 3 5 3
I1 I2 I3 I4
J1 2 2 0 3
Job
J2 6 1 6 0
J3 0 0 6 1
J4 0 3 5 3
Operator
O1 O2 O3 O4
J1 2 10 9 7
Job J2 15 4 14 8
J3 13 14 16 11
J4 3 15 13 8
J1 J2 J3 J4
P1 12 30 21 15
P2 18 33 9 31
P3 44 25 24 21
P4 23 30 28 14
Example:2 Let us consider a 5-job 5-machine assignment problem with
the cost coefficients shown in following table
Row reductions
Machine Machine
M1 M2 M3 M4 M5 M1 M2 M3 M4 M5
J1 160 130 175 190 200 J1 30 0 45 60 70
J2 135 120 130 160 175 J2 15 0 10 40 55
Job Job
J3 140 110 155 170 185 J3 30 0 45 60 75
J4 50 50 80 80 110 J4 0 0 30 30 60
J5 55 35 70 80 105 J5 20 0 35 45 70
Solution: subtracting the row minimum from every element of each row. The row
minima are 130, 120, 110, 50 and 35, respectively. We get the matrix shown in
following Table at the end of this operation.
Machine
M1 M2 M3 M4 M5
J1 30 0 35 30 15
J2 15 0 0 10 0
Job J3 30 0 35 30 20
J4 0 0 20 0 5
J5 20 0 25 15 15
Applying Procedure to obtain initial set of assignments we assign Cl2 (Row l has only one
zero). We cross C22 ,C32, C42 and C52 and make them unassignable. We assign C23(Row 2
has only one zero). We leave Row 3 and 5 because it has no assignable zero and Rows 4
because it has two assignable zero. Applying this procedure to the columns, we assign
C23, C4l and cross the remaining zero of these columns and the procedure stops. We have
three assignments and, therefore, we do not have a feasible solution. We also observe that
every zero in the matrix is either assigned or crossed (not eligible for assignment).
Machine
M1 M2 M3 M4 M5
J1 30 0 35 30 15
J2 15 0 0 10 0
Job
J3 30 0 35 30 20
J4 0 0 20 0 5
J5 20 0 25 15 15
This solution is not optimal, so we need to go to the next step (step 4) and Cover all zeros
with a minimum number of lines:
tick Rows 3 and 5 (unassigned rows). Tick Column 2 (it has zero) and then tick Row l
(assignment Xl2). We draw lines through Rows 2 and 4 and Column 2. So, the maximum
assignments possible is three.
Machine
M1 M2 M3 M4 M5
J1 30 0 35 30 15 √
J2 15 0 0 10 0
Job
J3 30 0 35 30 20 √
J4 0 0 20 0 5
J5 20 0 25 15 15 √
√
all zeros in the previous Table have lines passing through them. Now we need to go to
next step (step 5).
The smallest element (call it k) that is not covered by a line in previous step is 15.
Subtract 15 from all uncovered elements and add 15 to all elements that are covered
twice. Now we have following matrix.
Machine
M1 M2 M3 M4 M5
J1 15 0 20 15 0
J2 15 15 0 10 0
J3 15 0 20 15 5
Job
J4 0 15 20 0 5
J5 5 0 10 0 0
Now again repeat the procedure of allocation we have following allocation:
Machine
M1 M2 M3 M4 M5
J1 15 0 20 15 0
J2 15 15 0 10 0
Job J3 15 0 20 15 5
J4 0 15 20 0 5
J5 5 0 10 0 0
The profit maximization assignment problems are solved by converting them into a
cost minimization problem in either of the following two ways:
(i) Put a negative sign before each of the elements in the profit matrix in order to
convert the profit values into cost values.
(ii) Locate the largest element in the profit matrix and then subtract all the elements of
the matrix from the largest element including itself. The transformed assignment
problem can be solved by using usual Hungarian method.
Q. A marketing manager has five salesmen and five sales districts. Considering the
capabilities of the salesmen and the nature of districts, the marketing manager
estimates that the sales per month (in hundred rupees) for each salesman in each
district would be as follows:
Districts
A B C D E
1 32 38 40 28 40
2 40 24 28 21 36
Salesman
3 41 27 33 30 37
4 22 38 41 36 36
5 29 33 40 35 39
Find the assignment of salesmen to districts that will result in maximum sales.
Unbalanced Assignment Problem
Unbalanced Assignment Problem
If number of rows is not equal to number of columns, then it is called Unbalanced
Assignment Problem. So, to solve this problem, we must add dummy rows or
columns with cost 0, to make it a square matrix.
Example: Find Solution of Assignment problem using Hungarian method (MIN
case)
Job I II III IV
Work
A 9 14 19 15
B 7 17 20 19
C 9 18 21 18
D 10 12 18 19
E 10 15 21 16
Solution:
The number of rows = 5 and columns = 4. Here given problem is
unbalanced so we add 1 new column to convert it into a balance
Job I II III IV J5
Work
A 9 14 19 15 0
B 7 17 20 19 0
C 9 18 21 18 0
D 10 12 18 19 0
E 10 15 21 16 0
Row minimum for each row is zero, so Find out each column minimum element and subtract it from
that column.
Job I II III IV J5
Work
A 2 2 1 0 0
B 0 5 2 4 0
C 2 6 3 3 0
D 3 0 0 4 0
E 3 3 3 1 0
Make assignment in the opportunity cost matrix:
Job I II III IV J5
Work
A 2 2 1 0 0
B 0 5 2 4 0
C 2 6 3 3 0
D 3 0 0 4 0
E 3 3 3 1 0
Job I II III IV J5
Work
A 2 2 1 0 1
B 0 5 2 4 1
C 1 5 2 2 0
D 3 0 0 4 1
E 2 2 2 0 0