Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Hungarian algorithm for non-square arrays

Similar presentations


Presentation on theme: "The Hungarian algorithm for non-square arrays"— Presentation transcript:

1 The Hungarian algorithm for non-square arrays
The Hungarian Algorithm – Non-square arrays The Hungarian algorithm for non-square arrays If an array is not square, start by adding a dummy row or column to make the array square. There are then two possible approaches: Method 1: Fill the dummy row or column with zeros, as shown in the textbook. This method means that you will not be able to reduce by rows (in the case of a dummy column), so more iterations may be needed. Click here to see an example using Method 1. Method 2: Fill the dummy row or column with the largest number in the existing array. Click here to see an example using Method 2.

2 The Hungarian algorithm for non-square arrays: Method 1
The Hungarian Algorithm – Non-square arrays Method 1 The Hungarian algorithm for non-square arrays: Method 1 Add a dummy row or column to make the array square. Fill this with zeros. Then apply the standard Hungarian algorithm: Step 1 Reduce the array by both row and column subtractions Step 2 Cover the zero elements with the minimum number of lines. If the number of lines is the same as the size of the array, then go to Step 4. Step 3 Augment the elements. To do this, identify the minimum uncovered element. Subtract this element from all uncovered elements, and add this element to all elements covered by two lines. Then return to step 2. Step 4 Identify the maximal matching which uses only zero elements, and apply this matching to the original array to find the minimum cost.

3 The Hungarian Algorithm – Non-square arrays Method 1
Example A company has five representatives availiable on a particular day. Four representatives are needed to attend meetings in different areas. The distance each representative would need to drive from home to attend each of the meetings is shown in the table below. Use the Hungarian algorithm to find out which representative should visit each area in order to keep the total distance travelled as low as possible. Area 1 Area 2 Area 3 Area 4 Ian 18 11 16 20 Jane 14 19 26 Kate 21 23 35 29 Lucy 32 27 17 Mike 15 28 25

4 The Hungarian Algorithm – Non-square arrays Method 1
This array has five rows and four columns, so first you need to add a dummy column to give a square array, and fill this with zeros. Because of the zeros in the dummy column, it is not possible to reduce by row subtractions. Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 Jane 14 19 26 Kate 21 23 35 29 Lucy 32 27 17 Mike 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 Jane 14 19 26 Kate 21 23 35 29 Lucy 32 27 17 Mike 15 28 25 Area 1 Area 2 Area 3 Area 4 Ian 18 11 16 20 Jane 14 19 26 Kate 21 23 35 29 Lucy 32 27 17 Mike 15 28 25

5 The Hungarian Algorithm – Non-square arrays Method 1
Step 1: Reduce the array by column subtractions To reduce by column subtractions, subtract the smallest element in each column from each element in the column. The smallest element in the Area 1 column is 14, so subtract 14 from each element in the column. Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 11 16 20 Jane 19 26 18 Kate 7 23 35 29 Lucy 27 21 17 Mike 2 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 Jane 14 19 26 Kate 21 23 35 29 Lucy 32 27 17 Mike 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 Jane 14 19 26 Kate 21 23 35 29 Lucy 32 27 17 Mike 15 28 25

6 The Hungarian Algorithm – Non-square arrays
The Hungarian Algorithm – Non-square arrays Method 1 Step 1: Reduce the array by column subtractions To reduce by column subtractions, subtract the smallest element in each column from each element in the column. The smallest element in the Area 2 column is 11, so subtract 11 from each element in the column. Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 11 16 20 Jane 19 26 18 Kate 7 23 35 29 Lucy 27 21 17 Mike 2 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 16 20 Jane 8 26 18 Kate 7 12 35 29 Lucy 21 17 Mike 2 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 11 16 20 Jane 19 26 18 Kate 7 23 35 29 Lucy 27 21 17 Mike 2 15 28 25

7 The Hungarian Algorithm – Non-square arrays
The Hungarian Algorithm – Non-square arrays Method 1 Step 1: Reduce the array by column subtractions To reduce by column subtractions, subtract the smallest element in each column from each element in the column. The smallest element in the Area 3 column is 16, so subtract 16 from each element in the column. Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 16 20 Jane 8 26 18 Kate 7 12 35 29 Lucy 21 17 Mike 2 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 20 Jane 8 10 18 Kate 7 12 19 29 Lucy 16 5 17 Mike 2 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 16 20 Jane 8 26 18 Kate 7 12 35 29 Lucy 21 17 Mike 2 28 25

8 The Hungarian Algorithm – Non-square arrays
The Hungarian Algorithm – Non-square arrays Method 1 Step 1: Reduce the array by column subtractions To reduce by column subtractions, subtract the smallest element in each column from each element in the column. The smallest element in the Area 4 column is 17, so subtract 17 from each element in the column. Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 20 Jane 8 10 18 Kate 7 12 19 29 Lucy 16 5 17 Mike 2 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 3 Jane 8 10 1 Kate 7 12 19 Lucy 18 16 5 Mike 2 Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 20 Jane 8 10 18 Kate 7 12 19 29 Lucy 16 5 17 Mike 2 25

9 The Hungarian Algorithm – Non-square arrays
The Hungarian Algorithm – Non-square arrays Method 1 Step 2: Cover the zero elements with the minimum number of lines Look for rows and columns containing more than one zero. In this case, Ian’s row, Jane’s row, Lucy’s row and the dummy column all contain more than one zero, so cover these with lines. Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 3 Jane 8 10 1 Kate 7 12 19 Lucy 18 16 5 Mike 2 Four lines have been used for this 5 by 5 array, so this array does not give the optimal allocation.

10 The Hungarian Algorithm – Non-square arrays
The Hungarian Algorithm – Non-square arrays Method 1 Step 3: Augment the elements The smallest uncovered element is 2. Subtract 2 from all uncovered elements and add 2 to all elements covered by two lines Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 3 2 Jane 8 10 1 Kate 5 17 Lucy 18 16 Mike 6 Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 3 Jane 8 10 1 Kate 5 17 Lucy 18 16 Mike 2 6 Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 3 Jane 8 10 1 Kate 7 12 19 Lucy 18 16 5 Mike 2 Now return to Step 2.

11 The Hungarian Algorithm – Non-square arrays Method 1
Step 2: Cover the zero elements with the minimum number of lines Look for rows and columns containing more than one zero. In this case, Ian’s row, the Area 1 column and the dummy column all contain more than one zero, so cover these with lines (the two zeros in Mike’s row are covered by column lines). The remaining zero can be covered by either a vertical or horizontal line. The choice of line will not affect the final result. Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 3 2 Jane 8 10 1 Kate 5 17 Lucy 18 16 Mike 6 Four lines have been used for this 5 by 5 array, so this array does not give the optimal allocation.

12 The Hungarian Algorithm – Non-square arrays Method 1
Step 3: Augment the elements The smallest uncovered element is 1. Subtract 1 from all uncovered elements and add 1 to all elements covered by two lines Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 3 2 Jane 7 9 Kate 5 16 Lucy 18 Mike 1 Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 3 2 Jane 8 10 1 Kate 5 17 Lucy 18 16 Mike 6 Area 1 Area 2 Area 3 Area 4 Dummy Ian 3 1 Jane 7 9 2 Kate 5 16 Lucy 17 Mike Now return to Step 2.

13 The Hungarian Algorithm – Non-square arrays
The Hungarian Algorithm – Non-square arrays Method 1 Step 2: Cover the zero elements with the minimum number of lines Look for rows and columns containing more than one zero. In this case, Ian’s row, the Area 1 column, the Area 4 column and the dummy column all contain more than one zero, so cover these with lines. Area 1 Area 2 Area 3 Area 4 Dummy Ian 3 1 Jane 7 9 2 Kate 5 16 Lucy 17 Mike Four lines have been used for this 5 by 5 array, so this array does not give the optimal allocation.

14 The Hungarian Algorithm – Non-square arrays
The Hungarian Algorithm – Non-square arrays Method 1 Step 3: Augment the elements The smallest uncovered element is 1. Subtract 1 from all uncovered elements and add 1 to all elements covered by two lines Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 2 Jane 6 8 Kate 5 15 9 Lucy 17 1 Mike Area 1 Area 2 Area 3 Area 4 Dummy Ian 3 1 Jane 6 8 2 Kate 5 15 9 Lucy 17 4 Mike Area 1 Area 2 Area 3 Area 4 Dummy Ian 3 1 Jane 7 9 2 Kate 5 16 Lucy 17 Mike Now return to Step 2.

15 The Hungarian Algorithm – Non-square arrays
The Hungarian Algorithm – Non-square arrays Method 1 Step 2: Cover the zero elements with the minimum number of lines In this case, it is not possible to cover the zero elements with less than five lines. There are several different ways of covering them with five lines. Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 2 Jane 6 8 Kate 5 15 9 Lucy 17 1 Mike Since five lines are required for this 5 by 5 array, the optimal allocation can now be found from this array. Now go to Step 4.

16 The Hungarian Algorithm – Non-square arrays Method 1
Step 4: Identify the maximal matching using zero elements. Look for rows and columns containing just one zero. There is just one zero in Kate’s row and in Lucy’s row, and there is just one zero in column 3. This means that Jane must be matched with Area 1, and Mike with Area 2. Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 2 Jane 6 8 Kate 5 15 9 Lucy 17 1 Mike Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 2 Jane 6 8 Kate 5 15 9 Lucy 17 1 Mike Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 2 Jane 6 8 Kate 5 15 9 Lucy 17 1 Mike Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 2 Jane 6 8 Kate 5 15 9 Lucy 17 1 Mike

17 The Hungarian Algorithm – Non-square arrays Method 1
Step 4: Identify the maximal matching using zero elements. From the array, Ian is allocated Area 3, Jane is allocated Area 1, Lucy is allocated Area 4 and Mike is allocated Area 2. Kate is not required. Going back to the original array gives the distances for each person. Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 35 Jane 14 19 26 Kate 21 23 29 Lucy 32 27 17 Mike 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 4 2 Jane 6 8 Kate 5 15 9 Lucy 17 1 Mike Total distance to be travelled = = 62.

18 The Hungarian Algorithm – Non-square arrays
Click here to see the example using Method 1 again. Click here to see the example using Method 2. Click here to end the presentation.

19 The Hungarian algorithm for non-square arrays: Method 2
The Hungarian Algorithm – Non-square arrays Method 2 The Hungarian algorithm for non-square arrays: Method 2 Add a dummy row or column to make the array square. Fill this with the largest number in the existing array. Then apply the standard Hungarian algorithm: Step 1 Reduce the array by both row and column subtractions Step 2 Cover the zero elements with the minimum number of lines. If the number of lines is the same as the size of the array, then go to Step 4. Step 3 Augment the elements. To do this, identify the minimum uncovered element. Subtract this element from all uncovered elements, and add this element to all elements covered by two lines. Then return to step 2. Step 4 Identify the maximal matching which uses only zero elements, and apply this matching to the original array to find the minimum cost.

20 The Hungarian Algorithm – Non-square arrays Method 2
Example A company has five representatives availiable on a particular day. Four representatives are needed to attend meetings in different areas. The distance each representative would need to drive from home to attend each of the meetings is shown in the table below. Use the Hungarian algorithm to find out which representative should visit each area in order to keep the total distance travelled as low as possible. Area 1 Area 2 Area 3 Area 4 Ian 18 11 16 20 Jane 14 19 26 Kate 21 23 35 29 Lucy 32 27 17 Mike 15 28 25

21 The Hungarian Algorithm – Non-square arrays Method 2
This array has five rows and four columns, so first you need to add a dummy column to give a square array. The largest element in the array is 35, so each element in the dummy column is set to be 35. Because the problem is a minimisation problem, we have used the largest element so that it does not occur in the solution Area 1 Area 2 Area 3 Area 4 Ian 18 11 16 20 Jane 14 19 26 Kate 21 23 35 29 Lucy 32 27 17 Mike 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 Jane 14 19 26 Kate 21 23 35 29 Lucy 32 27 17 Mike 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 35 Jane 14 19 26 Kate 21 23 29 Lucy 32 27 17 Mike 15 28 25

22 The Hungarian Algorithm – Non-square arrays Method 2
Step 1: Reduce the array by both row and column subtractions To reduce by row subtractions, subtract the smallest element in each row from each element in the row. The smallest element in Ian’s row is 11, so subtract 11 from each element in the row. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 14 19 26 18 35 Kate 21 23 29 Lucy 32 27 17 Mike 16 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 35 Jane 14 19 26 Kate 21 23 29 Lucy 32 27 17 Mike 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 35 Jane 14 19 26 Kate 21 23 29 Lucy 32 27 17 Mike 15 28 25

23 The Hungarian Algorithm – Non-square arrays Method 2
Step 1: Reduce the array by both row and column subtractions To reduce by row subtractions, subtract the smallest element in each row from each element in the row. The smallest element in Jane’s row is 14, so subtract 14 from each element in the row. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 23 35 29 Lucy 32 27 17 Mike 16 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 14 19 26 18 35 Kate 21 23 29 Lucy 32 27 17 Mike 16 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 14 19 26 18 35 Kate 21 23 29 Lucy 32 27 17 Mike 16 15 28 25

24 The Hungarian Algorithm – Non-square arrays Method 2
Step 1: Reduce the array by both row and column subtractions To reduce by row subtractions, subtract the smallest element in each row from each element in the row. The smallest element in Kate’s row is 21, so subtract 21 from each element in this row. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 32 27 17 35 Mike 16 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 23 35 29 Lucy 32 27 17 Mike 16 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 23 35 29 Lucy 32 27 17 Mike 16 15 28 25

25 The Hungarian Algorithm – Non-square arrays Method 2
Step 1: Reduce the array by both row and column subtractions To reduce by row subtractions, subtract the smallest element in each row from each element in the row. The smallest element in Lucy’s row is 17, so subtract 17 from each element in this row. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 16 28 25 35 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 32 27 17 35 Mike 16 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 32 27 17 35 Mike 16 15 28 25

26 The Hungarian Algorithm – Non-square arrays Method 2
Step 1: Reduce the array by both row and column subtractions To reduce by row subtractions, subtract the smallest element in each row from each element in the row. The smallest element in Mike’s row is 15, so subtract 15 from each element in this row. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 1 13 20 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 16 28 25 35 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 16 28 25 35

27 The Hungarian Algorithm – Non-square arrays Method 2
Allocation problems - The Hungarian Algorithm Step 1: Reduce the array by both row and column subtractions The minimum number of lines needed to cover all the zeros is 3, so the solution is not optimal. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 1 13 20 Now reduce the array by subtracting the minimum entry in each column from all the entries in the column.

28 The Hungarian Algorithm – Non-square arrays Method 2
Step 1: Reduce the array by both row and column subtractions To reduce by column subtractions, subtract the smallest element in each column from each element in the column. Columns 1, 2 and 4 already contain zeros, so cannot be reduced. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 1 13 20 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 1 13 20

29 The Hungarian Algorithm – Non-square arrays Method 2
Step 1: Reduce the array by both row and column subtractions To reduce by column subtractions, subtract the smallest element in each column from each element in the column. The smallest number in column 3 is 4, so subtract 4 from each element in this column. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 24 Jane 5 8 4 21 Kate 2 10 14 Lucy 15 18 Mike 20 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 1 13 20 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 5 9 24 Jane 12 4 21 Kate 2 14 8 Lucy 15 10 18 Mike 1 13 20

30 The Hungarian Algorithm – Non-square arrays Method 2
Step 1: Reduce the array by both row and column subtractions To reduce by column subtractions, subtract the smallest element in each column from each element in the column. The smallest number in column 5 is 14, so subtract 14 from each element in this column. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 10 Jane 5 8 4 Kate 2 Lucy 15 Mike 6 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 24 Jane 5 8 4 21 Kate 2 10 14 Lucy 15 18 Mike 20 Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 24 Jane 5 8 4 21 Kate 2 10 14 Lucy 15 18 Mike 20

31 The Hungarian Algorithm – Non-square arrays
The Hungarian Algorithm – Non-square arrays Method 2 Step 2: Cover the zero elements with the minimum number of lines Look for rows and columns containing more than one zero. In this case, Kate’s row, Lucy’s row and column 2 all contain two zeros, so cover these with lines. The remaining zero can be covered by either a vertical or horizontal line. The choice of line will not affect the final result. Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 10 Jane 5 8 4 Kate 2 Lucy 15 Mike 6 Four lines have been used for this 5 by 5 array, so this array does not give the optimal allocation.

32 The Hungarian Algorithm – Non-square arrays Method 2
Step 3: Augment the elements The smallest uncovered element is 1. Subtract 1 from all uncovered elements and add 1 to all elements covered by two lines Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 10 Jane 5 8 4 Kate 2 Lucy 15 Mike 6 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 5 4 7 Kate 2 10 Lucy 15 Mike Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5

33 The Hungarian Algorithm – Non-square arrays Method 2
Step 3: Augment the elements The smallest uncovered element is 1. Subtract 1 from all uncovered elements and add 1 to all elements covered by two lines Area 1 Area 2 Area 3 Area 4 Dummy Ian 7 1 9 10 Jane 5 8 4 Kate 2 Lucy 15 Mike 6 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 5 4 7 Kate 2 10 Lucy 15 Mike Now return to Step 2.

34 The Hungarian Algorithm – Non-square arrays
The Hungarian Algorithm – Non-square arrays Method 2 Step 2: Cover the zero elements with the minimum number of lines. In this case, it is not possible to cover the zero elements with less than five lines. There are several different ways of covering them with five lines. Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Since five lines are required for this 5 by 5 array, the optimal allocation can now be found from this array. Now go to Step 4.

35 The Hungarian Algorithm – Non-square arrays Method 2
Step 4: Identify the maximal matching using zero elements. Look for rows and columns containing just one zero. There is just one zero in Jane’s row, and there is just one zero in column 4 and in the dummy column. This means that Mike must be matched with Area 2, and Ian with Area 3. Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5

36 The Hungarian Algorithm – Non-square arrays Method 2
Step 4: Identify the maximal matching using zero elements. From the array, Ian is allocated Area 3, Jane is allocated Area 1, Lucy is allocated Area 4 and Mike is allocated Area 2. Kate is not required. Going back to the original array gives the distances for each person. Area 1 Area 2 Area 3 Area 4 Dummy Ian 18 11 16 20 35 Jane 14 19 26 Kate 21 23 29 Lucy 32 27 17 Mike 15 28 25 Area 1 Area 2 Area 3 Area 4 Dummy Ian 6 8 9 Jane 4 7 Kate 3 10 Lucy 15 11 Mike 5 Total distance to be travelled = = 62.

37 The Hungarian Algorithm – Non-square arrays
Click here to see the example using Method 1. Click here to see the example using Method 2 again. Click here to end the presentation.


Download ppt "The Hungarian algorithm for non-square arrays"

Similar presentations


Ads by Google