Presentation is loading. Please wait.

Presentation is loading. Please wait.

Informed search algorithms

Similar presentations


Presentation on theme: "Informed search algorithms"— Presentation transcript:

1 Informed search algorithms
A I C h a p t e r 4 Informed search algorithms

2 Outline Best-first search Greedy best-first search A* search
Heuristics Local search algorithms Hill-climbing search Simulated annealing search Local beam search Genetic algorithms

3 Best-first search An informed search strategy uses problem-specific knowledge beyond the definition of the problem itself, so it can find solutions more efficiently than an uninformed strategy. Best-first search is an instance of the general TREE-SEARCH or GRAPH-SEARCH algorithm in which a node is selected for expansion based on an evaluation function, f (n) . A key component of these algorithms is a heuristic function denoted h(n) : h(n) = estimated cost of the cheapest path from node n to a goal node, if n is a goal node, then h(n) = 0.

4 Best-first search Special cases: Greedy best-first search A* search

5 Greedy best-first search
Greedy best-first search tries to expand the node that is closest to the goal, on the grounds that it is likely to lead to a solution quickly. Thus, it evaluates nodes by using just the heuristic function; that is, f(n)=h(n). Evaluation function f(n) = h(n) (heuristic) = estimate of cost from n to goal Assume hSLD(n) = straight line distance from n to Bucharest, so Greedy best-first search expands the node that appears to be closest to goal

6 Greedy best-first search
h(n) straight line distance h(n) =234 406

7 Greedy best-first search example

8 Greedy best-first search example

9 Greedy best-first search example

10 Greedy best-first search example

11 Greedy best-first search
Arad  Sibiu  Fagaras  Bucharest

12 Another example

13 Another example

14 Another example

15 Another example

16 Another example

17 Another example

18 Another example Start  A  D  E  Goal

19 Greedy best-first infinite loop
A h(n)=10 h(n)=9 B h(n)=7 C infinite loop D h(n)=3 E h(n)=5 F h(n)=0

20 Greedy best-first not optimal
h(n)=10 h(n)=9 B h(n)=7 h(n)=5 C D E h(n)=4 h(n)=2 G F h(n)=3 H h(n)=0

21 Greedy best-first not optimal
goal to reach the largest-sum 9 6 17 8 7 6 80

22 Greedy best-first not optimal
goal  to reach the largest value 9 6 17 8 7 6 80

23 Greedy best-first not optimal
goal  to reach the largest value 9 6 17 8 7 6 80

24 Properties of greedy best-first search
Complete? No – can get stuck in loops Time? O(bm), but a good heuristic can give dramatic improvement Space? O(bm), keeps all nodes in memory Optimal? No, may even produce the unique worst possible solution b = branching factor m = max depth of search tree

25 A* search Minimizing the total estimated solution cost The most widely known form of best-first search is called A* search (pronounced "A-star search"). It evaluates nodes by combining g(n), the cost to reach the node, and h(n), the cost to get from the node to the goal: Evaluation function f(n) = g(n) + h(n) Where g(n) gives the path cost from the start node to node n, and h(n) is the estimated cost of the cheapest path from n to the goal f (n) = estimated cost of the cheapest solution through n

26 A* search example

27 A* search example

28 A* search example tracing

29 Comparison between A* and greedy search
greedy search path  = 450 A* search path  = 418

30 A* search another example
Assume h(n)=

31 A* search another example
f(n) = g(n) + h(n)

32

33 A* search another example
B A C E D H I G K L Z 14 12 9 11 8 13 10

34 Properties of A* Complete? Yes
Time? Exponential (time is not main drawback) Space? Keeps all nodes in memory Optimal? Yes

35 Hill-climbing search "Like climbing Everest in thick fog with amnesia"
It is simply a loop that continually moves in the direction of increasing value-that is, uphill. It terminates when it reaches a "peak" where no neighbor has a higher value. The basic idea is to proceed according to some heuristic measurement of the remaining distance to the goal. depending on initial state, can get stuck in local maxima

36 Hill-climbing search it is possible to make progress
attempts to find a better solution by incrementally changing a single element of the solution Plateaux Plateaux Current state

37 Hill-climbing search Local maxima: a local maximum is a peak that is higher than each of its neighboring states, but lower than the global maximum. Hill-climbing algorithms that reach the vicinity of a local maximum will be drawn upwards towards the peak, but will then be stuck with nowhere else to go. Plateaux: a plateau is an area of the state space landscape where the evaluation function is flat. It can be a flat local maximum, from which no uphill exit exists, or a shoulder, from which it is possible to make progress. Ridges: Ridges result in a sequence of local maxima that is very difficult for greedy algorithms to navigate. (the search direction is not towards the top but towards the side)

38 Hill-climbing search example
our aim is to find a path from S to M associate heuristics with every node, that is the straight line distance from the path terminating city to the goal city S A B 11 9 C D E F 9 G 9 7.5 8.5 8 H I J 7 K 6 6 5 L M N 4 O 4 2

39 Hill-climbing search example
11 9 C D E F 9 G 9 7.5 8.5 8 H I J 7 K 6 6 5 L M N 4 O 4 2

40 Hill-climbing search example
11 9 C D E F 9 G 9 7.5 8.5 8 H I J 7 K 6 6 5 L M N 4 O 4 2

41 Hill-climbing search example
11 9 C D E F 9 G 9 7.5 8.5 8 H I J 7 K 6 6 5 L M N 4 O 4 2

42 Hill-climbing search example
11 9 C D E F 9 G 9 7.5 8.5 8 H I J 7 K 6 6 5 L M N 4 O 4 2

43 Hill-climbing search example
Local maximum From A find a solution where H and K are final states 10 A 10 B F 7 J 8 D G 4 C E 3 2 5 K I 6 H K

44 Hill-climbing search example
Local maximum 10 A 10 B F 7 J 8 G 4 D C E 3 2 5 K I 6 H K

45 Hill-climbing search example
Local minimum 10 A 10 B F 7 J 8 4 D G C E 3 2 5 K I 6 G is local minimum H K Hill climbing is sometimes called greedy local search because it grabs a good neighbor state without thinking ahead about where to go next.

46 Local maximum, Local minimum
Hill-climbing search Local maximum, Local minimum

47 END


Download ppt "Informed search algorithms"

Similar presentations


Ads by Google