Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC3203: AI for Games Informed search (1) Patrick Olivier

Similar presentations


Presentation on theme: "CSC3203: AI for Games Informed search (1) Patrick Olivier"— Presentation transcript:

1 CSC3203: AI for Games Informed search (1) Patrick Olivier p.l.olivier@ncl.ac.uk

2 Uninformed search: summary Breadth-first Depth-first Iterative deepening

3 Informed search strategies Best-first search Greedy best-first search A* search Local beam search Simulated annealing search Genetic algorithms

4 Best-first search Search strategy defined by: –order of node expansion Uniform cost search uses cost so far: g(n) Best first search uses: –evaluation function: f(n) –expand most desirable unexpanded node –implementation: order fringe by decreasing f(n) For example: –greedy best-first search –A* search

5 Greedy best-first search Evaluation function f(n) = h(n) Heuristics are rules-of-thumb that are likely (but not guaranteed) to help in problem solving For example: –h SLD (n) = straight-line distance from n to Bucharest Greedy best-first search expands the node that appears to be closest to goal

6 Greedy search: Arad  Bucharest Straight line distance to Bucharest

7 Greedy search: Arad  Bucharest

8

9

10

11 Properties of greedy search Complete? –In finite space if modified for repeated states –(Consider Iasi to Fagaras: false start to Neamt rather than Vaslui, and must prevent repeated states to avoid infinite Iasi/Neamt transitions.) Time: –O(b m ): good heuristic  dramatic improvement Space: –O(b m ) keeps all nodes in memory Optimal? –No

12 A * search Idea: don’t just use estimate of cost to the goal, but the cost of paths so far Evaluation function: f(n) = g(n) + h(n) –g(n) = cost so far to reach n –h(n) = estimated cost from n to goal –f(n) is estimated cost of path through n to goal

13 Class exercise: Arad  Bucharest using A* and the staight-line distance as h SLD (n) SLD to Bucharest

14 A* search: Arad  Bucharest

15

16

17

18

19

20 Admissible heuristics A heuristic h(n) is admissible if for every node n, h(n) ≤ h*(n), where h*(n) is the true cost to reach the goal state from n. An admissible heuristic never overestimates the cost to reach the goal, i.e. it is optimistic Example: h SLD (n) (never overestimates the actual road distance) Theorem: If h(n) is admissible, A* using tree- search is optimal

21 Suppose some suboptimal goal G 2 has been generated and is in the fringe. Let n be an unexpanded node in the fringe such that n is on a shortest path to an optimal goal G. f(G 2 ) = g(G 2 )…since h(G 2 ) = 0 g(G 2 ) > g(G)…since G 2 suboptimal f(G) = g(G)…since h(G) = 0 f(G 2 ) > f(G)…from above Proof of A* optimality of A * f(n) = g(n) + h(n)

22 Suppose some suboptimal goal G 2 has been generated and is in the fringe. Let n be an unexpanded node in the fringe such that n is on a shortest path to an optimal goal G. f(G 2 ) > f(G)…from above h(n) ≤ h*(n)...since h is admissible g(n) + h(n) ≤ g(n) + h*(n) f(n) ≤ f(G) Hence f(G 2 ) > f(n), and A* will never select G 2 for expansion Proof of A* optimality of A *

23 Complete? –Yes – unless there are infinitely many nodes f(n) ≤ f(G) Time? –Exponential unless error in the heuristic grows no faster that the logarithm of the actual path cost –A* is as optimally efficient (no other algorithm is guaranteed to expand less nodes for the same heuristic) Space? –All nodes in memory (same as time complexity) Optimal? –Yes Properties of A* search


Download ppt "CSC3203: AI for Games Informed search (1) Patrick Olivier"

Similar presentations


Ads by Google