Académique Documents
Professionnel Documents
Culture Documents
HUNGARIAN METHOD
(THIS IS AN EXACT ALGORITHM.)
EIN4365
Assignment Model
Example: Due to an increase in the volume of sales, the production capacity will be expanded. A new wing is being added to the plant that will house (1) a punch press, (2) a grinder, (3) a lathe and (4) a welding machine. There are only four possible locations for these machines, say A, B, C, and D. The welding machine will not fit in location B.
EIN4365
Example
Observation
If a constant is added to, or subtracted from, all entries in a row or column of an assignment cost matrix, the optimal assignment is unchanged. Note that the following algorithm always gives the optimal. If the number of locations is larger than the number of machines: Add dummy machines (those locations will remain empty) If the number of machines is larger than the number of machines: Add dummy machines (those machines will not be placed)
EIN4365
Locate the smallest number in row 1 and subtract it from all entries in row 1. Repeat for all rows. Locate the smallest number in column 1 and subtract it from all entries in column 1. Repeat for all columns. If its possible to make a zero cost assignment, then do it. That will be the optimal solution. If not go to Step 4. Determine the maximum number of zero cost assignments. This will equal the smallest number of lines required to cover all zeros. Choose the smallest number uncovered and Subtract it from all other uncovered numbers. Add it to the numbers where the lines cross. Return to Step 3.
EIN4365
1. Locate the smallest number in row 1 and subtract it from all entries in row 1.
1 94 13 62 71 2 62 19 84 96 3 75 88 18 80 4 11 M 81 21
EIN4365
1. Locate the smallest number in row 1 and subtract it from all entries in row 1.
A 1 2 3 4 81 62 75 11
B 0 19 88 M
C 49 84 18 81
D 58 96 80 21 1 2 3 4
A 81 43 57 0
B 0 0 70 M
C 49 65 0 70
D 58 77 62 10
EIN4365
2. Locate the smallest number in column 1 and subtract it from all entries in column 1.
A 1 2 3 4 81 43 57 0
B 0 0 70 M
C 49 65 0 70
D 58 77 62 10 1 2 3 4
A 81 43 57 0
B 0 0 70 M
C 49 65 0 70
D 48 67 52 0
EIN4365
A 1 2 3 4 81 43 57 0
B 0 0 70 M
C 49 65 0 70
D 48 67 52 0
If not go to Step 4.
EIN4365
A 1 2 3 4 81 43 57 0
B 0 0 70 M
C 49 65 0 70
D 48 67 52 0 1 2 3 4
A 81 43 57 0
B 0 0 70 M
C 49 65 0 70
D 48 67 52 0
EIN4365
10
A 1 2 3 4 81 43 57 0
B 0 0 70 M
C 49 65 0 70
D 48 67 52 0 1 2 3 4
A 38 0 57 0
B 0 0
C 6 22 0 70
D 5 24 52 0
113
M
EIN4365
11
A 1 2 3 4 38 0 57 0
B 0 0
113
C 6 22 0 70
D 5 24 52 0
1 2 3 A 94 62 75 11 B 13 19 88 M C 62 84 18 81 D 71 96 80 21
If not go to Step 4.
Assume we have 4 machines (A, B, C, and D)and 4 possible locations (1, 2, 3, and 4). Decision variables:
xij equals 1 iff (i.e, if and only if) machine i is assigned to location j
Objective function:
ij
xij
Constraints
Introduction to modeling 13
EIN4365
Constraints
Cannot put more than one machine in a location All machines must be assigned to some location Decision variables must be binary (logical)
x
i 1
4
ij
1
1
j {1,...,4}
i {1,...,4}
i, j {1,...,4}
x
j1
ij
x ij {0,1}
Logical contraints
EIN4365
Introduction to modeling
14
c x
i 1 j1
4
ij
ij
x
i 1
4
ij
1
1
j {1,...,4}
i {1,...,4}
x
j1
ij
x ij {0,1}
i, j {1,...,4}
EIN4365
Introduction to modeling
15