48
CHAPTER 4: INFORMED SEARCH & EXPLORATION Prepared by: Ece UYKUR

Chapter 4: Informed search & exploratIon

  • Upload
    cecily

  • View
    159

  • Download
    3

Embed Size (px)

DESCRIPTION

Chapter 4: Informed search & exploratIon. Prepared by : Ece UYKUR. Outline. Evaluation of Search Strategies Informed Search Strategies Best-first search Greedy best-first search A * search Admissible Heuristics Memory - Bounded Search Iterative - Deepening A* Search - PowerPoint PPT Presentation

Citation preview

Page 1: Chapter  4:  Informed search  &  exploratIon

CHAPTER 4: INFORMED SEARCH & EXPLORATION

Prepared by: Ece UYKUR

Page 2: Chapter  4:  Informed search  &  exploratIon

Outline Evaluation of Search Strategies Informed Search Strategies

Best-first searchGreedy best-first searchA* search

Admissible Heuristics Memory-Bounded Search

Iterative-Deepening A* Search Recursive Best-First Search Simplified Memory-Bounded A* Search

Summary

Page 3: Chapter  4:  Informed search  &  exploratIon

Evaluation of Search Strategies Search algorithms are commonly evaluated according

to the following four criteria; Completeness: does it always find a solution if one

exists? Time complexity: how long does it take as a function of

number of nodes? Space complexity: how much memory does it require? Optimality: does it guarantee the least-cost solution?

Time and space complexity are measured in terms of: b – max branching factor of the search tree d – depth of the least-cost solution m – max depth of the search tree (may be infinity)

Page 4: Chapter  4:  Informed search  &  exploratIon

Before Starting… Solution is a sequence of operators that

bring you from current state to the goal state.

The search strategy is determined by the order in which the nodes are expanded.

Uninformed Search Strategies; use only information available in the problem formulation.• Breadth-first• Uniform-cost• Depth-first• Depth-limited• Iterative deepening

Page 5: Chapter  4:  Informed search  &  exploratIon

Uninformed search strategies look for solutions by systematically generating new states and checking each of them against the goal.

This approach is very inefficient in most cases. Most successor states are “obviously” a bad

choice. Such strategies do not know that because they

have minimal problem-specific knowledge.

Page 6: Chapter  4:  Informed search  &  exploratIon

Informed search strategies exploit problem-specific knowledge as much as possible to drive the search.

They are almost always more efficient than uninformed searches and often also optimal.

Also called heuristic search. Uses the knowledge of the problem domain

to build an evaluation function f. The search strategy: For every node n in the

search space, f(n) quantifies the desirability of expanding n, in order to reach the goal.

Informed Search Strategies

Page 7: Chapter  4:  Informed search  &  exploratIon

Uses the desirability value of the nodes in the fringe to decide which node to expand next.

f is typically an imperfect measure of the goodness of the node. The right choice of nodes is not always the one suggested by f.

It is possible to build a perfect evaluation function, which will always suggest the right choice.

The general approach is called “best-first search”.

Page 8: Chapter  4:  Informed search  &  exploratIon

Best-First Search Choose the most desirable (seemly-best)

node for expansion based on evaluation function. Lowest cost/highest probability evaluation

Implementation; Fringe is a priority queue in decreasing order of

desirability. Evaluation Function; f(n): select a node for

expansion (usually the lowest cost node), desirability of node n.

Heuristic function; h(n): estimates cheapest path cost from node n to a goal node.

g(n) = cost from the initial state to the current state n.

Page 9: Chapter  4:  Informed search  &  exploratIon

Best-First Search Strategy; Pick “best” element of Q. (measured by heuristic

value of state) Add path extensions anywhere in Q. (it may be

more efficient to keep the Q ordered in some way, so as to make it easier to find the ‘best’ element)

There are many possible approaches to finding the best node in Q; Scanning Q to find lowest value, Sorting Q and picking the first element, Keeping the Q sorted by doing “sorted” insertions, Keeping Q as a priority queue.

Page 10: Chapter  4:  Informed search  &  exploratIon

Several kinds of best-first search introduced Greedy best-first search A* search

Page 11: Chapter  4:  Informed search  &  exploratIon

Greedy Best-First Search Estimation function:

Expand the node that appears to be closest to the goal, based on the heuristic function only;

f(n) = h(n) = estimate of cost from n to the closest goal

Ex: the straight line distance heuristics hSLD(n) = straight-line distance from n to Bucharest

Greedy search expands first the node that appears to be closest to the goal, according to h(n). “greedy” – at each search step the algorithm always

tries to get close to the goal as it can.

Page 12: Chapter  4:  Informed search  &  exploratIon

Romania with step costs in km

Page 13: Chapter  4:  Informed search  &  exploratIon

hSLD(In(Arad)) = 366

Notice that the values of hSLD cannot be computed from the problem itself.

It takes some experience to know that hSLD is correlated with actual road distances Therefore a useful heuristic

Page 14: Chapter  4:  Informed search  &  exploratIon
Page 15: Chapter  4:  Informed search  &  exploratIon
Page 16: Chapter  4:  Informed search  &  exploratIon
Page 17: Chapter  4:  Informed search  &  exploratIon
Page 18: Chapter  4:  Informed search  &  exploratIon

Properties of Greedy Search Complete?

No – can get stuck in loops / follows single path to goal.

Ex; Iasi > Neamt > Iasi > Neamt > … Complete in finite space with repeated-state

checking. Time?

O(b^m) but a good heuristic can give dramatic improvement.

Space? O(b^m) – keeps all nodes in memory

Optimal? No.

Page 19: Chapter  4:  Informed search  &  exploratIon

A* Search Idea; avoid expanding paths that are

already expensive. Evaluation function: f(n) = g(n) + h(n)

with; g(n) – cost so far to reach n h(n) – estimated cost to goal from n f(n) – estimated total cost of path through n to goal

A* search uses an admissible heuristic, that is,

h(n) h*(n) where h*(n) is the true cost from n.Ex: hSLD(n) never overestimates actual road distance.

Theorem: A* search is optimal.

Page 20: Chapter  4:  Informed search  &  exploratIon

When h(n) = actual cost to goal Only nodes in the correct path are

expanded Optimal solution is found

When h(n) < actual cost to goal Additional nodes are expanded Optimal solution is found

When h(n) > actual cost to goal Optimal solution can be overlooked

Page 21: Chapter  4:  Informed search  &  exploratIon
Page 22: Chapter  4:  Informed search  &  exploratIon
Page 23: Chapter  4:  Informed search  &  exploratIon
Page 24: Chapter  4:  Informed search  &  exploratIon
Page 25: Chapter  4:  Informed search  &  exploratIon
Page 26: Chapter  4:  Informed search  &  exploratIon
Page 27: Chapter  4:  Informed search  &  exploratIon

Optimality of A* (standard proof)

1

Suppose some suboptimal goal G2 has been generated and is in the queue. Let n be an unexpanded node on a shortest path to an optimal goal G1.

Page 28: Chapter  4:  Informed search  &  exploratIon

Consistent Heuristics A heuristic is consistent if for every node n, every successor n' of n generated

by any action a, h(n) ≤ c(n,a,n') + h(n') n' = successor of n generated by action a

The estimated cost of reaching the goal from n is no greater than the step cost of getting to n' plus the estimated cost of reaching the goal from n‘

If h is consistent, we have f(n') = g(n') + h(n') = g(n) + c(n,a,n') + h(n') ≥ g(n) + h(n) = f(n)

if h(n) is consistent then the values of f(n) along any path are nondecreasing

Theorem: If h(n) is consistent, A* using GRAPH-SEARCH is optimal

Page 29: Chapter  4:  Informed search  &  exploratIon

Optimality of A* (more useful proof)

Page 30: Chapter  4:  Informed search  &  exploratIon

f-contours

30

How do the contours look like when h(n) =0?

Uniformed search; Bands circulate around the initial stateA* search; Bands stretch toward the goal and is narrowly focused around the optimal path if more accurate heuristics were used

Page 31: Chapter  4:  Informed search  &  exploratIon

Properties of A* Search Complete?

Yes – unless there are infinitely many nodes with f f(G).

Time? O(b^d ) – Exponential.

[(relative error in h) x (length of solution)]

Space? O(b^d) – Keeps all nodes in memory.

Optimal? Yes – cannot expand fi+1 until fi is finished.

Page 32: Chapter  4:  Informed search  &  exploratIon

Admissible Heuristics

Page 33: Chapter  4:  Informed search  &  exploratIon
Page 34: Chapter  4:  Informed search  &  exploratIon

Relaxed Problem Admissible heuristics can be derived from the

exact solution cost of a relaxed version of the problem.

If the rules of the 8-puzzle are relaxed so that a tile can move anywhere, then h1(n) gives the shortest solution.

If the rules are relaxed so that a tile can move to any adjacent square, then h2(n) gives the shortest solution.

Key point; the optimal solution cost of a relaxed problem is no greater than the optimal solution cost of the real problem

Page 35: Chapter  4:  Informed search  &  exploratIon

Dominance Definition: If h2(n) h1(n) for all n (both admissible) then

h2 dominates h1. For 8-puzzle, h2 indeed dominates h1.

h1(n) = number of misplaced tiles h2(n) = total Manhattan distance

If h2 dominates h1, then h2 is better for search. For 8-puzzle, search costs:

d = 14 IDS = 3,473,941 nodes (IDS = Iterative Deepening Search)

A(h1) = 539 nodes A(h2) = 113 nodesd = 24

IDS 54,000,000,000 nodesA(h1) = 39,135 nodes A(h2) = 1,641 nodes

Page 36: Chapter  4:  Informed search  &  exploratIon

Memory-Bounded Search

Iterative-Deepening A* Search

Recursive Best-First Search

Simplified Memory-Bounded A* Search

Page 37: Chapter  4:  Informed search  &  exploratIon

Iterative-Deepening A* Search (IDA*)

The idea of iterative deepening was adapted to the heuristic search context to reduce memory requirements

At each iteration, DFS is performed by using the f-cost (g+h) as the cutoff rather than the depth

Ex; the smallest f-cost of any node that exceeded the cutoff on the previous iteration

Page 38: Chapter  4:  Informed search  &  exploratIon

Properties of IDA* IDA* is complete and optimal

Space complexity: O(bf(G)/δ) ≈ O(bd) δ : the smallest step cost f(G): the optimal solution cost

Time complexity: O(α b^d) α: the number of distinct f values smaller than the optimal goal

Between iterations, IDA* retains only a single number; the f-cost

IDA* has difficulties in implementation when dealing with real-valued cost

Page 39: Chapter  4:  Informed search  &  exploratIon

Recursive Best-First Search (RBFS) Attempt to mimic best-first search but use

only linear space Can be implemented as a recursive algorithm. Keep track of the f-value of the best alternative

path from any ancestor of the current node. If the current node exceeds the limit, then the

recursion unwinds back to the alternative path. As the recursion unwinds, the f-value of each

node along the path is replaced with the best f-value of its children.

Page 40: Chapter  4:  Informed search  &  exploratIon

Ex: The Route finding Problem

Page 41: Chapter  4:  Informed search  &  exploratIon
Page 42: Chapter  4:  Informed search  &  exploratIon
Page 43: Chapter  4:  Informed search  &  exploratIon

Properties of RBFS RBFS is complete and optimal

Space complexity: O(bd)

Time complexity : worse case O(b^d) Depend on the heuristics and frequency of

“mind change” The same states may be explored many

times

Page 44: Chapter  4:  Informed search  &  exploratIon

Simplified Memory-Bounded A* Search (SMA*) Make use of all available memory M to carry out A*

Expanding the best leaf like A* until memory is full

When full, drop the worst leaf node (with highest f-value) Like RBFS, backup the value of the forgotten node to its

parent if it is the best among the sub-tree of its parent. When all children nodes were deleted/dropped, put the

parent node to the fringe again for further expansion.

Page 45: Chapter  4:  Informed search  &  exploratIon

Properties of SMA* Is complete if M ≥ d

Is optimal if M ≥ d

Space complexity: O(M)

Time complexity : worse case O(b^d)

Page 46: Chapter  4:  Informed search  &  exploratIon

Summary This chapter has examined the application of heuristics to

reduce search costs. We have looked at number of algorithms that use heuristics,

and found that optimality comes at a stiff price in terms of search cost, even with good heuristics.

Best-first search is just GENERAL-SEARCH where the minimum-cost nodes (according to some measure) are expanded first.

If we minimize the estimated cost to reach the goal, h(n), we get greedy search. The search time is usually decreased compared to an uninformed algorithm, but the algorithm is neither optimal nor complete.

Minimizing f(n) = g(n) + h(n) combines the advantages of uniform-cost search and greedy search. If we handle repeated states and guarantee that h(n) never overestimates, we get A* search.

Page 47: Chapter  4:  Informed search  &  exploratIon

A* is complete, optimal, and optimally efficient among all optimal search algorithms. Its space complexity is still prohibitive.

The time complexity of heuristic algorithms depends on the quality of the heuristic function.

Good heuristics can sometimes be constructed by examining the problem definition or by generalizing from experience with the problem class.

We can reduce the space requirement of A* with memory-bounded algorithms such as IDA* (iterative deepening A*) and SMA* (simplified memory-bounded A*).

Page 48: Chapter  4:  Informed search  &  exploratIon

Thanks for your patience