1 / 48

Floyd’s Algorithm can be used to help solve Travelling Salesman

M. 48. B. 19. 10. 23. 20. L. 10. 7. 18. A. X. Floyd’s Algorithm can be used to help solve Travelling Salesman and other shortest routes problems. Floyd’s uses a matrix form. To look back at the network click here:. D( 0 ). R( 0 ). This is the route matrix.

Download Presentation

Floyd’s Algorithm can be used to help solve Travelling Salesman

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. M 48 B 19 10 23 20 L 10 7 18 A X Floyd’s Algorithm can be used to help solve Travelling Salesman and other shortest routes problems. Floyd’s uses a matrix form. page 1

  2. To look back at the network click here: D( 0 ) R( 0 ) This is the route matrix. It will eventually show the next vertex that needs to be taken on route to finding the shortest route to another vertex. This is the distance matrix. It initially shows the direct distance between one vertex and the others. The infinity sign denotes no direct route. • To view the process step by step click here • To view the completed matrices click here page 2

  3. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) Click here to see step:

  4. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) 23 + 23 = 46, less than so change. Click here to see step:

  5. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) 23 + 23 = 46, less than so change. Click here to see step:

  6. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) 10 + 23 = 33, so we leave this item Click here to see step:

  7. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) When is involved we leave the item. Click here to see step:

  8. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) 18 + 23 = 41, so we replace the item. Click here to see step:

  9. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) 18 + 23 = 41, so we replace the item. Click here to see step:

  10. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) 23 + 10 = 33, so we leave this item. Click here to see step:

  11. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) 10 + 10 = 20, so we replace this item. Click here to see step:

  12. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) Infinity is involved so we leave this item. Click here to see step:

  13. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) 18 + 10 = 28 which is more than 7 so we leave this item. Click here to see step:

  14. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) Infinity is involved so we leave this item. Click here to see step:

  15. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) Infinity is involved so we leave this item. Click here to see step:

  16. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) Infinity is involved so we leave this item. Click here to see step:

  17. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) Infinity is involved so we leave this item. Click here to see step:

  18. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) We replace this item with 23 + 18 = 41 Click here to see step:

  19. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) We replace this item with 23 + 18 = 41 Click here to see step:

  20. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) 10 + 18 = 28, 7 is less than this so leave it. Click here to see step:

  21. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) Infinity is involved so leave this item. Click here to see step:

  22. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) 18 + 18 = 36, so replace this item. Click here to see step:

  23. We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. D( 0 ) R( 0 ) 18 + 18 = 36, so replace this item. Click here to see step:

  24. D( 0 ) R( 0 ) Click here to see step:

  25. D( 0 ) R( 0 ) Click here to see step:

  26. D( 0 ) R( 0 ) Click here to see step:

  27. D( 0 ) R( 0 ) Click here to see step:

  28. D( 0 ) R( 0 ) Click here to see step:

  29. D( 0 ) R( 0 ) Click here to see step:

  30. We have now completed one iteration. We rename the new matrices: D( 1 ) R( 1 ) Subsequent iterations are now shown completed: Click here to see step: Click here to see final matrices:

  31. D( 1 ) R( 1 ) Subsequent iterations are now shown completed: Click here to see step: Click here to see final matrices:

  32. The items have been altered accordingly: D( 1 ) R( 1 ) Subsequent iterations are now shown completed: Click here to see step: Click here to see final matrices:

  33. We can now rename the matrices: D( 2 ) R( 2 ) Click here to see step: Click here to see final matrices:

  34. Next iteration: D( 2 ) R( 2 ) Click here to see step: Click here to see final matrices:

  35. Next iteration, the items are altered appropriately : D( 2 ) R( 2 ) Click here to see step: Click here to see final matrices:

  36. The matrices are renamed : D( 3 ) R( 3 ) Click here to see step: Click here to see final matrices:

  37. The next iteration : D( 3 ) R( 3 ) Click here to see step: Click here to see final matrices:

  38. In this iteration, you do not need to change any of the items, so we go onto the next iteration : D( 3 ) R( 3 ) Click here to see step: Click here to see final matrices:

  39. D( 4 ) R( 4 ) Click here to see step: Click here to see final matrices:

  40. There is only one item that we need to change in this case: D( 4 ) R( 4 ) Click here to see step: Click here to see final matrices:

  41. These are the final matrices, remember that you can use them to redraw the original network. You can then use this to help us solve travelling salesman problems: D( 5 ) R( 5 ) Click here to see new network:

  42. 29 17 M 29 B 19 10 20 20 L 10 7 17 A X This network now gives you a better idea of the quickest routes. Click below to try a question: The route matrix gives us an idea about the next vertex to visit on route - 1 represents A, 2 - M, etc. page 1

  43. 1 5 4 3 2 15 32 30 35 75 70 40 Try this one! Click below when you have completed it to check the answers:

  44. These are the completed matrices. Are yours correct? D( 5 ) R( 5 )

  45. 1 5 4 3 2 Qu2. 35 50 15 12 20 10 50 Answers…………….

  46. These are the completed matrices. Are yours correct? D( 5 ) R( 5 )

  47. 1 4 3 2 Qu2. 3 5 3 8 2 4 Answers…………….

  48. These are the completed matrices. Are yours correct? D( 4 ) R( 4 )

More Related