Introduction: Assignment Problem
• Assignment problem
– Deals with assigning people to tasks
• Assignment problems
– Special cases of minimum cost flow problem
© 2015 McGraw-Hill Education. All rights reserved. 1
The Assignment Problem
• Special type of linear programming problem
– Assignees are being asked to perform tasks
– Assignees could be people, machines, plants,
or time slots
• Requirements to fit assignment problem
definition
– The number of assignees and tasks are the
same (special case of transportation problem
where m = n) i.e., σ𝑚
𝑖=1 𝑆𝑖 = σ𝑛
𝑗=1 𝑑𝑗 = 1
• Designated by n
© 2015 McGraw-Hill Education. All rights reserved. 2
The Assignment Problem
• Requirements to fit assignment problem definition
(cont’d.)
– Each assignee is assigned to exactly one task
– Each task is to be performed by exactly one
assignee
– Cost cij is associated with each assignee i
performing task j; cij ≥ 0
– Objective: determine how n assignments should
be made to minimize the total cost
– If I have a feasible solution with ‘Z’ = 0 then
it is an optimal solution
© 2015 McGraw-Hill Education. All rights reserved. 3
The Assignment Problem
• If problem does not fit requirement 1 or 2
– Dummy assignees and dummy tasks may be
constructed
• Prototype example
– The Job Shop Co. problem
– Assign new machines to locations to minimize
total cost of materials handling
© 2015 McGraw-Hill Education. All rights reserved. 4
Standard Assignment Problem
• xij can have only values
zero or one
– One if assignee i
performs task j
– Zero if not
– X 𝑖𝑗 = 1 if task ‘i’ is
assigned to person ‘j’;
otherwise (X𝑖𝑗 = 0)
– Variables = 𝑛2
– Constraints = 2n (No. of
basic variables)
– Allocations = n (at
optimum)
Degenerate Problem 5
© 2015 McGraw-Hill Education. All rights reserved.
The Assignment Problem
© 2015 McGraw-Hill Education. All rights reserved. 6
The Assignment Problem
• Can use simplex method or transportation
simplex method to solve
• Recommendation: use specialized solution
procedures for the assignment problem
– Will be more efficient for large problems
© 2015 McGraw-Hill Education. All rights reserved. 7
A Special Algorithm for the Assignment
Problem
• Summary of the Hungarian algorithm
1. Subtract the smallest number in each row
from every number in the row. Enter the
results in a new table.
2. Subtract the smallest number in each
column of the new table from every number
in the column. Enter the results in another
table.
© 2015 McGraw-Hill Education. All rights reserved. 8
Example 1: Assignment Problem
• There are four jobs that needs to be assigned at four
machines, total time to finish the job ‘i’ by machine ‘j’ is
given in the table:
Machines/Jobs M1 M2 M3 M4 Total time
(in hours)
J1 7 11 5 8 for
J2 10 9 10 4 completing
job ‘J1’ by
J3 8 12 14 9
Machine
J4 5 12 10 8 ‘M4’
Every feasible solution will have 4 allocations; one in each row and
one in each column
The decision will not change if all of them increase or decrease their
time uniformly to do a specific job (see rows)
Likewise, the decision will not change if the total time to complete a
job gets increased or decreased uniformly by certain machines (see
columns); only the value of objective function will change
© 2015 McGraw-Hill Education. All rights reserved. 9
Example 1: Assignment Problem Solution
using Hungarian Algorithm
• Apply Row Minimum Operation: Subtract smallest number from
every element of each row
Machines/Jobs M1 M2 M3 M4
J1 2 6 0 3
J2 6 5 6 0
J3 0 4 6 1
J4 0 7 5 3
• Apply Column Minimum Operation: Subtract smallest number
from every element of each column
Machines/Jobs M1 M2 M3 M4
J1 2 2 0 3
J2 6 1 6 0
J3 0 0 6 1
J4 0 3 5 3
The objective is to create as many zero as possible in a matrix
© 2015 McGraw-Hill Education. All rights reserved. 10
Example 1: Assignment Problem Solution
using Hungarian Algorithm
• Let us start making an assignment where we find zero
Machines/Jobs M1 M2 M3 M4
J1 2 2 00 3
J2 6 1 6 00
J3 0 0 6 1
J4 00 3 5 3
• It is optimal solution with the value of ‘Z’ = 26
Machines/Jobs M1 M2 M3 M4
J1 2 2 0 3
J2 6 1 6 0
J3 0 0 6 1
J4 0 3 5 3
If we assign randomly we can get into such situation where
getting an optimal solution is possible but we may not get it
© 2015 McGraw-Hill Education. All rights reserved. 11
Example 1: Assignment Problem Solution
using Hungarian Algorithm
• Let us start making an assignment if there is only one
assignable zero in the row otherwise leave it temporarily
Machines/Jobs M1 M2 M3 M4
J1 2 2 0 3
J2 6 1 6 0
J3 0 0 6 1
J4 0 3 5 3
• Repeat the above step for each column as well
© 2015 McGraw-Hill Education. All rights reserved. 12
Example 2: Assignment Problem Solution
using Hungarian Algorithm
• There are five jobs that need to be assigned to five person and
their charge to do a particular job is given in the matrix below
(5 x 5); Objective is to minimize the total cost
Person/Jobs P1 P2 P3 P4 P5
J1 15 11 14 21 14
J2 17 25 11 15 17
J3 17 17 19 17 18
J4 22 14 17 20 18
J5 16 12 20 23 14
After Row Minimum Operation
Person/Jobs P1 P2 P3 P4 P5
J1 4 0 3 10 3
J2 6 14 0 4 6
J3 0 0 2 0 1
J4 8 0 3 6 4
J5 4 0 8 11 2
© 2015 McGraw-Hill Education. All rights reserved. 13
Example 2: Assignment Problem Solution
using Hungarian Algorithm
After Column Minimum Operation
Person/Jobs P1 P2 P3 P4 P5
J1 4 00 3 10 2
J2 6 14 00 4 5
J3 00 0 2 0 0
J4 8 0 3 6 3
J5 4 0 8 11 1
The zeros highlighted in red colour can not be assigned
1. Tick an unassigned row
2. If ticked row has zero then tick the corresponding column (if the
column is not ticked)
3. If a ticked column has an assignment then tick the corresponding
row (if the row is not ticked)
4. Repeat steps 2 & 3 till no more ticking is possible
5. Draw lines through unticked rows and ticked columns
Number of lines indicate total number of possible assignments
© 2015 McGraw-Hill Education. All rights reserved. 14
Example 2: Assignment Problem Solution
using Hungarian Algorithm
Person/Jobs P1 P2 P3 P4 P5
J1 4 00 3 10 2
J2 6 14 00 4 5
J3 00 0 2 0 0
J4 8 0 3 6 3
J5 4 0 8 11 1
Find the smallest number through which no lines are passing through
and call it as ‘ʘ’ (i.e., ʘ = 1) and follow the steps given below:
1. Add ‘ʘ’ if two lines are passing through the numbers (Cij = Cij + ʘ)
2. Subtract ‘ʘ’ if no lines are passing through the numbers (Cij = Cij - ʘ)
3. No change if the number is passing through one line (Cij = Cij)
© 2015 McGraw-Hill Education. All rights reserved. 15
Example 2: Assignment Problem Solution
using Hungarian Algorithm
Person/Jobs P1 P2 P3 P4 P5
J1 3 00 2 9 1
J2 6 15 00 4 5
J3 00 1 2 0 0
J4 7 0 2 5 2
J5 3 0 7 10 0 New
Zero
(Again ʘ = 1); repeat the steps
Person/Jobs P1 P2 P3 P4 P5
J1 2 0 1 8 0
J2 6 16 00 4 5
J3 00 2 2 0 0
J4 6 00 1 4 1
J5 3 1 7 10 0
© 2015 McGraw-Hill Education. All rights reserved. 16
Example 2: Assignment Problem Solution
using Hungarian Algorithm
Person/Jobs P1 P2 P3 P4 P5
J1 1 0 0 7 0
J2 6 17 00 4 6
J3 00 3 2 0 1
J4 5 00 0 3 1
J5 2 1 6 9 0
(Again ʘ = 1); repeat the steps
Person/Jobs P1 P2 P3 P4 P5
J1 02 0 0 6 0
J2 5 17 00 3 6
J3 0 4 3 00 2
J4 4 00 0 2 1
J5 1 1 6 8 0
Finally we got an optimal solution with five assignments and Z = 71
© 2015 McGraw-Hill Education. All rights reserved. 17
Example 3: Assignment Problem Solution
using Hungarian Algorithm
Machines/Jobs M1 M2 M3 M4
J1 5 3 3 6
J2 6 4 4 7
J3 7 5 6 10
J4 6 4 7 11
Apply Row Minimum Operation
Machines/Jobs M1 M2 M3 M4
J1 2 0 0 3
J2 2 0 0 3
J3 2 0 1 5
J4 2 0 3 7
Apply Column Minimum Operation
Machines/Jobs M1 M2 M3 M4
J1 0 0 0 0 Do careful
assignment
J2 0 0 0 0
J3 0 0 1 2
J4 0 0 3 4
© 2015 McGraw-Hill Education. All rights reserved. 18
Important Points
If we have maximization objective function,
convert the matrix into minimization by multiplying
the cost coefficient by -1
By default it is a square matrix but if that is not the
case; convert it into square matrix by adding
dummy rows or dummy columns appropriately
If a particular job or task can’t be performed by a
specific person/machine then highlight this by
using ‘M’ in the matrix appropriately
© 2015 McGraw-Hill Education. All rights reserved. 19
Conclusions
• General simplex method is a powerful
algorithm
– Simplified approaches are available when
problem fits the special structure
• Transportation problem
• Assignment problem
© 2015 McGraw-Hill Education. All rights reserved. 20
Practice Problems: Assignment Problem
• A computer center has four expert programmers and
needs to develop four application programs. The head of
the computer center, estimates the computer time (in
minutes) required by the respective experts to develop
the application programs as follows:
Programmers/ A B C D
Programs
1 120 100 80 90
2 80 90 110 70
3 110 140 120 100
4 90 90 80 90
• Find the assignment pattern that minimizes the time
required to develop the application programs.
© 2015 McGraw-Hill Education. All rights reserved. 21
Practice Problems: Assignment Problem
• A company is producing a single product and selling it through five agencies
situated in different cities. All of a sudden, there is a demand for the product
in five more cities that do not have any agency of the company. The
company is faced with the problem of deciding on how to assign the existing
agencies to dispatch the product to the additional cities in such a way that
the travelling distance is minimized. The distances (in km) between the
surplus and deficit cities are given in the following distance matrix.
Determine the optimum assignment schedule.
Surplus A B C D E
city/Deficit
city
1 160 130 175 190 200
2 135 120 130 160 175
3 140 110 155 170 185
4 50 50 80 80 110
5 55 35 70 80 105
© 2015 McGraw-Hill Education. All rights reserved. 22