1 / 27

Management Science 461

Management Science 461. Lecture 2b – Shortest Paths September 16, 2008. Graph Theory. Branch of mathematics “Graph” has a very specific definition: Collection of objects Collection of relationships between objects Both collections can have associated data (costs, weights).

jameskeen
Download Presentation

Management Science 461

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. Management Science 461 Lecture 2b – Shortest Paths September 16, 2008

  2. Graph Theory • Branch of mathematics • “Graph” has a very specific definition: • Collection of objects • Collection of relationships between objects • Both collections can have associated data (costs, weights)

  3. Physical Abstraction • Euler and the Königsberg Bridges - 1736

  4. 5 2 8 5 5 1 3 9 2 3 4 4 Shortest Path Problems • Find the shortest (distance, time, cost) path between two nodes (e.g. 15) Node = Vertex Arc = Edge = Link Route = Path Tour = Circuit = Cycle

  5. 5 2 8 5 5 1 3 9 2 3 4 4 Algebraic formulation

  6. 2 5 1 3 4 Flow and Integrality Constraints subject to x12 + x13= 1 (node 1) x12 + x32+ x42= x23 + x24+ x25 (node 2) x13 + x23+ x43= x32 + x34 (node 3) x34 + x24= x43+ x42+ x45 (node 4) x25+ x45= 1 (node 5) xij= 0 or 1 for all i, j

  7. 2 5 1 3 4 Rearranging, we get… Flow in = flow out  flow in – flow out = 0 subject to - x12 - x13= -1 (node 1) x12 + x32+ x42 - x23 - x24 - x25= 0 (node 2) x13 + x23+ x43 - x32 - x34= 0 (node 3) x34 + x24 - x43 - x42 - x45= 0 (node 4) x25+ x45= 1 (node 5) xij= 0 or 1 for all i, j Do these -1, 0, 1 values look familiar?

  8. Shortest Path Problems • Solve using Excel’s Solver • However, a network with several hundred nodes would be out of reach, even for Premium Solver • e.g. Edmonton • Efficient algorithms need to be used – like Dijkstra’s algorithm

  9. Dijkstra’s algorithm • “Label-setting” algorithm • At each node, keep track of minimum distance from origin to the node, and how we got there • Very fast – polynomial time algorithm • Time to solve increases polynomially with problem size (not exponential)

  10. Dijkstra’s Algorithm 2 5 8 5 5 1 3 9 2 3 4 4

  11. Step 0 – Place Labels Dist:  Pred: 2 2 Dist:  Pred: 5 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist:  Pred: 3 4 Dist:  Pred: 4

  12. Step 1 – Choose Minimum Label Dist:  Pred: 2 2 Dist:  Pred: 5 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist:  Pred: 3 4 Dist:  Pred: 4

  13. Step 2 – Update Adjacent Labels Dist: 8 Pred: 1 2 Dist:  Pred: 5 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist:  Pred: 4

  14. Step 2b – Mark Node As Optimal Dist: 8 Pred: 1 2 Dist:  Pred: 5 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist:  Pred: 4

  15. Step 3 – Choose Next Min Dist Dist: 8 Pred: 1 2 Dist:  Pred: 5 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist:  Pred: 4

  16. Step 4 – Update Adjacent Labels Dist: 7 Pred: 3 2 Dist:  Pred: 5 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist: 6 Pred: 3

  17. Step 4b – Mark Node As Optimal Dist: 7 Pred: 3 2 Dist:  Pred: 5 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist: 6 Pred: 3

  18. Step 5 – Choose Next Min Dist Dist: 7 Pred: 3 2 Dist:  Pred: 5 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist: 6 Pred: 3

  19. Step 6 – Update Adjacent Labels Dist: 7 Pred: 3 2 Dist: 15 Pred: 4 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist: 6 Pred: 3

  20. Step 6b – Mark Node As Optimal Dist: 7 Pred: 3 2 Dist: 15 Pred: 5 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist: 6 Pred: 3

  21. Step 7 – Choose Next Min Dist Dist: 7 Pred: 3 2 Dist: 15 Pred: 5 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist: 6 Pred: 3

  22. Step 8 – Update Adjacent Labels Dist: 7 Pred: 3 2 Dist: 12 Pred: 2 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist: 6 Pred: 3

  23. Step 8b – Mark Node As Optimal Dist: 7 Pred: 3 2 Dist: 12 Pred: 2 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist: 6 Pred: 3

  24. Step 9 – Choose Next Min Dist Dist: 7 Pred: 3 2 Dist: 12 Pred: 2 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist: 6 Pred: 3

  25. Step 10 – Update Adjacent Labels Dist: 7 Pred: 3 2 Dist: 12 Pred: 2 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist: 6 Pred: 3

  26. Step 10b – Mark Node As Optimal Dist: 7 Pred: 3 2 Dist: 12 Pred: 2 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist: 6 Pred: 3

  27. Final Solution – Min Dist Tree Dist: 7 Pred: 3 2 Dist: 12 Pred: 2 5 8 Dist: 0 Pred: 1 5 5 1 3 9 2 3 4 Dist: 2 Pred: 1 4 Dist: 6 Pred: 3

More Related