Assignment Problem: A. R. Dani
Assignment Problem: A. R. Dani
A. R. Dani
12/08/21 1
The Assignment Problem
• In many business situations, management needs to
assign - personnel to jobs, - jobs to machines, -
machines to job locations, or - salespersons to
territories.
• Consider the situation of assigning n jobs to n
machines.
• When a job i (=1,2,....,n) is assigned to machine j
(=1,2, .....n) that incurs a cost Cij.
• The objective is to assign the jobs to machines at the
least possible total cost.
12/08/21 2
Introduction
• 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.
• In other words any operator would be able
perform any job regardless of his skills,although
the cost( or the time taken) will be more if the
job does not match with operator’s skill.
12/08/21 3
The Assignment Problem
• This situation is a special case of the
Transportation Model And it is known as the
assignment problem.
• Here, jobs represent “sources” and machines
represent “destinations.”
• The supply available at each source is 1 unit
And demand at each destination is 1 unit.
12/08/21 4
The Assignment Problem
12/08/21 8
Assignment problem as a zero-one ( Binary)
programming problem .
• Min Z= c11x11++cijXij+.+cmmXmm = m m
x21+…………...+x2m =1 m
…….. X
j 1
ij 1 for i 1,....m
xm1+…………...+xmm =1
x11+…………...+xm1 =1 m
X ij 1 for j 1,....m
x12+…………...+xm2 =1 i 1
………………..
x1m+…………...+xmm =1
xij.=0 or 1 for i=1,2….m and j=1,2…..m.
12/08/21 9
Types of assignment problems
12/08/21 10
The Assignment Problem Example
• Ballston Electronics manufactures small electrical
devices.
• Products are manufactured on five different
assembly lines (1,2,3,4,5).
• When manufacturing is finished, products are
transported from the assembly lines to one of the
five different inspection areas (A,B,C,D,E).
• Transporting products from five assembly lines to
five inspection areas requires different times (in
minutes)
12/08/21 11
The Assignment Problem Example
12/08/21 13
The Assignment Problem Example
• Assignment problem can be either formulated
as a linear programming model, or it can be
formulated as a transportation model.
• However, An algorithm known as Hungarian
Method has proven to be a quick and efficient
way to solve such problems.
• This technique is programmed into many
computer modules such as the one in CPLEX,
MATLAB,SAS
12/08/21 14
The Assignment Problem Example
12/08/21 15
Hungarian Method Example
12/08/21 16
Hungarian Method Example
12/08/21 18
Hungarian Method Example 2
12/08/21 19
Hungarian Method Example 2
• A feasible assignment is not possible at this
moment.
• In such a case, The procedure is to draw a
minimum number of lines through some of
the rows and columns, Such that all zero
values are crossed out.
12/08/21 20
Hungarian Method Example 2
The next step is to select the smallest uncrossed out element. This
element is subtracted from every uncrossed out element and added
to every element at the intersection of two lines.
12/08/21 21
Hungarian Method Example 2
• We can now easily assign to the zero values.
Solution is to assign (1 to 1), (2 to 3), (3 to 2)
and (4 to 4).
• If drawing lines do not provide an easy
solution, then we should perform the task of
drwaing lines one more time.
• Actually, we should continue drawing lines
until a feasible assignment is possible.
12/08/21 22
The Traveling Salesman Problem
• In the traveling salesman problem, there are m
locations (or nodes)
• And unit costs (Cij) are associated with traveling
between locations i and j.
• The goal is to find the cycle that minimizes the total
(traveling) distance required to visit all locations
(nodes) without visiting any location twice.
• The Traveling salesman begins its journey from
his/her home city And visits other cities (in no
particular order) before returning home.
12/08/21 23
The Traveling Salesman Problem
Example:
• Emergency management set up a home office
at Northridge in response to an Earthquake in
California.
• The director is responsible for visiting each of
4 local offices and return to home office to file
his reports.
12/08/21 24
The Traveling Salesman Problem
Following table gives estimated travel times
between each pair of offices (in minutes)
12/08/21 25
The Traveling Salesman Problem
• The director wishes to visit each local office
and return to home office in the shortest
time.
12/08/21 26
The Traveling Salesman Problem
Network representation of the problem
12/08/21 27
The Traveling Salesman Problem
Cycle Total Cost (distance in minutes)
1. H-O1-O2-O3-O4-H 210
2. H-O1-O2-O4-O3-H 195 … The shortest cycle
3. H-O1-O3-O2-O4-H 240
4. H-O1-O3-O4-O2-H 200
5. H-O1-O4-O2-O3-H 225
A problem with m nodes
6. H-O1-O4-O3-O2-H 200 (locations) has (m-1)!
7. H-O2-O3-O1-O4-H 265 Possible cycles.
8. H-O2-O1-O3-O4-H 235 For symmetric problems,
9. H-O2-O4-O1-O3-H 250 this number is divided by
10. H-O2-O1-O4-O3-H 220
11. H-O3-O1-O2-O4-H 260
2.
12. H-O3-O2-O1-O4-H 260
12/08/21 28
The Traveling Salesman Problem
• Here, there are 5 nodes, m=5, therefore there are (5-
1)! / 2= 4! / 2 = 12 possible cycles for this problem.
• As the table indicates, the optimal cycle is H-O1-O2-
O4-O3-H with a traveling time of 195 minutes.
• Of course, This trial approach can only be used for
small problems.
• For example, the number of possible cycles is
181,440 for a problem with 10 nodes.
• For a problem with 15 nodes, it is 840 trillion. (A
typical NP hard problem)
12/08/21 29
The Traveling Salesman Problem
• Basically, the traveling salesman problem can
be considered as being similar to the
Assignment Problem.
12/08/21 30
The Traveling Salesman Problem
12/08/21 35
The Traveling Salesman Problem
• For four node sub-cycles:
X12 + X23 + X34 + X41 3
X12 + X23 + X35 + X51 3
X12 + X24 + X45 + X51 3
X13 + X34 + X45 + X51 3
X23 + X34 + X45 + X51 3
12/08/21 36
Example : Assign the 5 operators to the 5 jobs such
that the total processing time is minimized.
Operator
1 2 3 4 5
job
1 10 12 15 12 8
2 7 16 14 14 11
3 13 14 7 9 9
4 12 10 11 13 10
5 8 13 15 11 15
12/08/21 37
Hungarian method
• Consists of two phases.
• First phase: row reductions and column
reductions are carried out.
• Second phase :the solution is optimized in
iterative basis.
12/08/21 38
Phase 1: Row and column
reductions
• Step 0: Consider the given cost matrix
• Step 1: Subtract the minimum value of each
row from the entries of that row, to obtain
the next matrix.
• Step 2: Subtract the minimum value of each
column from the entries of that column , to
obtain the next matrix.
• Treat the resulting matrix as the input for
phase 2.
12/08/21 39
Phase 2: Optimization
• Step3: Draw a minimum number of lines to cover all the
zeros of the matrix.
• Procedure for drawing the minimum number of lines:
• 3.1 Row scanning
1 Starting from the first row ,if there’s only one zero in a
row mark a square round the zero entry and draw a
vertical line passing through that zero. Otherwise skip
the row.
2.After scanning the last row, check whether all the zeros
are covered with lines. If yes go to step 4. Otherwise do
column scanning. Ctd
12/08/21 40
• 3.2 Column scanning.
1. Starting from the first column: if there’s
only one zero in a column mark a square
round the zero entry and draw a horizontal
line passing through that zero. otherwise
skip the column.
2.After scanning the last column, check
whether all the zeros are covered with
lines. If yes go to step 4. Otherwise do row
scanning. ctd
12/08/21 41
• Step 4: check whether the number of squares marked is
equal to the number of rows/columns of the matrix.
• If yes go to step 7. Otherwise go to step 5.
• Step 5: Identify the minimum value of the undeleted cell
values ,say ‘x’. Obtain the next matrix by the following
steps.
5.1 Copy the entries covered by the lines ,but not on the
intersection points.
5.2 add x to the intersection points
5.3 subtract x from the undeleted cell values.
Step 6: go to step 3.
Step 7: optimal solution is obtained as marked by the
squares
12/08/21 42
Maximization problem
• If the problem is a maximization problem
,convert the problem into a minimization
problem by multiplying by -1.
• Then apply the usual procedure of an
assignment problem.
12/08/21 43
Example : Assign 4 sales persons to four different
sales regions such that the total sales is maximized.
Sales
region
1 2 3 4
Sales person
1 10 22 12 14
2 16 18 22 10
3 24 20 12 18
4
12/08/21
16 14 24 20 44
Modified data , after multiplying the cell entries
by -1.
Sales
region
1 2 3 4
Sales person
4
12/08/21
-16 -14 -24 -20 45
After step 1
Sales
region
1 2 3 4
Sales person
1 12 0 10 8
2 6 4 0 12
3 0 4 12 6
4
12/08/21
8 10 0 4 46
• Cij is the cell entity of the cost matrix
• X rows which are not deleted up to node Pk
from the root node in the branching tree.
• Y columns which are not deleted up to node Pk
from the root node in the branching tree.
12/08/21 47
P0
P323 51 P333 43
P343 47
P424 43 P444 48
12/08/21 48
• The optimum allocation will be
• Job operator time
• 1 5 8
• 2 1 7
• 3 3 7
• 4 2 10
• 5 4 11
• 43
12/08/21 49
Example :ROW SCANNING.
Operator
1 2 3 4 5
job
1 10 12 15 12 8
2 7 16 14 14 11
3 13 14 7 9 9
4 12 10 11 13 10
5 8 13 15 11 15
12/08/21 50
Example : Assign the 5 operators to the 5 jobs such
that the total processing time is minimized.
Operator
1 2 3 4 5
job
1 10 12 15 12 8
2 7 16 14 14 11
3 13 14 7 9 9
4 12 10 11 13 10
5 8 13 15 11 15
12/08/21 51
Example : Assign the 5 operators to the 5 jobs such
that the total processing time is minimized.
Operator
1 2 3 4 5
job
1 2 4 7 4 0
2 0 9 7 7 4
3 6 7 0 2 2
4 2 0 1 3 0
5 0 5 7 4 8
12/08/21 52
Example : Assign the 5 operators to the 5 jobs such
that the total processing time is minimized.
Operator
1 2 3 4 5
job
1 2 4 7 2 0
2 0 9 7 5 4
3 6 7 0 2 2
4 2 0 1 1 0
5 0 5 7 2 8
12/08/21 53
Example : Assign the 5 operators to the 5 jobs such
that the total processing time is minimized.
Operator
1 2 3 4 5
job
1 2 4 6 1 0
2 0 9 6 4 4
3 7 8 0 2 3
4 2 0 0 0 0
5 0 5 6 1 8
12/08/21 54
Example : Assign the 5 operators to the 5 jobs such
that the total processing time is minimized.
Operator
1 2 3 4 5
job
1 2 4 6 1 0
2 0 9 6 4 4
3 7 8 0 0 3
4 2 0 0 0 0
5 0 5 6 1 8
12/08/21 55
Example : Assign the 5 operators to the 5 jobs such
that the total processing time is minimized.
Operator
1 2 3 4 5
job
1 2 4 6 1 0
2 0 9 6 4 4
3 8 9 0 0 4
4 3 1 0 0 0
5 0 5 6 1 8
12/08/21 56
Example : Assign the 5 operators to the 5 jobs such
that the total processing time is minimized.
Operator
1 2 3 4 5
job
1 2 4 5 0 0
2 0 9 5 3 4
3 7 8 0 0 3
4 2 0 0 0 0
5 0 5 5 0 7
12/08/21 57
Example : Assign the 5 operators to the 5 jobs such
that the total processing time is minimized.
Operator
1 2 3 4 5
job
1 2 4 5 0 0
2 0 9 5 3 4
3 7 8 0 0 3
4 2 0 0 0 0
5 0 5 5 0 7
12/08/21