Scan Oct 06, 2021
Scan Oct 06, 2021
Steps:MINIMISATION
1) Ensure that the matrix of costs is square by adding rows or columns if necessary and reduce
it by both row and column subtractions. E.g. 2x2, 3x3
2) Find a way of shading rows and columns so that all zeros are shaded using as few lines as
possible. If the # of lines is equal to the dimension of the matrix, go to step 4
3) Select the minimum unshaded element. Subtract the value from al unshaded elements.
Double the value and add to all elements covered by two ines.
4 There is an optimal matching using only pairing represented by a zero in the current matrix.
Select the matching and find its cost from the original table of costs.
Example 1
The table below shows the cost in dollars of transporting an item from warehouse, W, Wa, Ws and
W to supermarkets S S2,S3 and S4
S1 S3 S4
W1 6 7 9
W2 2 6
W3 10 5 1
W4 11 6 3 8
i) Use the Hungarian algorithm to determine the supermarket to which each warehouse
must be assigned to in order to minimize the cost of delivery.
Hence, determine the total cost for each item at the 4 warehouses
Example 2
TOwn
2
5
Driver
2
3
4 3 6
6
1
W
6 1 9 4
17 13 24 5 1
11 1 4 8
1 15
14 24
V W X Y
2
F G H
14 18 23 20 17
1 4 25 5 12
21 20 6 2 10
D 19 14 25 11 7
E 8 6 21 18 17
71
MAXIMISATION
Example 3
FIELD
Q
CROP 3
2 3 1
3 6 4
1)
X Y
15 14 8
4 12 15
12 14 5
D 12 13 4 13
2
V
W Y
A 18 14 11 12 15
B 5 2 10 5
C 2 20 8 19 8
D 14 19 16 8 18
E 20 9 7 15 5
8
Hungarian Algorithm
Used to manipulate a square matrix to find a zero matching in order to minimize or
maximize an activity.
Steps:MINIMISATION
Ensure that the matrix of costs is square by adding rows or columns if necessary and reduce
it by both row and column subtractions. E.g. 2x2, 3x3
2) Find a way of shading rows and columns so that all zeros are shaded using as few lines as
If the # of lines is equal to the dimension of the matrix, go to step 4
possible.
3) Select the minimum unshaded element. Subtract the value from all unshaded elements.
Double the value and add to all elements covered by two lines.
4) There is an optimal matching using only pairing represented by a zero in the current matrix.
Select the matching and find its cost from the original table of costs.
The table below shows the cost in dollars of transporting an item from warehouse, W1, W2, Wa and
W to supermarkets S, S2, S3 and S4.
S1 S2 S3 SA
W1 5 5 9
W2 2 6 8
W3 10 1 9
W4 11 6 3 8
i) Use the Hungarian algorithm to determine the supermarket to which each warehouse
must be assigned to in order to minimize the cost of delivery.
Hence, determine the total cost for each item at the 4 warehouses
S1 S3 SA lou
W 6 5
W2 2 6
W3 10
W4 11 6 8
(Columnminimum)> MMinimu
11|
S S2 S3 S4 Shd
W 0
W2 3 2
Ws 4
c3
WA 0
Minimum uncovered (1). Subtract 1 from all uncovered and add 2 to intersections
S1 Sa
W1 o LS) 4
W2 o (-) 3 1
W3 9 3 o C) 3
W4 o (3
= 2+5+1+8 $16
Example 2
Town
Driver 4
3 2 b 8
4 3 6 5 3
4 2 3 6
5
8 A
3 2 3
4
5 2 8 3
Row
1 2 3 4 5
1 3 1 0
2 O 2 2
3 3 1 4
3 2
5
O 0
Column
12
2 3 5
SLasln
1 1 0 4
1 2 1 3
3 3 4 6
3 2
=
Mio val C) raek ntound ad asd
1 2 3
1 1 1 O 4
2 5 1 2 1
O
3 3 4 6
3 2
5 2 5 1 4
Miai muum
W
A 9
B 17 13 24
C 11 1 4
D 15 6
E 14 3 24 3
V W X
V W
A 5 8
B 12 8 19
C 10 3
D 0 14 5 3 8
E 11 21 6 6
3 0 2
13
Sla
W N
A 5
B 12 16 0
C 10
D 14
E 11 18 6
W X
A 5 4
B 16
C 12 2 o4 1
D 14 1
E 11 o (3 17 3
Value: 17
1+3y +S+:
F G H
A 14 18 23 20 1/
1 25 5 12
C 21
4
20 6 2 10
25 11
D
E
19 14
6 21 18
7
17
8
H J
A 9 3
B 24 11
C 19 18 4 8
D 12 18 4
E 12 15 12 11
4
Sla
J
A 5 3 C
B 20 11
19 0 8
C 18
D 12 14
E 12 11 12 11
O 3
39
1 2 I
14 |
2