1 / 49

กำหนดการพลวัต ( Dynamic programming )

กำหนดการพลวัต ( Dynamic programming ). Dynamic programming จะเหมาะกับการแก้ปัญหา optimization ตัวอย่างเช่น Longest Common Subsequence. Longest Common Subsequence. X = <H, E, L, L, O> มี subsequences < H , E , L, L, O >  < H , E > < H , E , L, L, O >  < H , E , O >

keely-logan
Download Presentation

กำหนดการพลวัต ( Dynamic programming )

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. กำหนดการพลวัต(Dynamic programming)

  2. Dynamic programming จะเหมาะกับการแก้ปัญหา optimization ตัวอย่างเช่น • Longest Common Subsequence

  3. Longest Common Subsequence • X = <H, E, L, L, O> มี subsequences • <H, E, L, L, O>  <H, E> • <H, E, L, L, O>  <H, E, O> • <H, E, L, L, O> <> • … • Y = <H, E, R, O> • <H, E, R, O>  <H, E> • <H, E, R, O>  <H, O> • <H, E, R, O>  <H, E, O> • … • ลำดับย่อยร่วม Common subsequence(X, Y) • ลำดับย่อยร่วมที่ยาวที่สุด longest common subsequence(X, Y) หรือ LCS มีลำดับย่อยทั้งหมด 25 = 32

  4. นิยาม ตัววัดคุณภาพของ LCS

  5. คำตอบปัญหาใหญ่ได้จากคำตอบปัญหาย่อยๆคำตอบปัญหาใหญ่ได้จากคำตอบปัญหาย่อยๆ

  6. คำตอบปัญหาใหญ่ได้จากคำตอบปัญหาย่อยๆคำตอบปัญหาใหญ่ได้จากคำตอบปัญหาย่อยๆ

  7. Recurrence ของ L(i,j)

  8. Recurrence ของ L(i,j)

  9. Recurrence ของ L(i,j)

  10. LCS: Top-down

  11. หาความยาว LCS : เวลาการทำงาน

  12. LCS: Best case เมือ?

  13. Top-down + Memoization

  14. LCS: memoization

  15. LCS : Bottom-up

  16. LCS : Dynamic Programming

  17. ต้องการ LCS : จำผลการตัดสินใจ

  18. จำผลการตัดสินใจ

  19. ใช้ผลการตัดสินใจสร้างคำตอบใช้ผลการตัดสินใจสร้างคำตอบ

  20. ต้องการประหยัด ไม่จำผลการตัดสินใจ

  21. LCS_Soln(x,y,L)

  22. สะกดผิด : หาคำใกล้เคียง

  23. Minimum Edit Distance

  24. สรุปลักษณะของปัญหาที่เหมาะกับ Dynamic Prog.

  25. Optimal substructures

  26. Longest Simple Path

  27. 0/1 Knapsack

  28. 0/1 Knapsack

  29. แบ่งปัญหาใหญ่เป็นปัญหาย่อยแบ่งปัญหาใหญ่เป็นปัญหาย่อย

  30. หาคำตอบใหญ่จากคำตอบเล็กหาคำตอบใหญ่จากคำตอบเล็ก

  31. ปัญหาใหญ่ : ปัญหาย่อย

  32. เขียน recurrence V(i, j)

  33. Knapsack : Top-down

More Related