Professional Documents
Culture Documents
Assnmt 1
Assnmt 1
Assnmt 1
ASSIGNMENT PROBLEM
• It is a matching problem
• Can be used for allocation
Warehouses to Markets
Factories to Markets
Factories to Warehouses
Operator to machines
Machines to Jobs
Salesmen to market territories
Etc.,
Example
• Time matrix is given below.
• Each market should be supplied by one
warehouse only.
MKT1 MKT2 MKT3 MKT4
Warehouse 1 14 5 8 10
Warehouse 2 2 12 6 5
Warehouse 3 7 8 3 9
Warehouse 4 2 4 6 7
Warehouse 1 14 5 8 10
Warehouse 2 2 12 6 5
Warehouse 3 7 8 3 9
Warehouse 4 2 4 6 7
•We may apply common sense – but may not be consistent and may not guarantee
optimality
Warehouse 1 14 5 8 10
Warehouse 2 2 12 6 5
Warehouse 3 7 8 3 9
Warehouse 4 2 4 6 7
Warehouse 1 9 0 3 5
Row Reduction Warehouse 2 0 10 4 3
Warehouse 3 4 5 0 6
Warehouse 4 0 2 4 5
Example: Step 1(b)
MKT1 MKT2 MKT3 MKT4
Warehouse 1 9 0 3 5
Warehouse 2 0 10 4 3
Warehouse 3 4 5 0 6
Warehouse 4 0 2 4 5
Warehouse 1 9 0 3 2
Column Reduction Warehouse 2 0 10 4 0
Warehouse 3 4 5 0 3
Warehouse 4 0 2 4 2
Example: Final Solution
Warehouse 1 9 0 3 2
Warehouse 2 0 10 4 0
Warehouse 3 4 5 0 3
Warehouse 4 0 2 4 2
Optimal assignment
x12 = 1, x24 = 1, x33 = 1, x41 = 1,
How did we
know which 0’s
to choose?!
FINAL ALLOCATION AND THE
EFFECT
MKT1 MKT2 MKT3 MKT4
Warehouse 1 5
Warehouse 2 5
Warehouse 3 3
Warehouse 4 2
• TOTAL TIME = 15
• Can you find a solution better than this ?
PRACTICE PROBLEM
• A DEPARTMENT HAS 4 JOBS AND 4
MEN.
• ROWS REPRESENT JOBS 1 To 4
• COLUMNS REPRESENT MEN A TO D
• THE TIME MATRIX IS GIVEN.
• CHOOSE THE BEST JOB-MAN
COBINATIONS.
M/C1 M/C2 M/C3 M/C 4
8 26 17 11
Job 1
13 28 4 26
Job 2
38 19 18 15
Job 3
19 26 24 10
Job4
THE PROBLEM
• AIM : TO MINIMIZE THE TOTAL TIME
TAKEN TO COMPLETE ALL JOBS.
• THERE ARE 4! NUMBER OF POSSIBLE
ALLOCATIONS.
• REQUIREMENT :
A SYSTEMATIC METHOD.
HUNGARIAN METHOD
PHASE 1
STEPS
• Row operation
Find the smallest number in each row and Subtract
it from the remaining elements in that row.
• Column operation
Find the minimum element in each column and
subtract it from the other elements in the
respective column
0 18 9 3
9 23 0 22
23 4 3 0
9 16 14 0
0 14 9 3
9 19 0 22
23 0 3 0
9 12 14 0
COMMENTS
HERE
THE INDEPENDENT ASSINGNMENTS ARE:
A-1 (8)
B-3 (19)
C-2 (4)
D-4 (10)
GO TO PHASE 2
WILL IT BE THIS SIMPLE ALWAYS ?
Consider an example
Warehouse 1 14 5 8 7
Warehouse 2 2 12 6 5
Warehouse 3 7 8 3 9
Warehouse 4 2 4 6 10
Warehouse 1 9 0 3 2
Row Reduction Warehouse 2 0 10 4 3
Warehouse 3 4 5 0 6
Warehouse 4 0 2 4 8
Example: Step 1(b)
MKT1 MKT2 MKT3 MKT4
Warehouse 1 9 0 3 2
Warehouse 2 0 10 4 3
Warehouse 3 4 5 0 6
Warehouse 4 0 2 4 8
Warehouse 1 9 0 3 0
Column Reduction Warehouse 2 0 10 4 1
Warehouse 3 4 5 0 4
Warehouse 4 0 2 4 6
THE PROBLEM ?
• Only 3 allocations are possible
• We need 4 allocations
Go to Phase 2
Hungarian Algorithm Phase 2
• Step 2: Draw the minimum number of
lines that are needed to cover all the zeros
in the reduced cost matrix.
• If m (number of assignments required)
lines are available, then an optimal
solution is available among the covered
zeros in the matrix.
• Otherwise, continue to Step 3. How do we
find the
minimum
number of
lines?
Example: Step 2
Warehouse 1 9 0 3 0
Warehouse 2 0 10 4 1
Warehouse 3 4 5 0 4
Warehouse 4 0 2 4 6
Warehouse 9 0 3 0
Warehouse 0 10 4 1
Warehouse 4 5 0 4
Warehouse 0 2 4 6
Warehouse 10 0 3 0
Warehouse 0 9 3 0
Warehouse 5 5 0 4
Warehouse 0 1 3 5
Example: Step 2 (again)
Zero Assignment
Warehouse 1 10 0 3 0
Warehouse 2 0 9 3 0
Warehouse 3 5 5 0 4
Warehouse 4 0 1 3 5
Warehouse 1 10 0 3 0
Warehouse 2 0 9 3 0
Warehouse 3 5 5 0 4
Warehouse 4 0 1 3 5
Optimal assignment
x12 = 1, x33 = 1, x41 = 1, x24 = 1
How did we
know which 0’s
to choose?!
HOW TO DRAW THE LINES
SYSTEMATICALLY ?
• CONSIDER ONE MORE EXAMPLE
CONSIDER THE FOLLOWING
EXAMPLE
• There are 5 operators and 5 jobs
11 17 8 16 20
M1
9 7 12 6 15
M2
13 16 15 12 16
M3
21 24 17 28 26
M4
14 10 12 11 15
M5
3 9 0 8 12
3 1 6 0 9
1 4 3 0 4
4 7 0 11 9
4 0 2 1 5
2 9 0 8 8
2 1 6 0 5
0 4 3 0 0
3 7 0 11 5
3 0 2 1 1
PHASE 2 0F ASSIGNMENTS
STEPS
• MARK ALL ROWS HAVING NO
ASSINGNMENT
• MARK COLUMNS WITH ZEROS IN MARKED
ROWS.
• MARK ROWS THAT HAVE ASSIGNMENTS IN
MARKED COLUMN.
• REPEAT STEPS 1 TO 3 TILL THE CHAIN OF
MARKING ENDS.
• DRAW LINES THROUGH UNMARKED ROWS
AND MARKED COLUMNS.
2 9 0 8 8
2 1 6 0 5
0 4 3 0 0
3 7 0 11 5
3 0 2 1 1
CHECK
IF THE PROCEDURE HAS BEEN CARRIED OUT CORRECTLY:
• X11 = 1 ( 11)
• X24 = 1 (6)
• X35 = 1 (16)
• X43 = 1 (17 )
• X52 = 1 (10)
• Total Value = 60
PRACTICE PROBLEMS
MAN 1 2 3 4 5
JOBS
A 10 5 13 15 16
B 3 9 18 13 6
C 10 7 2 2 2
D 7 11 9 7 12
E 7 9 10 4 12
ANSWER : A-2, B-1, C-5, D-3, E-4 ( CHECK)
> A, B, C, D, E ARE THE TOWNS REACHING WHICH CARS ARE TO
BE HIRED.
> a, b, c, d, e ARE CAR DEPOTS FROM WHERE CARS CAN BE HIRED.
EACH DEPOT CAN ONLY GIVE CAR TO REACH ONE TOWN.
DEPOTS
a b c d e
A 160 130 175 190 200
TOWNS
B 135 120 130 160 175
D 50 50 90 80 110
E 55 35 70 80 105