Download Assignment Algorithm by Hungarian Method and more Slides Optimization Techniques in Engineering in PDF only on Docsity!
GEM 805 1
Assignment Algorithm
(Hungarian Method)
By: J.E.T
2010-2011 ©
The Assignment Problem
Consider the problem of assigning n assignees to n tasks. Only
one task can be assigned to an assignee, and each task must be
assigned.
There is also a cost associated with assigning an assignee i to
task j , c
ij
The objective is to assign all tasks such that the total cost is
minimized.
The Assignment Problem
To fit the assignment problem definition, the following
assumptions must be satisfied:
- (^) The number of assignees and the number of tasks are the same
(denoted by n ).
- (^) Each assignee is to be assigned to exactly one task.
- (^) Each task is to be assigned to exactly one assignee.
- There is a cost^ cij associated with assignee^ i^ performing task^ j.
- (^) The objective is to determine how all n assignments should be
made to minimize the total cost.
Assignment Problem –
Flow Diagram
n
assignees
tasks
a – assignee
t – tasks a 1
a
2
a
3
t 1 t 2 t 3 t 4
c
11
c
12
n
c
nn
a
n
Assignment Problem –
Conversion to Standard Cost Matrix
1 2 3 4 1 10 9 8 7 Assignees 2 4 - 5 6 3 2 1 8 - Tasks
Consider following cost matrix, how do you convert to satisfy
the standard definition of the assignment problem?
1 2 3 4 1 10 9 8 7 Assignees 2 4 M 5 6 3 2 1 8 M 4 0 0 0 0 Tasks
Add “big M” to avoid incompatible assignments, and add a
dummy assignee (or task) to have equal assignees and tasks.
Assignment Problem –
Math Formulation
(x isbinary,foralliand j)
x 0
x 1
x 1
Z c x
ij ij n i 1 ij n j 1 ij m i 1 n j 1 ij ij
Minimize
s.t.
Total Cost
i
j
Does this formulation look familiar?
Is this a Linear Program?
Each supply is 1
Each demand is 1
Assignment Problem –
Hungarian Method
Consider following cost matrix.
1 2 3 4 Row Minimum
Assignees 2 2 12 6 5 2
Tasks
Assignees 2 0 10 4 3 3 4 5 0 6 4 0 2 4 8 Column Min
Reduce by Row Minimum.
Assignment Problem –
Hungarian Method
Reduced by Column Minimum:
Assignees 2 0 10 4 1
Tasks
Assignees 2 0 9 3 0
Tasks
Reduce by Minimum of uncovered cells (1):
Assignment Problem –
Hungarian Method
Summary of Hungarian Method: Step 1 – Find the minimum element in each row. Construct a new matrix by subtracting from each cost the minimum cost in its row. For this new matrix, find the minimum cost in each column. Construct a new matrix by subtracting from each cost the minimum cost in its column. Step 2 – Draw the minimum number of lines (horizontal or vertical) that are needed to cover all the zeros in the reduced cost matrix. If n lines are required, an optimal solutions is available among the covered zeros in the matrix. If fewer than n lines are needed, proceed to step 3. Step 3 – Find the smallest nonzero element (call its value k ) in the reduced cost matrix that is uncovered by the lines drawn in Step 2. Now subtract k from each uncovered element of the reduced cost matrix and add k to each element that is covered by two lines. Return to step 2.
EXAMPLE CASE: SUPPLY = DEMAND
Example: Step 1(a)
Row
Column
- Job 1 Job 2 Job 3 Job
- Machine
- Machine
- Machine
- Machine - Job 1 Job 2 Job 3 Job
- Machine
- Machine
- Machine
- Machine - Job 1 Job 2 Job 3 Job Example: Step 1(b)
- Machine
- Machine
- Machine
- Machine
- Machine
- Machine
- Machine
- Machine
- Example: Step - Job 1 Job 2 Job 3 Job
- Machine
- Machine
- Machine
- Machine - continue to Step We need 3<4 lines, so
- Example: Step - Job 1 Job 2 Job 3 Job
- Machine
- Machine
- Machine
- Machine - Job 1 Job 2 Job 3 Job - Machine - Machine - Machine - Machine
Example: Step 2 (again) Job 1 Job 2 Job 3 Job 4 Machine 1 10 0 3 0 Machine 2 0 9 3 0 Machine 3 5 5 0 4 Machine 4 0 1 3 5
Need 4 lines, so we have the
optimal assignment and we
stop
Zero Assignment