Presentation is loading. Please wait.

Presentation is loading. Please wait.

Artificial Intelligence for Games Uninformed search Patrick Olivier

Similar presentations


Presentation on theme: "Artificial Intelligence for Games Uninformed search Patrick Olivier"— Presentation transcript:

1 Artificial Intelligence for Games Uninformed search Patrick Olivier p.l.olivier@ncl.ac.uk

2 Simple problem solving agent

3 Roadmap of Romania…

4 Example: Romanian holiday On holiday in Romania (currently in Arad) Flight leaves tomorrow from Bucharest Formulate goal: –be in Bucharest Formulate problem: –states: various cities –actions: drive between cities Find solution: –sequence of cities, e.g., Arad, Sibiu, Fagaras…

5 Example: 8 puzzle states? –locations of tiles actions? –move blank left, right, up, down goal test? –goal state (given) path cost? –1 per move

6 Example: robot assembly states? –joint angles + parts actions? –joint motions goal test? –complete assembly path cost? –time to execute

7 Example: NPC path planning states? –discretised world actions? –character motions goal test? –destination reached path cost? –cumulative motion cost

8 Tree search algorithms simulated (offline) exploration of state space generating successors of already-explored states

9 Tree search: implementation

10 Search strategies strategy defined by order of node expansion strategies evaluated according to: –completeness: always find a solution if one exists? –time complexity: number of nodes generated –space complexity: maximum nodes in memory –optimality: always finds a least-cost solution? time & space complexity measured in terms of: –b: maximum branching factor of the search tree –d: depth of the least-cost solution –m: maximum depth of the state space (may be ∞)

11 Uninformed search strategies only use information in the problem definition (uninformed): –breadth-first search –uniform-cost search –depth-first search –depth-limited search –iterative deepening search improve using informed search (next week)

12 Breadth-first search Expand shallowest unexpanded node Implementation: fringe is a FIFO queue –add newly expanded nodes to back of queue –expand nodes at the front of the queue

13 Old queue:[ ] New queue:[A]

14 Old queue:[A] New queue:[B C]

15 Old queue:[B C] New queue:[C D E]

16 Old queue:[C D E] New queue:[D E F G]

17 Properties of breadth-first search Complete? –Yes (if b is finite) Time: –b+b 2 +b 3 +… +b d + (b d+1 -b) = O(b d+1 ) Space: –O(b d+1 ) …keeps every node in memory Optimal? –If the cost is the same per step Space is the problem (more than time)

18 Depth-first search Expand deepest unexpanded node Implementation: fringe is a LIFO queue –add newly expanded nodes to front of queue –expand node at the front of queue

19 Old queue:[ ] New queue:[A]

20 Old queue:[A] New queue:[B C]

21 Old queue:[B C] New queue:[D E C]

22 Old queue:[D E C] New queue:[H I E C]

23 Old queue:[H I E C] New queue:[I E C]

24 Old queue:[I E C] New queue:[E C]

25 Old queue:[E C] New queue:[J K C]

26 Old queue:[J K C] New queue:[K C]

27 Old queue:[K C] New queue:[C]

28 Properties of depth-first search Complete? –No – fails in infinite-depth spaces (or with loops) –modify to avoid repeated states along path –complete in finite spaces Time: –O(b m ): bad if m much larger than d of shallowest goal –if solutions are dense, much faster than breadth-first Space: –O(bm), i.e. linear space Optimal? –No


Download ppt "Artificial Intelligence for Games Uninformed search Patrick Olivier"

Similar presentations


Ads by Google