งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

สัปดาห์ที่ 8 Basic Pathfinding, A* and Waypoint อ. เทพฤทธิ์ สินธำรงรักษ์ เรียบเรียง.

งานนำเสนอที่คล้ายกัน


งานนำเสนอเรื่อง: "สัปดาห์ที่ 8 Basic Pathfinding, A* and Waypoint อ. เทพฤทธิ์ สินธำรงรักษ์ เรียบเรียง."— ใบสำเนางานนำเสนอ:

1 สัปดาห์ที่ 8 Basic Pathfinding, A* and Waypoint อ. เทพฤทธิ์ สินธำรงรักษ์ เรียบเรียง

2  Basic Pathfinding  Random Movement Obstacle  Tracing Around Obstacle  Wall Tracing  A* Pathfinding  Waypoint

3 If (positionX > destinationX) positionX--; Else if (positionX < destinationX) positionX++; If (positionY>destinationY) positionY--; Else if (positionY < destinationY) positionY++;

4

5

6

7

8

9  อ่านว่า “ เอ - สตาร์ ” เป็นวิธีพัฒนาขึ้นมาเพื่อแก้ปัญหา Local Optimum โดยจะเปลี่ยนสมการ Fitness Function เป็น  f(n) = g(n)+h(n)

10

11  ปัญหาการค้นหาเส้นทางในกรุงเทพมหานคร

12  เริ่มต้นจากเขตราชบูรณไปยังเขตมีนบุรี

13

14

15

16

17  A* เป็น algorithm ที่ทาการค้นหาเส้นทางที่ดีที่สุดจาก จุดเริ่มต้นไปยังจุดสุดท้าย  จุดแต่ละจุดหรือ Node ที่ต้องใช้ในการคิดซึ่งอาจจะเป็น cell, tile, point ก็แล้วแต่จะเรียก  Cost: ระดับของ Node ที่คำนวณได้ในแต่ละเส้นทางที่ เหมาะสม มีอยู่ด้วยกันสามส่วน  f: Cost รวมของผลที่ได้จากการคานวณด้วย g + h ซึ่ง สุดท้ายจะเอามาตัดสินใจว่าเส้นทางใหนที่ดีกว่ากันยิ่งน้อย ยิ่งดี  g: Cost ที่ได้จาก Node เริ่มต้นไปถึงโหนดที่กำลัง พิจารณา  h: Cost ที่ได้จากการประมาณของ Node ที่กำลังพิจารณา ไปถึง Node สุดท้าย  Node อันใหนที่มีค่า cost ของ Node น้อยที่สุดจะถูกเอา ไปคำนวณต่อไป

18 Initial StateGoal State ตัวอย่างปัญหาเกมส์ 8- Puzzle Initial state: สถานะเริ่มต้นให้มีตาแหน่งที่วาง ผิด 3 ตำแหน่ง Successor function: ขึ้น ลง ซ้าย และขวา Goal state: ตัวเลขทั้ง 8 ตัวที่วางอยู่ถูกต้องตาม กาหนด Path cost: การเคลื่อนที่ของช่องแต่ละช่อง นับเป็น 1

19 Goal State (a) f = g + h f = = 3 (b) (c) f = = 5 f = = 3

20 (d) (f) f = 2+ 3 = 5 f = = 3 Goal State (c) (e) f = 2+ 1 = 3f = 2+ 3 = 5

21 (g)(i) f = 3+ 2 = 5 f = = 3 Goal State (e) (h) f = 3+ 2 = 5f = 3+ 0 = 3 f = 3+ 2 = 5 (j)

22 แบบที่ 1 แบบที่ 2

23 Wall (1,5)(7,5)

24 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 (1,5) f = 6 g = 1 h =5 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =

25 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h =

26 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h =

27 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h =

28 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h =

29 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h =

30 f = 9.2 g = 3.4 h =5.4 f = 7.9 g = 2.8 h =5.1 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h =

31 f = 9.2 g = 3.4 h =5.4 f = 7.9 g = 2.8 h =5.1 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = จำค่าไว้ ปัญหาอยู่ตรงนี้แหละ

32 f = 9.2 g = 3.4 h =5.4 f = 7.9 g = 2.8 h =5.1 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 f = 9.2 g = 3.8 h =5.4 f = 7.9 g = 3.4 h =

33 f = 9.2 g = 3.4 h =5.4 f = 7.9 g = 2.8 h =5.1 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 f = 9.2 g = 3.8 h =5.4 f = 7.9 g = 3.4 h =4.5 f = 10.6 g = 4.8 h =5.8 f = 9.4 g = 4.4 h =5 f = 9 g = 4.8 h =

34 f = 9.2 g = 3.4 h =5.4 f = 7.9 g = 2.8 h =5.1 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 f = 9.2 g = 3.8 h =5.4 f = 7.9 g = 3.4 h =4.5 f = 10.6 g = 4.8 h =5.8 f = 9.4 g = 4.4 h =5 f = 9 g = 4.8 h =

35 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 f = 9.2 g = 3.8 h =5.4 f = 7.9 g = 3.4 h =4.5 f = 9 g = 6.2 h = 2.8 f = 10.6 g = 4.8 h =5.8 f = 9.4 g = 4.4 h =5 f = 9 g = 4.8 h = 4.2 f = 9.4 g = 5.8 h = 3.6 f = 10.9 g = 5.2 h = 5.7 f = 10.8 g = 5.8 h = 5 f = 10.7 g = 6.2 h =

36 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 f = 9.2 g = 3.8 h =5.4 f = 7.9 g = 3.4 h =4.5 f = 9 g = 6.2 h = 2.8 f = 10.6 g = 4.8 h =5.8 f = 9.4 g = 4.4 h =5 f = 9 g = 4.8 h = 4.2 f = 9.4 g = 5.8 h = 3.6 f = 10.9 g = 5.2 h = 5.7 f = 10.8 g = 5.8 h = 5 f = 10.7 g = 6.2 h =

37 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 f = 9.2 g = 3.8 h =5.4 f = 7.9 g = 3.4 h =4.5 f = 9 g = 6.2 h = 2.8 f = 10.6 g = 4.8 h =5.8 f = 9.4 g = 4.4 h =5 f = 9 g = 4.8 h = 4.2 f = 9.4 g = 5.8 h = 3.6 f = 10.9 g = 5.2 h = 5.7 f = 10.8 g = 5.8 h = 5 f = 10.7 g = 6.2 h =

38 f = 9.2 g = 3.4 h =5.4 f = 7.9 g = 2.8 h =5.1 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 f = 9.4 g = 7.2 h = 2.2 f = 9 g = 7.6 h = 1.4 f = 9.2 g = 3.8 h =5.4 f = 7.9 g = 3.4 h =4.5 f = 9 g = 6.2 h = 2.8 f = 9.9 g = 7.2 h = 2.2 f = 10.6 g = 4.8 h =5.8 f = 9.4 g = 4.4 h =5 f = 9 g = 4.8 h = 4.2 f = 9.4 g = 5.8 h = 3.6 f = 10.8 g = 7.6 h = 3.2 f = 10.9 g = 5.2 h = 5.7 f = 10.8 g = 5.8 h = 5 f = 10.7 g = 6.2 h =

39 f = 9.2 g = 3.4 h =5.4 f = 7.9 g = 2.8 h =5.1 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 f = 9.4 g = 7.2 h = 2.2 f = 9 g = 7.6 h = 1.4 f = 9.2 g = 3.8 h =5.4 f = 7.9 g = 3.4 h =4.5 f = 9 g = 6.2 h = 2.8 f = 9.9 g = 7.2 h = 2.2 f = 10.6 g = 4.8 h =5.8 f = 9.4 g = 4.4 h =5 f = 9 g = 4.8 h = 4.2 f = 9.4 g = 5.8 h = 3.6 f = 10.8 g = 7.6 h = 3.2 f = 10.9 g = 5.2 h = 5.7 f = 10.8 g = 5.8 h = 5 f = 10.7 g = 6.2 h =

40 f = 9.2 g = 3.4 h =5.4 f = 7.9 g = 2.8 h =5.1 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 f = 11 g = 9 h =2 f = 9.6 g = 8.6 h = 1 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 f = 9.4 g = 7.2 h = 2.2 f = 9 g = 7.6 h = 1.4 f = 9.6 g = 8.6 h = 1 f = 9.2 g = 3.8 h =5.4 f = 7.9 g = 3.4 h =4.5 f = 9 g = 6.2 h = 2.8 f = 9.9 g = 7.2 h = 2.2 f = 11 g =9 h =2 f = 10.6 g = 4.8 h =5.8 f = 9.4 g = 4.4 h =5 f = 9 g = 4.8 h = 4.2 f = 9.4 g = 5.8 h = 3.6 f = 10.8 g = 7.6 h = 3.2 f = 10.9 g = 5.2 h = 5.7 f = 10.8 g = 5.8 h = 5 f = 10.7 g = 6.2 h =

41 f = 9.2 g = 3.4 h =5.4 f = 7.9 g = 2.8 h =5.1 Wall f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 (1,5) f = 6 g = 1 h =5 f = 6 g = 2 h = 4 f = 11 g = 9 h =2 f = 9.6 g = 8.6 h = 1 (7,5) f = 7.1 g = 1 h =6.1 f = 6.5 g = 1.4 h =5.1 f = 6.5 g = 2.4 h = 4.1 f = 9.4 g = 7.2 h = 2.2 f = 9 g = 7.6 h = 1.4 f = 9.6 g = 8.6 h = 1 f = 9.2 g = 3.8 h =5.4 f = 7.9 g = 3.4 h =4.5 f = 9 g = 6.2 h = 2.8 f = 9.9 g = 7.2 h = 2.2 f = 1 g =9 h =2 f = 10.6 g = 4.8 h =5.8 f = 9.4 g = 4.4 h =5 f = 9 g = 4.8 h = 4.2 f = 9.4 g = 5.8 h = 3.6 f = 10.8 g = 7.6 h = 3.2 f = 10.9 g = 5.2 h = 5.7 f = 10.8 g = 5.8 h = 5 f = 10.7 g = 6.2 h =

42 ABCDEFG A B C D E F G  Pathfinding can be a very time-comsuming and CPU-intensive operation. One way to reduce this problem is to precalcurate paths whenerver possible: Waypoint navigator.

43 ABCDEFG A- B- C- D- E- F- G-

44 ABCDEFG A-BBBBBB B- C- D- E- F- G-

45 ABCDEFG A-BBBBBB BA-CCCCC CBB-DEEE D- E- F- G-

46 ABCDEFG A-BBBBBB BA-CCCCC CBB-DEEE DCCC-CCC E- F- G-

47 ABCDEFG A-BBBBBB BA-CCCCC CBB-DEEE DCCC-CCC ECCCC-FF F- G-

48 ABCDEFG A-BBBBBB BA-CCCCC CBB-DEEE DCCC-CCC ECCCC-FF FEEEEE-G G-

49 ABCDEFG A-BBBBBB BA-CCCCC CBB-DEEE DCCC-CCC ECCCC-FF FEEEEE-G GFFFFFF-

50 ABCDEFG A-BBBBBB BA-CCCCC CBB-DEEE DCCC-CCC ECCCC-FF FEEEEE-G GFFFFFF- If we want to walk from A to G Round 1: A to B

51 ABCDEFG A-BBBBBB BA-CCCCC CBB-DEEE DCCC-CCC ECCCC-FF FEEEEE-G GFFFFFF- If we want to walk from A to G Round 2: B to C

52 ABCDEFG A-BBBBBB BA-CCCCC CBB-DEEE DCCC-CCC ECCCC-FF FEEEEE-G GFFFFFF- If we want to walk from A to G Round 3: C to E

53 ABCDEFG A-BBBBBB BA-CCCCC CBB-DEEE DCCC-CCC ECCCC-FF FEEEEE-G GFFFFFF- If we want to walk from A to G Round 4: E to F

54 ABCDEFG A-BBBBBB BA-CCCCC CBB-DEEE DCCC-CCC ECCCC-FF FEEEEE-G GFFFFFF- If we want to walk from A to G Round 5: E to G เจอแล้วหยุด !

55 ABCDEFG A-BBBBBB BA-CCCCC CBB-DEEE DCCC-CCC ECCCC-FF FEEEEE-G GFFFFFF- If we want to walk from A to G Round 5: E to G Round 1: A to B Round 2: B to C Round 3: C to E Round 4: E to F A-->B-->C-->E- ->E-->G

56  จบการนำเสนอ


ดาวน์โหลด ppt สัปดาห์ที่ 8 Basic Pathfinding, A* and Waypoint อ. เทพฤทธิ์ สินธำรงรักษ์ เรียบเรียง.

งานนำเสนอที่คล้ายกัน


Ads by Google