1 / 24

Shortest Path

LGM 651 Freight Transportation Management การจัดการการขนส่งสินค้า Class 3 (30 มิ.ย. 2553) Shortest Path (Model 1 & 2) Traveling Salesman ส่วน 1. หาเส้นทางที่มีระยะทางสั้นสุดระหว่างจุดเริ่มต้นกับจุดหมาย. Shortest Path. 4. 17. 5. 2. 8. 9. 3. 8. 5. 3. จุดหมาย. จุดเริ่มต้น. 11. 7.

yates
Télécharger la présentation

Shortest Path

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. LGM 651Freight Transportation Managementการจัดการการขนส่งสินค้าClass 3 (30 มิ.ย. 2553)Shortest Path (Model 1 & 2)Traveling Salesman ส่วน 1

  2. หาเส้นทางที่มีระยะทางสั้นสุดระหว่างจุดเริ่มต้นกับจุดหมายหาเส้นทางที่มีระยะทางสั้นสุดระหว่างจุดเริ่มต้นกับจุดหมาย Shortest Path 4 17 5 2 8 9 3 8 5 3 จุดหมาย จุดเริ่มต้น 11 7 9 1 3 2 12 6 9 1 7 2 4 14 7

  3. ตัวอย่างคำตอบ Shortest Path 4 17 5 2 8 9 3 8 5 3 จุดหมาย จุดเริ่มต้น 11 7 9 2 1 3 12 6 9 1 7 2 4 14 7 เส้นทาง 1-3-6-8-9 รวมระยะทาง 7+2+11+5 = 25หน่วย

  4. เส้นทาง 1-2-3-6-7-9 มีระยะทางสั้นสุดคือ 17 หน่วย Shortest Path 4 17 5 2 8 9 3 8 5 3 จุดหมาย จุดเริ่มต้น 11 7 9 1 3 2 12 6 9 1 7 2 4 14 7

  5. Constraint ของ Node ต่างๆ จุดเริ่มต้น เข้า 0 ออก 1 = 0 - 1 = -1 1 จุดหมาย เข้า 1 ออก 0 = 1 - 0 = 1 9 วิ่งผ่าน เข้า 1 ออก 1 = 1 - 1 = 0 6 ไม่ผ่าน เข้า 0 ออก 0 = 0 - 0 = 0 4

  6. Excel Formula (Model 1) จากจุด 6 ไปจุด 9 ใช้ระยะทาง 12 หน่วย =SUM(L14:L22) {=TRANSPOSE(M14:M22)} =H23+H24 =D23-D24 =SUMPRODUCT(D3:L11,D14:L22)

  7. Excel Formula (Model 2) =SUMPRODUCT(D4:D35,E4:E35) =IF(O$3=$C4,1,0)*$E4 =IF(F$3=$B4,1,0)*$E4 =SUM(F4:F35) =O37-F36 =SUM(O4:O35)

  8. Solver Parameters (Model 1) Check at Assume Linear Model and Assume Non-Negative

  9. Solver Parameters (Model 2)

  10. By Changing Cells Possible Solutions Model 1 9x9 = 81 variables 2 = 2x10 Model 2 32 variables 2 = 4x10 Model 1 vs Model 2 • 24 32 9

  11. Math Model ของ LP_Solve (Model 2)

  12. Math Model แบบมาตราฐาน (Model 2) E คือ set ที่มีประกอบด้วยสมาชิกคือเส้นทาง(ที่มีทิศการวิ่ง)เชื่อมระหว่างจุดต่างๆในโครงข่ายเช่น E = { (1,2), (1,3), (1,4), (2,1), (3,1), (4,1), (2,3), ……. , (8,9), (9,8) }Xij ตัวแปรตัดสินใจ Xij =1 ถ้าเลือกเส้นทางจากจุด iไปจุด j ถ้าXij =0 ไม่เลือกCij คือระยะทางของเส้นทางที่วิ่งจากจุด iไปจุด j Min Subject to ไม่มีก็ได้

  13. Math Model แบบมาตราฐาน (Model 1) ไม่มีก็ได้ เขียนแบบ format Latex ที่เว็บไซด์ http://www.codecogs.com/latex/eqneditor.php:Max \ \ \ \ z = \sum_{i=1}^{9} \sum_{j=1}^{9} C_{ij}X_{ij} \\subject \ to \ \ \ \ \sum_{i=1}^{9} X_{ik} - \sum_{j=1}^{9} X_{kj} = - 1, \ k = 1 \\ \begin{matrix} &&&&&& \end{matrix} \sum_{i=1}^{9} X_{ik} - \sum_{j=1}^{9} X_{kj} = 0, \ \ \ \ k = 2,..,8 \\ \begin{matrix} &&&&&& \end{matrix} \sum_{i=1}^{9} X_{ik} - \sum_{j=1}^{9} X_{kj} = 1, \ \ \ \ k = 9 \\ \begin{matrix} &&&&&& \end{matrix} X_{ij} = \left \{ 0,1 \right \}, \ \ \ \ i = 1,..,9; j = 1,..,9

  14. เขียนสมการคณิตศาสตร์บน internet http://www.codecogs.com/latex/eqneditor.php

  15. Math Model แบบ Lingo (Model 1)

  16. จาก สนามหลวง-มาบุญครอง ใน Google Map http://maps.google.co.th 7.1 กม.15 นาที

  17. Google Map เลือกเส้นทางที่ชอบได้ เลือกเปลี่ยนเส้นทางได้ที่จุดขาวๆ 7.7 กม.16 นาที(จริงหรือ?)

  18. หาเส้นทางเดินของพนักงานขาย(หรือรถส่งของ) ให้มีระยะทางสั้นสุด จากบริษัทไปหาทุกๆ ลูกค้าและกลับมาที่บริษัท Traveling SalesmanProblem (TSP) ลูกค้า ลูกค้า บริษัท ลูกค้า ลูกค้า ลูกค้า

  19. TSP is very famous!

  20. Constraint ของ Node ใน TSP เข้า-ออก เข้า+ออก บริษัท เข้า 1 ออก 1 0 2 ลูกค้า เข้า 1 ออก 1 0 2 ไม่ใช่ลูกค้าและไม่ผ่าน เข้า 0 ออก 0 0 0 ไม่ใช่ลูกค้าแต่ผ่าน เข้า 1 ออก 1 0 2

  21. หาเส้นทาง TSP เดินผ่านทุกจุด 4 17 5 2 8 9 3 8 5 3 บริษัท 11 7 9 1 3 2 12 6 9 1 7 2 4 14 7

  22. Excel Formula (TSP) =E4+E7 =F36+O37

  23. Solver Parameters (TSP) เลขจำนวนเต็ม เข้า-ออก เข้า+ออก แตก sub tour

  24. หาเส้นทาง TSP จากบริษัท (จุด 6) ไปยังลูกค้า 5 แห่ง (ต้องผ่านจุด 1,3,4,5,9) ทั้ง 3 โปรแกรม เขียน Math Model แบบมาตราฐาน (ต้องใส่ constraint แตก subtour ใน Math Model ด้วย) แบบฝึกหัดในห้องทำเป็นคู่ 4 17 5 2 8 9 3 8 5 3 11 7 9 1 3 2 12 6 บริษัท 9 1 7 2 4 14 7

More Related