CS 387/680: GAME AI PATHFINDING

Size: px
Start display at page:

Download "CS 387/680: GAME AI PATHFINDING"

Transcription

1 CS 387/680: GAME AI PATHFINDING 4/14/2014 Instructor: Santiago Ontañón TA: Alberto Uriarte office hours: Tuesday 4-6pm, Cyber Learning Center Class website:

2 Reminders Check BBVista site for the course regularly Also: Next week is the deadline for people doing Project 1. Submission will be via learn.drexel.edu Submission page will be available shortly Any questions about Project 1?

3 Outline Student Presentations Pathfinding Basics: Breadth First Search, A* Pathfinding under Time Constraints: TBA*, LRTA* Pathfinding in Dynamic Domains: D*, D* Lite, AD* From Level Geometry to Pathfinding Graphs Pathfinding and Movement

4 Outline Student Presentations Pathfinding Basics: Breadth First Search, A* Pathfinding under Time Constraints: TBA*, LRTA* Pathfinding in Dynamic Domains: D*, D* Lite, AD* From Level Geometry to Pathfinding Graphs Pathfinding and Movement

5 Pathfinding Problem: Finding a path for a character/unit to move from point A to point B A B One of the most common AI requirements in games Specially critical in RTS games since there are lots of units

6 Pathfinding Problem: Finding a path for a character/unit to move from point A to point B A B One of the most common AI requirements in games Specially critical in RTS games since there are lots of units

7 Pathfinding Simplest scenario: Single character Non-real time Grid Static world Solution: A* Complex scenario: Multiple characters (overlapping paths) Real time Continuous map Dynamic world

8 Pathfinding is a Problem! Even in modern commercial games: v=lw9g-8glo0&feature=player_embedded

9 Example Wall Reach from Unit can move: up, down, left, right

10 Example: Breadth First Search OPEN = [] CLOSED = [] A search algorithm explores nodes in the search space until the goal is found Different algorithms explore nodes in different orders At each point in time, two lists of nodes: Explored nodes (CLOSED) Candidates to be explored (OPEN) OPEN CLOSED

11 Example: Breadth First Search OPEN = [A,B,C] CLOSED = [] A B C A B When a node is explored (expanded), all its successors (children) are added to the OPEN list C

12 Example: Breadth First Search OPEN = [B,C,D] CLOSED = [,A] A B C D A D B C

13 Example: Breadth First Search A B C I draw this tree here just for illustration purposes. In a real implementation, no such tree is kept in memory D A D B C Open: B C D In a real implementation, there are just the two lists of OPEN and CLOSED nodes. Each node stores who was its parent Closed: A

14 Example: Breadth First Search OPEN = [C,D,E] CLOSED = [,A,B] A B C D A D E B Breadth First Search explores nodes in the same order they were added to the OPEN list: Nodes that are closer to are always explored before nodes that are further. E C

15 Example: Breadth First Search OPEN = [D,E,F,G] CLOSED = [,A,B,C] A B C D A D E F G B E C F G

16 Example: Breadth First Search OPEN = [E,F,G] CLOSED = [,A,B,C,D] A B C D A D E F G B E C F G

17 Example: Breadth First Search OPEN = [F,G,H] CLOSED = [,A,B,C,D,E] A B C D A D E F G B H E C F H G

18 Example: Breadth First Search OPEN = [G,H,I,J] CLOSED = [,A,B,C,D,E,F] A B C D A D E F G B H I J E C F J H G I

19 Example: Breadth First Search OPEN = [H,I,J] CLOSED = [,A,B,C,D,E,F,G] A B C D A D E F G B H I J E C F J H G I

20 Example: Breadth First Search OPEN = [I,J] CLOSED = [,A,B,C,D,E,F,G,H] A B C D A D E F G B H I J E C F J H G I

21 Example: Breadth First Search OPEN = [J,K] CLOSED = [,A,B,C,D,E,F,G,H,I] A B C D A D E F G B H I J E C F J K H G I K

22 Example: Breadth First Search OPEN = [K,L] CLOSED = [,A,B,C,D,E,F,G,H,I,J] A B C D A D E F G B L H I J E C F J K L H G I K

23 Example: Breadth First Search OPEN = [L] CLOSED = [,A,B,C,D,E,F,G,H,I,J,K] A B C D A D E F G B L H I J E C F J K L H G I K

24 Example: Breadth First Search OPEN = [] CLOSED = [,A,B,C,D,E,F,G,H,I,J,K,L] A B C D A D E F G B L H I J E C F J K L H G I K

25 Example: Breadth First Search OPEN = [] CLOSED = [,A,B,C,D,E,F,G,H,I,J,K,L,] A B C D A D E F G B L H I J E C F J K L H G I K

26 Example: Breadth First Search OPEN = [] CLOSED = [,A,B,C,D,E,F,G,H,I,J,K,L,] A B C D A D E F G B L H I J E C F J K L H G I K

27 Example: Breadth First Search OPEN = [] CLOSED = [,A,B,C,D,E,F,G,H,I,J,K,L,] A B C D A D E F G B L H I J E C F J K L H G I K

28 Breadth First Search OPEN = [] CLOSED = [] WHILE OPEN is not empty N = OPEN.removeFirst() IF goal(n) THEN RETURN path to N CLOSED.add(N) FOR all children C of N that are not in CLOSED nor OPEN: C.parent = N OPEN.add(C) ENDFOR ENDWHILE

29 Breadth First Search It will find the shortest paths for pathfinding But High computational cost: will explore too many cells of the map Time Cost: Number of expanded nodes Memory Cost: Number of expanded nodes

30 A* Heuristic search algorithm: Finds the shortest path between a given start node and a goal Uses a heuristic to guide the search Heuristic: h(n) -> estimation of the distance from n to the goal Complete: if there is a solution, A* finds one Optimal: if heuristic admissible, A* finds the optimal path A heuristic is admissible if it never overestimates the distance to the goal In Pathfinding: Euclidean or Hamming distances are admissible heuristics

31 A* Heuristic search algorithm: Finds the shortest path between a given start node and a goal Uses a heuristic to guide the search Heuristic: h(n) -> estimation of the distance from n to the goal For pathfinding, the two most typical heuristics are the Euclidean distance and the Manhattan distance. Complete: if there is a solution, A* finds one Optimal: if heuristic admissible, A* finds the optimal path A heuristic is admissible if it never overestimates the distance to the goal In Pathfinding: Euclidean or Hamming distances are admissible heuristics

32 Example: A* OPEN = [] CLOSED = [] Heuristic used: Manhattan Distance

33 Example: A* f? OPEN = [] CLOSED = [] Assigns an estimated cost, f, to each node: f(n) = g(n) + h(n) g =? h =? Heuristic Real cost from to n Heuristic used: Manhattan Distance

34 Example: A* 3 OPEN = [] CLOSED = [] Assigns an estimated cost, f, to each node: f(n) = g(n) + h(n) g = 0 Heuristic Real cost from to n Heuristic used: Manhattan Distance

35 Example: A* 3 OPEN = [A,B,C] CLOSED = [] A f? B f? C f? B g =? h =? A g =? h =? g = 0 C g =? h =?

36 Example: A* 3 OPEN = [A,B,C] CLOSED = [] A 3 B C B h = 4 A h = 2 g = 0 Expands the node with the lowest Estimated cost first C h = 4

37 Example: A* 3 OPEN = [B, C, D] CLOSED = [, A] A 3 D B C D B h = 4 A h = 2 g = 0 C h = 4

38 Example: A* 3 OPEN = [C, D, E] CLOSED = [, A, B] A 3 D B E 7 C D B h = 4 E h = A h = 2 g = 0 C h = 4

39 Example: A* 3 OPEN = [D, E, F, G] CLOSED = [, A, B, C] A 3 D B E 7 C F G 7 D B h = 4 E h = A h = 2 g = 0 C h = 4 F G h =

40 Example: A* 3 OPEN = [E, F, G] CLOSED = [, A, B, C, D] A 3 D B E 7 C F G 7 D B h = 4 E h = A h = 2 g = 0 C h = 4 F G h =

41 Example: A* 3 OPEN = [E, G, I, J] CLOSED = [, A, B, C, D, F] A 3 D B E 7 C F I 7 G 7 J D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 J g = 3 h = 2

42 Example: A* 3 OPEN = [E, G, I, K, L] CLOSED = [, A, B, C, D, F, J] A 3 D B E 7 C F I 7 K 7 G 7 J L D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 L g = 4 h = 1 J g = 3 h = 2 K g = 4

43 Example: A* 3 OPEN = [E, G, I, K, ] CLOSED = [, A, B, C, D, F, J, L] A 3 D B E 7 C F I 7 K 7 G 7 J L D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4

44 Example: A* 3 OPEN = [E, G, I, K] CLOSED = [, A, B, C, D, F, J, L, ] A 3 D B E 7 C F I 7 K 7 G 7 J L D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4

45 Example: A* 3 OPEN = [E, G, I, K] CLOSED = [, A, B, C, D, F, J, L, ] A 3 D B E 7 C F I 7 K 7 G 7 J L D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4

46 A*.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED nor OPEN: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE

47 A*.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() Differences wrt Breadth First Search IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED nor OPEN: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE

48 A*.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE Nodes in red are in CLOSED Nodes in grey are in OPEN

49 A*.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE g = 0 Nodes in red are in CLOSED Nodes in grey are in OPEN

50 A*.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE g = 0 Nodes in red are in CLOSED Nodes in grey are in OPEN

51 A*.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE g = 0 OPEN = [] Nodes in red are in CLOSED Nodes in grey are in OPEN

52 A*.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE g = 0 OPEN = [] CLOSED = [] Nodes in red are in CLOSED Nodes in grey are in OPEN

53 A*.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE g = 0 OPEN = [] CLOSED = [] Nodes in red are in CLOSED Nodes in grey are in OPEN

54 A* N OPEN = [] CLOSED = [].g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE g = 0 Nodes in red are in CLOSED Nodes in grey are in OPEN

55 A* N OPEN = [] CLOSED = [].g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE g = 0 Nodes in red are in CLOSED Nodes in grey are in OPEN

56 A* N OPEN = [] CLOSED = [].g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE g = 0 Nodes in red are in CLOSED Nodes in grey are in OPEN

57 A* children(n) N OPEN = [] CLOSED = [].g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE g = 0 Nodes in red are in CLOSED Nodes in grey are in OPEN

58 A* children(n) N OPEN = [] CLOSED = [] M.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE B A g = 0 C Nodes in red are in CLOSED Nodes in grey are in OPEN

59 A* children(n) N OPEN = [] CLOSED = [] M.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE B A g = 0 C Nodes in red are in CLOSED Nodes in grey are in OPEN

60 A* children(n) N OPEN = [] CLOSED = [] M.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE B A h = 2 g = 0 C Nodes in red are in CLOSED Nodes in grey are in OPEN

61 A* children(n) N OPEN = [A] CLOSED = [] M.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE B A h = 2 g = 0 C Nodes in red are in CLOSED Nodes in grey are in OPEN

62 A* children(n) N OPEN = [A,B] CLOSED = [].g = 0;.h = heuristic() OPEN = []; CLOSED = [] M WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE B h = 4 A h = 2 g = 0 C Nodes in red are in CLOSED Nodes in grey are in OPEN

63 A* children(n) N OPEN = [A,B,C] CLOSED = [].g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N M CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE B h = 4 A h = 2 g = 0 C h = 4 Nodes in red are in CLOSED Nodes in grey are in OPEN

64 A* N OPEN = [A,B,C] CLOSED = [].g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE B h = 4 A h = 2 g = 0 C h = 4 Nodes in red are in CLOSED Nodes in grey are in OPEN

65 A* N OPEN = [A,B,C] CLOSED = [].g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE B h = 4 A h = 2 g = 0 C h = 4 Nodes in red are in CLOSED Nodes in grey are in OPEN

66 A*.g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE B h = 4 A h = 2 g = 0 C h = 4 OPEN = [A,B,C] CLOSED = [] Nodes in red are in CLOSED Nodes in grey are in OPEN

67 A* N OPEN = [B,C] CLOSED = [].g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE B h = 4 A h = 2 g = 0 C h = 4 Nodes in red are in CLOSED Nodes in grey are in OPEN

68 A* N OPEN = [B,C] CLOSED = [].g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE B h = 4 A h = 2 g = 0 C h = 4 Nodes in red are in CLOSED Nodes in grey are in OPEN

69 A* N OPEN = [B,C] CLOSED = [,A].g = 0;.h = heuristic() OPEN = []; CLOSED = [] WHILE OPEN is not empty N = OPEN.removeLowestF() IF goal(n) RETURN path to N CLOSED.add(N) FOR all children M of N not in CLOSED: M.parent = N M.g = N.g + 1; M.h = heuristic(m) OPEN.add(M) ENDFOR ENDWHILE B h = 4 A h = 2 g = 0 C h = 4 Nodes in red are in CLOSED Nodes in grey are in OPEN

70 Implementation Notes Remember the distinction between state and node State: The configuration of the problem (e.g. coordinates of a character) Node: A state plus: current cost (g), current heuristic (h), parent node, action that got us here form the parent node It is important to remember who was the parent, and which action, so that once the solution is found, we can reconstruct the path

71 A* Optimal: finds the shortest paths for pathfinding With an admissible heuristic Faster than Breath First Search: Explores less cells of the map (same worst-case scenario though) Time Cost: Number of expanded nodes Memory Cost: Number of expanded nodes

72 A* The heuristic biases the search of the algorithm towards the goal: Breadth First Search No bias

73 A* The heuristic biases the search of the algorithm towards the goal: A* Breadth First Search No bias Biased towards the goal

74 Outline Student Presentations Pathfinding Basics: Breadth First Search, A* Pathfinding under Time Constraints: TBA*, LRTA* Pathfinding in Dynamic Domains: D*, D* Lite, AD* From Level Geometry to Pathfinding Graphs Pathfinding and Movement

75 TBA* (Time-Bounded A*) Main problem of A* for games is that it is not real-time: What happens if we stop A* in mid execution? Can we get any path?

76 TBA* (Time-Bounded A*) Main problem of A* for games is that it is not real-time: A* needs to run to completion before returning a solution In games, we have a limited amount of time for AI computations per frame, before the unit we are controlling needs to move TBA* is the simplest real-time variant of A*: Given a finite amount of time, returns the best path found so far During the subsequent frames, TBA* continues refining the path The unit can start moving right away, without waiting for A* to complete

77 TBA* Uses A* as a subroutine (executing only NS steps of A* at a time) NS,NT 1 A* Current Path 3 OPEN List CLOSED List Loc Unit Action 2 Path Tracer New Path

78 TBA* Uses A* as a subroutine (executing only NS steps of A* at a time) NS,NT 1 A* 1) Improve the search results 3 Current Path 3) Follow the path OPEN List CLOSED List 2 Loc 2) Compute a new path Unit Action Path Tracer New Path

79 TBA* OPEN = [], CLOSED = [] CurrentPath = [] Loc = WHILE Loc!= DO A*(OPEN,CLOSED,,NS) NewPath = PathTracer(OPEN,CLOSED,Loc, NT) IF Loc in NewPath CurrentPath = NewPath stepforward(currentpath) ELSE stepback(currentpath) IF ENDWHILE

80 TBA* OPEN = [], CLOSED = [] CurrentPath = [] Loc = WHILE Loc!= DO A*(OPEN,CLOSED,,NS) Takes the node in CLOSED with the minimum h value so far and returns the current path to that node NewPath = PathTracer(OPEN,CLOSED,Loc, NT) IF Loc in NewPath CurrentPath = NewPath stepforward(currentpath) ELSE stepback(currentpath) IF ENDWHILE

81 Example: TBA* (NS = 3, NT = 3) 3 CurrentPath = [] NewPath= [] Loc g = 0 OPEN = [] CLOSED = []

82 Example: TBA* (NS = 3, NT = 3) 3 CurrentPath = [] NewPath= [] A 3 B C D A h = 2 D E 7 B h = 4 E h = g = 0 C h = 4 OPEN = [C,D,E] CLOSED = [,A,B] A* is executed for NS = 3 cycles

83 Example: TBA* (NS = 3, NT = 3) 3 CurrentPath = [] NewPath= [,A,D] A 3 B C D A h = 2 D E 7 B h = 4 E h = g = 0 C h = 4 OPEN = [C,D,E] CLOSED = [,A,B] Path Tracer is executed for NT = 3 cycles

84 Example: TBA* (NS = 3, NT = 3) 3 CurrentPath = [,A,D] NewPath= [,A,D] A 3 B C D A h = 2 D E 7 B h = 4 E h = g = 0 C h = 4 OPEN = [C,D,E] CLOSED = [,A,B] Unit moves along the path

85 Example: TBA* (NS = 3, NT = 3) 3 CurrentPath = [,A,D] NewPath= [,A,D] A 3 B C D A h = 2 D E 7 F I 7 OPEN = [E,G,I,J] CLOSED = [,A,B,C,D,F] G 7 J B h = 4 E h = g = 0 C h = 4 G h = F I g = 3 h = 4 J g = 3 h = 2 A* is executed for NS = 3 cycles

86 Example: TBA* (NS = 3, NT = 3) 3 CurrentPath = [,A,D] NewPath= [,A,D] A 3 B C D A h = 2 D E 7 F I 7 OPEN = [E,G,I,J] CLOSED = [,A,B,C,D,F] G 7 J B h = 4 E h = g = 0 C h = 4 G h = F I g = 3 h = 4 J g = 3 h = 2 Path Tracer is executed for NT = 3 cycles (not enough to trace completely)

87 Example: TBA* (NS = 3, NT = 3) 3 CurrentPath = [,A,D] NewPath= [,A,D] A 3 B C D A h = 2 D E 7 F I 7 OPEN = [E,G,I,J] CLOSED = [,A,B,C,D,F] G 7 J B h = 4 E h = g = 0 C h = 4 G h = F I g = 3 h = 4 J g = 3 h = 2 Unit moves along the path

88 Example: TBA* (NS = 3, NT = 3) A 3 D 3 B E 7 OPEN = [E,G,I,K] CLOSED = [,A,B,C,D, F,L,] C F I 7 K 7 G 7 J L CurrentPath = [,A,D] NewPath= [,A,D] D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4 A* is executed for NS = 3 cycles

89 Example: TBA* (NS = 3, NT = 3) A 3 D 3 B E 7 OPEN = [E,G,I,K] CLOSED = [,A,B,C,D, F,L,] C F I 7 K 7 G 7 J L CurrentPath = [,A,D] NewPath= [,C,F,J] D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4 Path Tracer is executed for NT = 3 cycles

90 Example: TBA* (NS = 3, NT = 3) A 3 D 3 B E 7 OPEN = [E,G,I,K] CLOSED = [,A,B,C,D, F,L,] C F I 7 K 7 G 7 J L CurrentPath = [,A,D] NewPath= [,C,F,J] D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 Unit moves along the path g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4

91 Example: TBA* (NS = 3, NT = 3) A 3 D 3 B E 7 OPEN = [E,G,I,K] CLOSED = [,A,B,C,D, F,L,] C F I 7 K 7 G 7 J L CurrentPath = [,A,D] NewPath= [,C,F,J] D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4 Path Tracer is executed for NT = 3 cycles

92 Example: TBA* (NS = 3, NT = 3) 3 CurrentPath = [,A,D] NewPath= [,C,F,J] A 3 B C D A h = 2 g = h = 0 D E 7 F I 7 K 7 G 7 J L B h = 4 E h = g = 0 C h = 4 G h = F I g = 3 h = 4 L g = 4 h = 1 J g = 3 h = 2 K g = 4 OPEN = [E,G,I,K] CLOSED = [,A,B,C,D, F,L,] Unit moves along the path

93 Example: TBA* (NS = 3, NT = 3) A 3 D 3 B E 7 OPEN = [E,G,I,K] CLOSED = [,A,B,C,D, F,L,] C F I 7 K 7 G 7 J L CurrentPath = [,A,D] NewPath= [,C,F,J,L,] D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4 Path Tracer is executed for NT = 3 cycles

94 Example: TBA* (NS = 3, NT = 3) A 3 D 3 B E 7 OPEN = [E,G,I,K] CLOSED = [,A,B,C,D, F,L,] C F I 7 K 7 G 7 J L CurrentPath = [,C,F,J,L,] NewPath= [,C,F,J,L,] D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 Unit moves along the path g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4

95 Example: TBA* (NS = 3, NT = 3) A 3 D 3 B E 7 OPEN = [E,G,I,K] CLOSED = [,A,B,C,D, F,L,] C F I 7 K 7 G 7 J L CurrentPath = [,C,F,J,L,] NewPath= [,C,F,J,L,] D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 Unit moves along the path g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4

96 Example: TBA* (NS = 3, NT = 3) A 3 D 3 B E 7 OPEN = [E,G,I,K] CLOSED = [,A,B,C,D, F,L,] C F I 7 K 7 G 7 J L CurrentPath = [,C,F,J,L,] NewPath= [,C,F,J,L,] D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 Unit moves along the path g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4

97 Example: TBA* (NS = 3, NT = 3) A 3 D 3 B E 7 OPEN = [E,G,I,K] CLOSED = [,A,B,C,D, F,L,] C F I 7 K 7 G 7 J L CurrentPath = [,C,F,J,L,] NewPath= [,C,F,J,L,] D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 Unit moves along the path g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4

98 Example: TBA* (NS = 3, NT = 3) A 3 D 3 B E 7 OPEN = [E,G,I,K] CLOSED = [,A,B,C,D, F,L,] C F I 7 K 7 G 7 J L CurrentPath = [,C,F,J,L,] NewPath= [,C,F,J,L,] D B h = 4 E h = A h = 2 g = 0 C h = 4 G h = F I g = 3 h = 4 Unit moves along the path g = h = 0 L g = 4 h = 1 J g = 3 h = 2 K g = 4

99 TBA* Real-time: Each execution cycle takes at most a constant time function of NS and NT Optimal: Will eventually find the same optimal path found by A* Although the unit might perform some additional movements at the beginning until the algorithm converges to a final path

100 LRTA* (Learning Real-Time A*) Real-Time A* variant that converges to optimal path: Unit can start moving from step 1, but might waste moves Eventually, algorithm converges to the optimal path, and character reaches destination Idea: Learn a better heuristic After each iteration of the algorithm, the heuristic better approximates the real distances to the goal Eventually, it converges to the real distance to the goal Unit just moves to the cell with lowest heuristic around until reaching the goal

101 LRTA* Initializes the heuristic in each cell to h For this example, we will use Manhattan distance

102 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 3 4 f = f = f =

103 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 3 4 f = f = f =

104 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around

105 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 3 f = f =

106 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 3 f = f =

107 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around

108 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 3 4 f = f =

109 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 4 f = f =

110 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around

111 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around f = 1+ 4 f = f =

112 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around f = 1+ 4 f = f =

113 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around

114 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 4 f = f = f =

115 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 4 f = f = f =

116 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around

117 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around f = f =

118 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around f = f =

119 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around

120 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 4 f = f =

121 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 4 f = f =

122 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around

123 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around f = 1+ 4 f = f =

124 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around f = 1+ 6 f = f =

125 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around

126 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 6 f =1+6 6 f =

127 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 7 6 f =1+6 6 f =

128 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around

129 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 7 f = f =

130 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 7 f = f =

131 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around

132 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 7 6 f = f = f =

133 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around 7 6 f = f = f =

134 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around

135 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around f = 1+ 1 f=1+ 4 f= f=1+ 4 3

136 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around f = 1+ 1 f=1+ 4 f= f=1+ 4 3

137 LRTA* In each step: Breadth-first search with bounded depth (e.g. 1) Updates the heuristic of the current node to the best f found Move to the lowest heuristic cell around

138 Other Algorithms: IDA* (Iterative Deepening A*): Like A*, but trades memory by time (only needs memory to store the path, NO open nor closed lists) RIBS (Real-Time Iterative Deepening Best-First Search): Improves on LRTA* by updating several cells at a time, rather than one knn LRTA* (k-nearest Neighbor LRTA*): Useful when pathfinding is executed multiple times in the same map It remembers previous paths, and uses them to better estimate newer paths

139 Outline Student Presentations Pathfinding Basics: Breadth First Search, A* Pathfinding under Time Constraints: TBA*, LRTA* Pathfinding in Dynamic Domains: D*, D* Lite, AD* From Level Geometry to Pathfinding Graphs Pathfinding and Movement

140 Pathfinding in Dynamic Environments A* variants (TBA*, LRTA*, etc.) assume environment doesn t change In a RTS game, units move, new buildings are constructed and destroyed: environment is dynamic What happens if after the game has a path using A*/TBA*/ LRTA*, the map changes?

141 Pathfinding in Dynamic Environments A* variants (TBA*, LRTA*, etc.) assume environment doesn t change In a RTS game, units move, new buildings are constructed and destroyed: environment is dynamic Simple solution (used in many games!): Recompute the path each time something changes (always!) (That s what you are doing for Project 2) Better solution: Specialized algorithms that can take this into account

142 D* Lite Same behavior as D* (which we will NOT cover in class), but simpler Works on dynamic environments: Modeled by changing the cost of moving from one cell to another If one cell n is not reachable from another n, the cost from n to n is infinity Searches from goal to start Uses a consistency test on nodes to determine when more search is needed: At the start When the environment changes

143 D* Lite Maintains an estimate (rhs) of the distance to the goal: A* maintains the g-estimates: actual distance from start rhs-estimate: 1-step look ahead g-estimate rhs(n) =min n0 2Succ(n)(c(n, n 0 )+g(n 0 )) If g(n) = rhs(n), n is considered consistent If all nodes are consistent, finding the optimal path is just moving to the best neighbor Search is only carried out on inconsistent nodes. When the environment changes, nodes become inconsistent

144 D* Lite (Simplified Algorithm) Initialize g and rhs of all nodes to infinity g() = rhs() = 0 U = [] Loc = WHILE Loc!= ComputeShortestPath() Loc = bestneighbor(loc) FOR all cells N with cost changed Update rhs(n) Add to U any inconsistent neighbor of N ENDIF ENDWHILE

145 D* Lite (Simplified Algorithm) Initialize g and rhs of all nodes to infinity g() = rhs() = 0 U = [] Loc = WHILE Loc!= ComputeShortestPath() Loc = bestneighbor(loc) FOR all cells N with cost changed Update rhs(n) U plays the role of the OPEN list in A*. Node consistency plays the role of the CLOSED list in A* Add to U any inconsistent neighbor of N ENDIF ENDWHILE Equivalent to A*, but using U and consistency

146 D* Lite (Full Algorithm) procedure CalculateKey 01 return ; procedure Initialize 02 ; for all ; 0 ; 06 U.Insert CalculateKey ; procedure UpdateVertex 07 if ; 08 if U.Remove ; 09 if U.Insert CalculateKey ; procedure ComputeShortestPath 10 while U.TopKey CalculateKey OR 11 U.TopKey 12 U.Pop ; 13 if CalculateKey 14 U.Insert CalculateKey 1 else if 16 ; 17 for all UpdateVertex ; 18 else 19 ; 20 for all UpdateVertex ; procedure Main Initialize ; 23 ComputeShortestPath ; 24 while 2 /* if then there is no known path */ 26 ; 27 Move to ; 28 Scan graph for changed edge costs; 29 if any edge costs changed for all directed edges with changed edge costs 33 Update the edge cost ; 34 UpdateVertex ; 3 ComputeShortestPath ; This method is equivalent to A*, but using g and rhs (ComputeShortestPath from previous slide) Part shown in the previous slide

147 Example: D* Lite U = [] All g and rhs are initialized to infinity g = rhs = g = rhs = g = 0 rhs = 0 g and rhs initialized to 0 The only inconsistent node is g = rhs = g = rhs = g = rhs = g = rhs = g = rhs = g = rhs = g = rhs = g = rhs = g = rhs = g = rhs =

148 Example: D* Lite U = [] After running ComputeShortestPath, the nodes relevant for the path from to will be consistent g = 9 rhs = 9 g = 8 rhs = 8 g = 8 rhs = 8 g = 7 rhs = 7 g = 0 rhs = 0 rhs = 1 g = 7 rhs = 7 g = 6 rhs = 6 rhs = 2 g = 6 rhs = 6 g = rhs = g = 4 rhs = 4 g = 3 rhs = 3

149 Example: D* Lite U = [] The Unit can now move by choosing the minimum neighbor around g = 9 rhs = 9 g = 8 rhs = 8 g = 8 rhs = 8 g = 7 rhs = 7 g = 0 rhs = 0 rhs = 1 g = 7 rhs = 7 g = 6 rhs = 6 rhs = 2 g = 6 rhs = 6 g = rhs = g = 4 rhs = 4 g = 3 rhs = 3

150 Example: D* Lite U = [A,B,] If something changes, nodes become inconsistent, and are pushed back into U g = 9 rhs = 9 g = 8 rhs = 8 A g = 8 rhs = 8 g = 7 rhs = 7 B g = rhs = g = 0 rhs = 0 rhs = 1 g = 7 rhs = 7 g = 6 rhs = 6 rhs = 2 g = 6 rhs = 6 g = rhs = g = 4 rhs = 4 g = 3 rhs = 3

151 Example: D* Lite U = [] After running ComputeShortestPath, again, nodes are made consistent again. g = 3 rhs = 3 g = 4 rhs = 4 A rhs = 2 g = 3 rhs = 3 B rhs = 1 g = 0 rhs = 0 rhs = 1 No need to replan from scratch, only inconsistent nodes are updated, and their changes propagated g = rhs = g = 6 rhs = 6 g = 4 rhs = 4 g = rhs = g = 4 rhs = 4 rhs = 2 g = 3 rhs = 3

152 Example: D* Lite U = [] The Unit can again move by choosing the minimum neighbor around g = 3 rhs = 3 g = 4 rhs = 4 A rhs = 2 g = 3 rhs = 3 B rhs = 1 g = 0 rhs = 0 rhs = 1 g = rhs = g = 4 rhs = 4 rhs = 2 g = 6 rhs = 6 g = rhs = g = 4 rhs = 4 g = 3 rhs = 3

153 D* Lite D* Lite can handle dynamic environments Doesn t need to replan from scratch As presented it is not real-time (ComputeShortestPath might have to update an arbitrary number of nodes): It can be made real-time by limiting the number of updates ComputeShortestPath performs per cycle

154 Other Algorithms D* Previous to D* Lite Same behavior, but more complex AD* (Anytime Dynamic A*) Tunes quality of paths depending on available time Reuses past paths in new searches to improve their quality Uses a bloating coefficient to find paths faster when little time available (a multiplier of the heuristic)

155 Outline Student Presentations Pathfinding Basics: Breadth First Search, A* Pathfinding under Time Constraints: TBA*, LRTA* Pathfinding in Dynamic Domains: D*, D* Lite, AD* From Level Geometry to Pathfinding Graphs Pathfinding and Movement

156 Waypoints Predefine a collection of waypoints, and do pathfinding in the waypoint graph:

157 Precomputation If environment is largely static paths can be precomputed To reduce the amount of precomputation: Precomputation only in the waypoint graph Precomputation of paths between each possible map location is not feasible At runtime, the precomputed path can be used as a starting point: If environment changes a bit, the path can be modified locally using obstacle avoidance techniques (faster than pathfinding)

158 Quantization and Localization Pathfinding computations are performed with an abstraction over the game map (a graph, composed of nodes and links) Quantization: Game map coordinates -> graph node Localization: Graph node -> Game map coordinates

159 Good and Bad Quantizations The pathfinding graph has to be created carefully, or weird pathfinding problems might occur:

160 Quantization approaches Tile graphs (simplest) Dirichlet Domains (aka Voronoi polygon) Points of visibility Navigation Meshes

161 Tile Graphs Divide the game map in equal tiles (squares, hexagons, etc.) Typical in RTS games

162 Dirichlet Domains Define a set of characteristic points in the game map (typically defined by the level designer) Quantization is just computing the closest characteristic point

163 Dirichlet Domains Define a set of characteristic points in the game map (typically defined by the level designer) Pathfinding graph, corresponding to a Dirichlet domain

164 Points of Visibility The shortest path between two points is a straight line Generate a collection of characteristic points in the map Connect two points if the character can move in a straight line between them Characteristic points can be generated automatically (for example at the corners of the map)

165 Points of Visibility Joint with Dirichlet domains, this method is widely used. However, the resulting graph can be huge!

166 Navigation Meshes (Navmesh) By far the most widely used Use the level geometry as the pathfinding graph Floor is made out of triangles: Use the center of each floor triangle as a charcteristic point

167 Navigation Meshes (Navmesh) One characteristic point is only connected to neighboring ones

168 Navigation Meshes (Navmesh) The validity of the graph depends on the level designer. It is her responsibility to author proper triangles for navigation:

169 Hierarchical Pathfinding If the path that needs to be planned is long, it doesn t make sense to use a standard A* graph Hierarchical graphs

170 Pathfinding Simplest scenario: Single character Non-real time Grid Static world Solution: A* Complex scenario: Multiple characters/dynamic world: D* / D* Lite Real time: TBA* / LRTA* Continuous map: Quantization

171 Outline Student Presentations Pathfinding Basics: Breadth First Search, A* Pathfinding under Time Constraints: TBA*, LRTA* Pathfinding in Dynamic Domains: D*, D* Lite, AD* From Level Geometry to Pathfinding Graphs Pathfinding and Movement

172 Game AI Architecture AI Strategy Decision Making World Interface (perception) Movement

173 Game AI Architecture AI Strategy Decision Making Movement World Interface (perception) Steering behaviors / Movement executed in this module

174 Game AI Architecture AI Strategy Decision Making Movement World Interface (perception) Pathplaning sits in the middle. Sometimes in Movement, sometimes in Decision Making

175 Example Grand Theft Auto

176 Example Grand Theft Auto: Pathfinding graph contains roads and intersections as node graphs Pathfinding plans the roads to take Movement controls the car to actually follow the path (same as in the PTSP project 1) In games where the only decision making is path planning, then pathfinding IS the decision making module In games where decision making involves other things (e.g. when to attack, when to retreat, etc.), pathfinding is just a layer in between

177 Project 2: Pathfinding Implement A* in a RTS Game Game Engine: S3 (Java)

178 Project 1: Steering Behaviors Implement steering behaviors (explained today) Game Engine: PTSP (Java) Competition: (if you are interested)

CS 387/680: GAME AI PATHFINDING

CS 387/680: GAME AI PATHFINDING CS 387/680: GAME AI PATHFINDING 4/16/2015 Instructor: Santiago Ontañón santi@cs.drexel.edu Class website: https://www.cs.drexel.edu/~santi/teaching/2015/cs387/intro.html Reminders Check BBVista site for

More information

CS 387/680: GAME AI PATHFINDING

CS 387/680: GAME AI PATHFINDING CS 8/680: GAME AI PATHFINDING 4/12/2016 Instructor: Santiago Ontañón santi@cs.drexel.edu Class website: https://www.cs.drexel.edu/~santi/teaching/2016/cs8/intro.html Reminders Check Vista site for the

More information

CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: INFORMED SEARCH, A* Santiago Ontañón

CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: INFORMED SEARCH, A* Santiago Ontañón S 380: RTIFIIL INTELLIGENE PROLEM SOLVING: INFORMED SERH, * Santiago Ontañón so367@drexel.edu Note on Graph Search Repeated-state checking: When the search state is a graph strategies like DFS can get

More information

CS 380: ARTIFICIAL INTELLIGENCE

CS 380: ARTIFICIAL INTELLIGENCE S 380: RTIFIIL INTELLIGENE PROLEM SOLVING: INFORMED SERH, * 10/9/2013 Santiago Ontañón santi@cs.drexel.edu https://www.cs.drexel.edu/~santi/teaching/2013/s380/intro.html larification Repeated-state checking:

More information

Game AI: The set of algorithms, representations, tools, and tricks that support the creation and management of real-time digital experiences

Game AI: The set of algorithms, representations, tools, and tricks that support the creation and management of real-time digital experiences Game AI: The set of algorithms, representations, tools, and tricks that support the creation and management of real-time digital experiences : A rule of thumb, simplification, or educated guess that reduces

More information

Pathfinding. Artificial Intelligence for gaming

Pathfinding. Artificial Intelligence for gaming Pathfinding Artificial Intelligence for gaming Pathfinding Group AI Execution Management Strategy World Inter face Character AI Decision Making Movement Pathfinding Animation Physics Pathfinding Graphs

More information

Advanced A* Improvements

Advanced A* Improvements Advanced A* Improvements 1 Iterative Deepening A* (IDA*) Idea: Reduce memory requirement of A* by applying cutoff on values of f Consistent heuristic function h Algorithm IDA*: 1. Initialize cutoff to

More information

Notes. Video Game AI: Lecture 5 Planning for Pathfinding. Lecture Overview. Knowledge vs Search. Jonathan Schaeffer this Friday

Notes. Video Game AI: Lecture 5 Planning for Pathfinding. Lecture Overview. Knowledge vs Search. Jonathan Schaeffer this Friday Notes Video Game AI: Lecture 5 Planning for Pathfinding Nathan Sturtevant COMP 3705 Jonathan Schaeffer this Friday Planning vs localization We cover planning today Localization is just mapping a real-valued

More information

Incremental A. S. Koenig and M. Likhachev Georgia Institute of Technology College of Computing Atlanta, GA skoenig,

Incremental A. S. Koenig and M. Likhachev Georgia Institute of Technology College of Computing Atlanta, GA skoenig, Incremental A S. Koenig and M. Likhachev Georgia Institute of Technology College of Computing Atlanta, GA 30312-0280 skoenig, mlikhach @cc.gatech.edu Abstract Incremental search techniques find optimal

More information

A.I.: Informed Search Algorithms. Chapter III: Part Deux

A.I.: Informed Search Algorithms. Chapter III: Part Deux A.I.: Informed Search Algorithms Chapter III: Part Deux Best-first search Greedy best-first search A * search Heuristics Outline Overview Informed Search: uses problem-specific knowledge. General approach:

More information

Outline. Best-first search

Outline. Best-first search Outline Best-first search Greedy best-first search A* search Heuristics Admissible Heuristics Graph Search Consistent Heuristics Local search algorithms Hill-climbing search Beam search Simulated annealing

More information

I may not have gone where I intended to go, but I think I have ended up where I needed to be. Douglas Adams

I may not have gone where I intended to go, but I think I have ended up where I needed to be. Douglas Adams Disclaimer: I use these notes as a guide rather than a comprehensive coverage of the topic. They are neither a substitute for attending the lectures nor for reading the assigned material. I may not have

More information

Informed Search Methods

Informed Search Methods Informed Search Methods How can we improve searching strategy by using intelligence? Map example: Heuristic: Expand those nodes closest in as the crow flies distance to goal 8-puzzle: Heuristic: Expand

More information

Informed search strategies (Section ) Source: Fotolia

Informed search strategies (Section ) Source: Fotolia Informed search strategies (Section 3.5-3.6) Source: Fotolia Review: Tree search Initialize the frontier using the starting state While the frontier is not empty Choose a frontier node to expand according

More information

EE631 Cooperating Autonomous Mobile Robots

EE631 Cooperating Autonomous Mobile Robots EE631 Cooperating Autonomous Mobile Robots Lecture 3: Path Planning Algorithm Prof. Yi Guo ECE Dept. Plan Representing the Space Path Planning Methods A* Search Algorithm D* Search Algorithm Representing

More information

Heuristic (Informed) Search

Heuristic (Informed) Search Heuristic (Informed) Search (Where we try to choose smartly) R&N: Chap., Sect..1 3 1 Search Algorithm #2 SEARCH#2 1. INSERT(initial-node,Open-List) 2. Repeat: a. If empty(open-list) then return failure

More information

Route planning / Search Movement Group behavior Decision making

Route planning / Search Movement Group behavior Decision making Game AI Where is the AI Route planning / Search Movement Group behavior Decision making General Search Algorithm Design Keep a pair of set of states: One, the set of states to explore, called the open

More information

I may not have gone where I intended to go, but I think I have ended up where I needed to be. Douglas Adams

I may not have gone where I intended to go, but I think I have ended up where I needed to be. Douglas Adams Disclaimer: I use these notes as a guide rather than a comprehensive coverage of the topic. They are neither a substitute for attending the lectures nor for reading the assigned material. I may not have

More information

CPS 170: Artificial Intelligence Search

CPS 170: Artificial Intelligence   Search CPS 170: Artificial Intelligence http://www.cs.duke.edu/courses/spring09/cps170/ Search Instructor: Vincent Conitzer Search We have some actions that can change the state of the world Change resulting

More information

CS 354R: Computer Game Technology

CS 354R: Computer Game Technology CS 354R: Computer Game Technology A* Heuristics Fall 2018 A* Search f(n): The current best estimate for the best path through a node: f(n)=g(n)+h(n) g(n): current known best cost for getting to a node

More information

Informed search. Soleymani. CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2016

Informed search. Soleymani. CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2016 Informed search CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2016 Soleymani Artificial Intelligence: A Modern Approach, Chapter 3 Outline Best-first search Greedy

More information

Pathfinding. Pathfinding Planned Movement

Pathfinding. Pathfinding Planned Movement 345 Ludic Computing Lecture 10 Pathfinding Simon Colton & Alison Pease Computational Creativity Group Department of Computing Imperial College London www.doc.ic.ac.uk/ccg 1 Pathfinding Planned Movement

More information

Pathfinding Decision Making

Pathfinding Decision Making DM810 Computer Game Programming II: AI Lecture 7 Pathfinding Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Resume Best first search Dijkstra Greedy search

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Informed Search and Exploration Chapter 4 (4.1 4.2) A General Search algorithm: Chapter 3: Search Strategies Task : Find a sequence of actions leading from the initial state to

More information

Lecture 5 Heuristics. Last Time: A* Search

Lecture 5 Heuristics. Last Time: A* Search CSE 473 Lecture 5 Heuristics CSE AI Faculty Last Time: A* Search Use an evaluation function f(n) for node n. f(n) = estimated total cost of path thru n to goal f(n) = g(n) + h(n) g(n) = cost so far to

More information

Lecture 3 - States and Searching

Lecture 3 - States and Searching Lecture 3 - States and Searching Jesse Hoey School of Computer Science University of Waterloo January 15, 2018 Readings: Poole & Mackworth Chapt. 3 (all) Searching Often we are not given an algorithm to

More information

Lecture 4: Search 3. Victor R. Lesser. CMPSCI 683 Fall 2010

Lecture 4: Search 3. Victor R. Lesser. CMPSCI 683 Fall 2010 Lecture 4: Search 3 Victor R. Lesser CMPSCI 683 Fall 2010 First Homework 1 st Programming Assignment 2 separate parts (homeworks) First part due on (9/27) at 5pm Second part due on 10/13 at 5pm Send homework

More information

Today s s lecture. Lecture 3: Search - 2. Problem Solving by Search. Agent vs. Conventional AI View. Victor R. Lesser. CMPSCI 683 Fall 2004

Today s s lecture. Lecture 3: Search - 2. Problem Solving by Search. Agent vs. Conventional AI View. Victor R. Lesser. CMPSCI 683 Fall 2004 Today s s lecture Search and Agents Material at the end of last lecture Lecture 3: Search - 2 Victor R. Lesser CMPSCI 683 Fall 2004 Continuation of Simple Search The use of background knowledge to accelerate

More information

DM842 Computer Game Programming: AI. Lecture 5. Path Finding. Marco Chiarandini

DM842 Computer Game Programming: AI. Lecture 5. Path Finding. Marco Chiarandini DM842 Computer Game Programming: AI Lecture 5 Path Finding Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Outline 1. Pathfinding 2. Heuristics 3. World Rerpresentations

More information

3 SOLVING PROBLEMS BY SEARCHING

3 SOLVING PROBLEMS BY SEARCHING 48 3 SOLVING PROBLEMS BY SEARCHING A goal-based agent aims at solving problems by performing actions that lead to desirable states Let us first consider the uninformed situation in which the agent is not

More information

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2. Problem Solving Agents. Problem Solving Agents: Assumptions

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2. Problem Solving Agents. Problem Solving Agents: Assumptions Class Overview COMP 3501 / COMP 4704-4 Lecture 2 Prof. JGH 318 Problem Solving Agents Problem Solving Agents: Assumptions Requires a goal Assume world is: Requires actions Observable What actions? Discrete

More information

Motion Planning for a Point Robot (2/2) Point Robot on a Grid. Planning requires models. Point Robot on a Grid 1/18/2012.

Motion Planning for a Point Robot (2/2) Point Robot on a Grid. Planning requires models. Point Robot on a Grid 1/18/2012. Motion Planning for a Point Robot (/) Class scribing Position paper 1 Planning requires models Point Robot on a Grid The Bug algorithms are reactive motion strategies ; they are not motion planners To

More information

Computer Game Programming Basic Path Finding

Computer Game Programming Basic Path Finding 15-466 Computer Game Programming Basic Path Finding Robotics Institute Path Planning Sven Path Planning needs to be very fast (especially for games with many characters) needs to generate believable paths

More information

CMU-Q Lecture 4: Path Planning. Teacher: Gianni A. Di Caro

CMU-Q Lecture 4: Path Planning. Teacher: Gianni A. Di Caro CMU-Q 15-381 Lecture 4: Path Planning Teacher: Gianni A. Di Caro APPLICATION: MOTION PLANNING Path planning: computing a continuous sequence ( a path ) of configurations (states) between an initial configuration

More information

Heuristic Search and Advanced Methods

Heuristic Search and Advanced Methods Heuristic Search and Advanced Methods Computer Science cpsc322, Lecture 3 (Textbook Chpt 3.6 3.7) May, 15, 2012 CPSC 322, Lecture 3 Slide 1 Course Announcements Posted on WebCT Assignment1 (due on Thurs!)

More information

Path Planning. Marcello Restelli. Dipartimento di Elettronica e Informazione Politecnico di Milano tel:

Path Planning. Marcello Restelli. Dipartimento di Elettronica e Informazione Politecnico di Milano   tel: Marcello Restelli Dipartimento di Elettronica e Informazione Politecnico di Milano email: restelli@elet.polimi.it tel: 02 2399 3470 Path Planning Robotica for Computer Engineering students A.A. 2006/2007

More information

CS 4700: Foundations of Artificial Intelligence. Bart Selman. Search Techniques R&N: Chapter 3

CS 4700: Foundations of Artificial Intelligence. Bart Selman. Search Techniques R&N: Chapter 3 CS 4700: Foundations of Artificial Intelligence Bart Selman Search Techniques R&N: Chapter 3 Outline Search: tree search and graph search Uninformed search: very briefly (covered before in other prerequisite

More information

Informed search methods

Informed search methods CS 2710 Foundations of AI Lecture 5 Informed search methods Milos Hauskrecht milos@pitt.edu 5329 Sennott Square Announcements Homework assignment 2 is out Due on Tuesday, September 19, 2017 before the

More information

Outline. Best-first search

Outline. Best-first search Outline Best-first search Greedy best-first search A* search Heuristics Local search algorithms Hill-climbing search Beam search Simulated annealing search Genetic algorithms Constraint Satisfaction Problems

More information

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search COMP219: Artificial Intelligence Lecture 10: Heuristic Search 1 Class Tests Class Test 1 (Prolog): Tuesday 8 th November (Week 7) 13:00-14:00 LIFS-LT2 and LIFS-LT3 Class Test 2 (Everything but Prolog)

More information

Can work in a group of at most 3 students.! Can work individually! If you work in a group of 2 or 3 students,!

Can work in a group of at most 3 students.! Can work individually! If you work in a group of 2 or 3 students,! Assignment 1 is out! Due: 26 Aug 23:59! Submit in turnitin! Code + report! Can work in a group of at most 3 students.! Can work individually! If you work in a group of 2 or 3 students,! Each member must

More information

Informed Search. CS 486/686 University of Waterloo May 10. cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart

Informed Search. CS 486/686 University of Waterloo May 10. cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart Informed Search CS 486/686 University of Waterloo May 0 Outline Using knowledge Heuristics Best-first search Greedy best-first search A* search Other variations of A* Back to heuristics 2 Recall from last

More information

Basic Search Algorithms

Basic Search Algorithms Basic Search Algorithms Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Abstract The complexities of various search algorithms are considered in terms of time, space, and cost

More information

CS 387/680: GAME AI MOVEMENT

CS 387/680: GAME AI MOVEMENT CS 387/680: GAME AI MOVEMENT 4/7/2014 Instructor: Santiago Ontañón santi@cs.drexel.edu TA: Alberto Uriarte office hours: Tuesday 4-6pm, Cyber Learning Center Class website: https://www.cs.drexel.edu/~santi/teaching/2014/cs387-680/intro.html

More information

Overview. Path Cost Function. Real Life Problems. COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

Overview. Path Cost Function. Real Life Problems. COMP219: Artificial Intelligence. Lecture 10: Heuristic Search COMP219: Artificial Intelligence Lecture 10: Heuristic Search Overview Last time Depth-limited, iterative deepening and bi-directional search Avoiding repeated states Today Show how applying knowledge

More information

Informed State Space Search B4B36ZUI, LS 2018

Informed State Space Search B4B36ZUI, LS 2018 Informed State Space Search B4B36ZUI, LS 2018 Branislav Bošanský, Martin Schaefer, David Fiedler, Jaromír Janisch {name.surname}@agents.fel.cvut.cz Artificial Intelligence Center, Czech Technical University

More information

Informed Search Algorithms

Informed Search Algorithms Informed Search Algorithms CITS3001 Algorithms, Agents and Artificial Intelligence Tim French School of Computer Science and Software Engineering The University of Western Australia 2017, Semester 2 Introduction

More information

4 INFORMED SEARCH AND EXPLORATION. 4.1 Heuristic Search Strategies

4 INFORMED SEARCH AND EXPLORATION. 4.1 Heuristic Search Strategies 55 4 INFORMED SEARCH AND EXPLORATION We now consider informed search that uses problem-specific knowledge beyond the definition of the problem itself This information helps to find solutions more efficiently

More information

Introduction to Computer Science and Programming for Astronomers

Introduction to Computer Science and Programming for Astronomers Introduction to Computer Science and Programming for Astronomers Lecture 9. István Szapudi Institute for Astronomy University of Hawaii March 21, 2018 Outline Reminder 1 Reminder 2 3 Reminder We have demonstrated

More information

AI: Week 2. Tom Henderson. Fall 2014 CS 5300

AI: Week 2. Tom Henderson. Fall 2014 CS 5300 AI: Week 2 Tom Henderson Fall 2014 What s a Problem? Initial state Actions Transition model Goal Test Path Cost Does this apply to: Problem: Get A in CS5300 Solution: action sequence from initial to goal

More information

Informed search algorithms. Chapter 4

Informed search algorithms. Chapter 4 Informed search algorithms Chapter 4 Outline Best-first search Greedy best-first search A * search Heuristics Memory Bounded A* Search Best-first search Idea: use an evaluation function f(n) for each node

More information

Informed Search and Exploration

Informed Search and Exploration Informed Search and Exploration Chapter 4 (4.1-4.3) CS 2710 1 Introduction Ch.3 searches good building blocks for learning about search But vastly inefficient eg: Can we do better? Breadth Depth Uniform

More information

ME/CS 132: Advanced Robotics: Navigation and Vision

ME/CS 132: Advanced Robotics: Navigation and Vision ME/CS 132: Advanced Robotics: Navigation and Vision Lecture #5: Search Algorithm 1 Yoshiaki Kuwata 4/12/2011 Lecture Overview Introduction Label Correcting Algorithm Core idea Depth-first search Breadth-first

More information

2006/2007 Intelligent Systems 1. Intelligent Systems. Prof. dr. Paul De Bra Technische Universiteit Eindhoven

2006/2007 Intelligent Systems 1. Intelligent Systems. Prof. dr. Paul De Bra Technische Universiteit Eindhoven test gamma 2006/2007 Intelligent Systems 1 Intelligent Systems Prof. dr. Paul De Bra Technische Universiteit Eindhoven debra@win.tue.nl 2006/2007 Intelligent Systems 2 Informed search and exploration Best-first

More information

A* optimality proof, cycle checking

A* optimality proof, cycle checking A* optimality proof, cycle checking CPSC 322 Search 5 Textbook 3.6 and 3.7.1 January 21, 2011 Taught by Mike Chiang Lecture Overview Recap Admissibility of A* Cycle checking and multiple path pruning Slide

More information

CS510 \ Lecture Ariel Stolerman

CS510 \ Lecture Ariel Stolerman CS510 \ Lecture02 2012-10-03 1 Ariel Stolerman Midterm Evan will email about that after the lecture, at least 2 lectures from now. The exam will be given in a regular PDF (not an online form). We will

More information

ARTIFICIAL INTELLIGENCE. Informed search

ARTIFICIAL INTELLIGENCE. Informed search INFOB2KI 2017-2018 Utrecht University The Netherlands ARTIFICIAL INTELLIGENCE Informed search Lecturer: Silja Renooij These slides are part of the INFOB2KI Course Notes available from www.cs.uu.nl/docs/vakken/b2ki/schema.html

More information

Informed (Heuristic) Search. Idea: be smart about what paths to try.

Informed (Heuristic) Search. Idea: be smart about what paths to try. Informed (Heuristic) Search Idea: be smart about what paths to try. 1 Blind Search vs. Informed Search What s the difference? How do we formally specify this? A node is selected for expansion based on

More information

CS 380: Artificial Intelligence Lecture #4

CS 380: Artificial Intelligence Lecture #4 CS 380: Artificial Intelligence Lecture #4 William Regli Material Chapter 4 Section 1-3 1 Outline Best-first search Greedy best-first search A * search Heuristics Local search algorithms Hill-climbing

More information

Chapter 3: Search. c D. Poole, A. Mackworth 2010, W. Menzel 2015 Artificial Intelligence, Chapter 3, Page 1

Chapter 3: Search. c D. Poole, A. Mackworth 2010, W. Menzel 2015 Artificial Intelligence, Chapter 3, Page 1 Chapter 3: Search c D. Poole, A. Mackworth 2010, W. Menzel 2015 Artificial Intelligence, Chapter 3, Page 1 Searching Often we are not given an algorithm to solve a problem, but only a specification of

More information

Lecture 9. Heuristic search, continued. CS-424 Gregory Dudek

Lecture 9. Heuristic search, continued. CS-424 Gregory Dudek Lecture 9 Heuristic search, continued A* revisited Reminder: with A* we want to find the best-cost (C ) path to the goal first. To do this, all we have to do is make sure our cost estimates are less than

More information

Informed Search A* Algorithm

Informed Search A* Algorithm Informed Search A* Algorithm CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2018 Soleymani Artificial Intelligence: A Modern Approach, Chapter 3 Most slides have

More information

Parallel Physically Based Path-tracing and Shading Part 3 of 2. CIS565 Fall 2012 University of Pennsylvania by Yining Karl Li

Parallel Physically Based Path-tracing and Shading Part 3 of 2. CIS565 Fall 2012 University of Pennsylvania by Yining Karl Li Parallel Physically Based Path-tracing and Shading Part 3 of 2 CIS565 Fall 202 University of Pennsylvania by Yining Karl Li Jim Scott 2009 Spatial cceleration Structures: KD-Trees *Some portions of these

More information

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search COMP219: Artificial Intelligence Lecture 10: Heuristic Search 1 Class Tests Class Test 1 (Prolog): Friday 17th November (Week 8), 15:00-17:00. Class Test 2 (Everything but Prolog) Friday 15th December

More information

CS 331: Artificial Intelligence Informed Search. Informed Search

CS 331: Artificial Intelligence Informed Search. Informed Search CS 331: Artificial Intelligence Informed Search 1 Informed Search How can we make search smarter? Use problem-specific knowledge beyond the definition of the problem itself Specifically, incorporate knowledge

More information

CS 331: Artificial Intelligence Informed Search. Informed Search

CS 331: Artificial Intelligence Informed Search. Informed Search CS 331: Artificial Intelligence Informed Search 1 Informed Search How can we make search smarter? Use problem-specific knowledge beyond the definition of the problem itself Specifically, incorporate knowledge

More information

Solving problems by searching

Solving problems by searching Solving problems by searching Chapter 3 Some slide credits to Hwee Tou Ng (Singapore) Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms Heuristics

More information

Problem Solving and Search

Problem Solving and Search Artificial Intelligence Problem Solving and Search Dae-Won Kim School of Computer Science & Engineering Chung-Ang University Outline Problem-solving agents Problem types Problem formulation Example problems

More information

Hierarchical Dynamic Pathfinding for Large Voxel Worlds

Hierarchical Dynamic Pathfinding for Large Voxel Worlds Hierarchical Dynamic Pathfinding for Large Voxel Worlds Benoit Alain Lead Programmer & CTO, Sauropod Studio Hierarchical Dynamic Pathfinding for Large Voxel Worlds Hierarchical Dynamic Pathfinding for

More information

CS 480: GAME AI STEERING BEHAVIORS. 4/12/2012 Santiago Ontañón

CS 480: GAME AI STEERING BEHAVIORS. 4/12/2012 Santiago Ontañón CS 480: GAME AI STEERING BEHAVIORS 4/12/2012 Santiago Ontañón santi@cs.drexel.edu https://www.cs.drexel.edu/~santi/teaching/2012/cs480/intro.html Reminders Check BBVista site for the course regularly Also:

More information

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 4, 4/11/2005 University of Washington, Department of Electrical Engineering Spring 2005 Instructor: Professor Jeff A. Bilmes Today: Informed search algorithms

More information

Game AI: The set of algorithms, representations, tools, and tricks that support the creation and management of real-time digital experiences

Game AI: The set of algorithms, representations, tools, and tricks that support the creation and management of real-time digital experiences the question of whether computers can think is like the question of whether submarines can swim -- Dijkstra Game AI: The set of algorithms, representations, tools, and tricks that support the creation

More information

Informed search algorithms. Chapter 4

Informed search algorithms. Chapter 4 Informed search algorithms Chapter 4 Material Chapter 4 Section 1 - Exclude memory-bounded heuristic search 3 Outline Best-first search Greedy best-first search A * search Heuristics Local search algorithms

More information

Robot Motion Planning

Robot Motion Planning Robot Motion Planning James Bruce Computer Science Department Carnegie Mellon University April 7, 2004 Agent Planning An agent is a situated entity which can choose and execute actions within in an environment.

More information

CMPSCI 250: Introduction to Computation. Lecture #24: General Search, DFS, and BFS David Mix Barrington 24 March 2014

CMPSCI 250: Introduction to Computation. Lecture #24: General Search, DFS, and BFS David Mix Barrington 24 March 2014 CMPSCI 250: Introduction to Computation Lecture #24: General Search, DFS, and BFS David Mix Barrington 24 March 2014 General Search, DFS, and BFS Four Examples of Search Problems State Spaces, Search,

More information

CSE 473. Chapter 4 Informed Search. CSE AI Faculty. Last Time. Blind Search BFS UC-BFS DFS DLS Iterative Deepening Bidirectional Search

CSE 473. Chapter 4 Informed Search. CSE AI Faculty. Last Time. Blind Search BFS UC-BFS DFS DLS Iterative Deepening Bidirectional Search CSE 473 Chapter 4 Informed Search CSE AI Faculty Blind Search BFS UC-BFS DFS DLS Iterative Deepening Bidirectional Search Last Time 2 1 Repeated States Failure to detect repeated states can turn a linear

More information

Informed Search CS457 David Kauchak Fall 2011

Informed Search CS457 David Kauchak Fall 2011 Admin Informed Search CS57 David Kauchak Fall 011 Some material used from : Sara Owsley Sood and others Q3 mean: 6. median: 7 Final projects proposals looked pretty good start working plan out exactly

More information

Outline for today s lecture. Informed Search. Informed Search II. Review: Properties of greedy best-first search. Review: Greedy best-first search:

Outline for today s lecture. Informed Search. Informed Search II. Review: Properties of greedy best-first search. Review: Greedy best-first search: Outline for today s lecture Informed Search II Informed Search Optimal informed search: A* (AIMA 3.5.2) Creating good heuristic functions Hill Climbing 2 Review: Greedy best-first search: f(n): estimated

More information

Lecture 2: Fun with Search. Rachel Greenstadt CS 510, October 5, 2017

Lecture 2: Fun with Search. Rachel Greenstadt CS 510, October 5, 2017 Lecture 2: Fun with Search Rachel Greenstadt CS 510, October 5, 2017 Reminder! Project pre-proposals due tonight Overview Uninformed search BFS, DFS, Uniform-Cost, Graph-Search Informed search Heuristics,

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Exercises & Solutions Chapters -4: Search methods. Search Tree. Draw the complete search tree (starting from S and ending at G) of the graph below. The numbers beside the nodes

More information

1 Introduction and Examples

1 Introduction and Examples 1 Introduction and Examples Sequencing Problems Definition A sequencing problem is one that involves finding a sequence of steps that transforms an initial system state to a pre-defined goal state for

More information

Informed Search. CMU Snake Robot. Administrative. Uninformed search strategies. Assignment 1 was due before class how d it go?

Informed Search. CMU Snake Robot. Administrative. Uninformed search strategies. Assignment 1 was due before class how d it go? Informed Search S151 David Kauchak Fall 2010 MU Snake Robot http://www-cgi.cs.cmu.edu/afs/cs.cmu.edu/web/people/biorobotics/projects/ modsnake/index.html Some material borrowed from : Sara Owsley Sood

More information

Pathfinding Algorithms and Implementations on Grid Map

Pathfinding Algorithms and Implementations on Grid Map Pathfinding Algorithms and Implementations on Grid Map Steven Andrew / 13509061 Program Studi Teknik Informatika Sekolah Teknik Elektro dan Informatika Institut Teknologi Bandung, Jl. Ganesha 10 Bandung

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Search Marc Toussaint University of Stuttgart Winter 2015/16 (slides based on Stuart Russell s AI course) Outline Problem formulation & examples Basic search algorithms 2/100 Example:

More information

Lecture 3 of 42. Lecture 3 of 42

Lecture 3 of 42. Lecture 3 of 42 Search Problems Discussion: Term Projects 3 of 5 William H. Hsu Department of Computing and Information Sciences, KSU KSOL course page: http://snipurl.com/v9v3 Course web site: http://www.kddresearch.org/courses/cis730

More information

Universiteit Leiden Computer Science

Universiteit Leiden Computer Science Universiteit Leiden Computer Science Optimizing octree updates for visibility determination on dynamic scenes Name: Hans Wortel Student-no: 0607940 Date: 28/07/2011 1st supervisor: Dr. Michael Lew 2nd

More information

Heuris'c Search. Reading note: Chapter 4 covers heuristic search.

Heuris'c Search. Reading note: Chapter 4 covers heuristic search. Heuris'c Search Reading note: Chapter 4 covers heuristic search. Credits: Slides in this deck are drawn from or inspired by a multitude of sources including: Shaul Markovitch Jurgen Strum Sheila McIlraith

More information

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 19 January, 2018

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 19 January, 2018 DIT411/TIN175, Artificial Intelligence Chapter 3: Classical search algorithms CHAPTER 3: CLASSICAL SEARCH ALGORITHMS DIT411/TIN175, Artificial Intelligence Peter Ljunglöf 19 January, 2018 1 DEADLINE FOR

More information

Heuristic (Informed) Search

Heuristic (Informed) Search Heuristic (Informed) Search (Where we try to choose smartly) R&N: Chap. 4, Sect. 4.1 3 1 Recall that the ordering of FRINGE defines the search strategy Search Algorithm #2 SEARCH#2 1. INSERT(initial-node,FRINGE)

More information

Heuristic Search. Heuristic Search. Heuristic Search. CSE 3401: Intro to AI & LP Informed Search

Heuristic Search. Heuristic Search. Heuristic Search. CSE 3401: Intro to AI & LP Informed Search CSE 3401: Intro to AI & LP Informed Search Heuristic Search. Required Readings: Chapter 3, Sections 5 and 6, and Chapter 4, Section 1. In uninformed search, we don t try to evaluate which of the nodes

More information

Today. Informed Search. Graph Search. Heuristics Greedy Search A* Search

Today. Informed Search. Graph Search. Heuristics Greedy Search A* Search Informed Search [These slides were created by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley. All CS188 materials are available at http://ai.berkeley.edu.] Today Informed Search Heuristics

More information

A4B36ZUI - Introduction ARTIFICIAL INTELLIGENCE

A4B36ZUI - Introduction ARTIFICIAL INTELLIGENCE A4B36ZUI - Introduction to ARTIFICIAL INTELLIGENCE https://cw.fel.cvut.cz/wiki/courses/a4b33zui/start Michal Pechoucek, Branislav Bosansky, Jiri Klema & Olga Stepankova Department of Computer Science Czech

More information

CS 5522: Artificial Intelligence II

CS 5522: Artificial Intelligence II CS 5522: Artificial Intelligence II Search Algorithms Instructor: Wei Xu Ohio State University [These slides were adapted from CS188 Intro to AI at UC Berkeley.] Today Agents that Plan Ahead Search Problems

More information

CS 4700: Foundations of Artificial Intelligence

CS 4700: Foundations of Artificial Intelligence CS 4700: Foundations of Artificial Intelligence Bart Selman selman@cs.cornell.edu Informed Search Readings R&N - Chapter 3: 3.5 and 3.6 Search Search strategies determined by choice of node (in queue)

More information

Chapter 5.4 Artificial Intelligence: Pathfinding

Chapter 5.4 Artificial Intelligence: Pathfinding Chapter 5.4 Artificial Intelligence: Pathfinding Introduction Almost every game requires pathfinding Agents must be able to find their way around the game world Pathfinding is not a trivial problem The

More information

Search Algorithms. Uninformed Blind search. Informed Heuristic search. Important concepts:

Search Algorithms. Uninformed Blind search. Informed Heuristic search. Important concepts: Uninformed Search Search Algorithms Uninformed Blind search Breadth-first uniform first depth-first Iterative deepening depth-first Bidirectional Branch and Bound Informed Heuristic search Greedy search,

More information

Pathfinding. Advaith Siddharthan

Pathfinding. Advaith Siddharthan Pathfinding Advaith Siddharthan Context What is Intelligence? Rational? Search Optimisation Reasoning Impulsive? Quicker response Less predictable Personality/Emotions: Angry/Bored/Curious Overview The

More information

Assignment 1 is out! Due: 9 Sep 23:59! Can work in a group of 2-3 students.! NO cheating!!!! Submit in turnitin! Code + report!

Assignment 1 is out! Due: 9 Sep 23:59! Can work in a group of 2-3 students.! NO cheating!!!! Submit in turnitin! Code + report! Assignment 1 is out! Due: 9 Sep 23:59! Submit in turnitin! Code + report! Can work in a group of 2-3 students.! Please register your group in the website linked from the assignment description before tomorrow

More information

Informed search algorithms. (Based on slides by Oren Etzioni, Stuart Russell)

Informed search algorithms. (Based on slides by Oren Etzioni, Stuart Russell) Informed search algorithms (Based on slides by Oren Etzioni, Stuart Russell) The problem # Unique board configurations in search space 8-puzzle 9! = 362880 15-puzzle 16! = 20922789888000 10 13 24-puzzle

More information

Uninformed Search Methods

Uninformed Search Methods Uninformed Search Methods Search Algorithms Uninformed Blind search Breadth-first uniform first depth-first Iterative deepening depth-first Bidirectional Branch and Bound Informed Heuristic search Greedy

More information