You are on page 1of 6

Informed Search and Exploration

1 TABLE OF CONTENTS
2 Informed (Heuristic) Search Strategies ................................................................................................................ 1
3 Greedy best-first search ....................................................................................................................................... 1
4 A* Search, Heuristic Functions ............................................................................................................................. 3
5 Heuristic Functions ............................................................................................................................................... 4
5.1 Example: 8-Puzzle......................................................................................................................................... 4
6 Local Search Algorithms and Optimization Problems .......................................................................................... 4
6.1 Hill-climbing search ...................................................................................................................................... 5
6.1.1 8-queens problem ................................................................................................................................ 6
6.1.2 Problems .............................................................................................................................................. 6

2 INFORMED (HEURISTIC) SEARCH STRATEGIES


This section shows how an informed search strategy--one that uses problem-specific knowledge beyond the
definition of the problem itself-can find solutions more efficiently than an uninformed strategy.

The general approach we will consider is called best-first search. 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).

 Traditionally, the node with the lowest evaluation is selected for expansion.
 Best-first search can be implemented within our general search framework via a priority queue.
 The name "best-first search' is a venerable but inaccurate one. After all, if we could really expand the
best node first, it would not be a search at all; it would be a straight march to the goal.
 All we can do is choose the node that appears to be best according to the evaluation function.

h() = estimated cost of the cheapest path from node to a goal node.

3 GREEDY BEST-FIRST SEARCH


Greedy best-first search tries to expand the node that is closest to the goal, on the grounds that this is likely to
lead to a solution quickly. Thus, it evaluates nodes by using just the heuristic function; that is, f(n)=h(n).

 Greedy Best-First search tries to expand the node that is closest to the goal assuming it will lead to a
solution quickly
o f(n) = h(n)
o aka “Greedy Search”
 Implementation
o expand the “most desirable” node into the fringe queue
o sort the queue in decreasing order of desirability
 g(n) = cost from the initial state to the current state n
 h(n) = estimated cost of the cheapest path from node n to a goal node
 f(n) = evaluation function to select a node for expansion (usually the lowest cost node)

The progress of a greedy best-first search using to find a path from Arad to Bucharest. The first node to be
expanded from Arad will be Sibiu, because it is closer to Bucharest than either Zerind or Timisoara. The next node
to be expanded will be because it is closest. in turn generates Bucharest, which is the goal. For this particular
problem, greedy best-first search using finds a solution without ever expanding a node that is not on the solution
path; hence, its search cost is minimal. It is not optimal, however: the path via Sibiu and to Bucharest is 32
kilometers longer than the path through Rimnicu Vilcea and Pitesti. This shows why the algorithm is called
"greedy2'-at each step it tries to get as close to the goal as it can.

 Complete - No, GBFS can get stuck in loops (e.g. bouncing back and forth between cities)
 Time - O(bm) but a good heuristic can have dramatic improvement
 Space - O(bm) – keeps all the nodes in memory
 Optimal - No!
4 A* SEARCH, HEURISTIC FUNCTIONS
In computer science, A* is a computer algorithm that is widely used in pathfinding and graph traversal, which is
the process of finding a path between multiple points, called "nodes". It enjoys widespread use due to its
performance and accuracy.

 A* (A star) is the most widely known form of Best-First search


o It evaluates nodes by combining g(n) and h(n)
o f(n) = g(n) + h(n)
o Where
 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

 Complete
o Yes, unless there are infinitely many nodes with f <= f(G)
 Time
o Exponential in [relative error of h x length of soln]
o The better the heuristic, the better the time
o Best case h is perfect, O(d)
o Worst case h = 0, O(bd) same as BFS
 Space
o Keeps all nodes in memory and save in case of repetition
o This is O(bd) or worse
o A* usually runs out of space before it runs out of time
 Optimal
o Yes, cannot expand fi+1 unless fi is finished

5 HEURISTIC FUNCTIONS
The heuristic function is a way to inform the search about the direction to a goal. It provides an informed way to
guess which neighbor of a node will lead to a goal. There is nothing magical about a heuristic function.

5.1 EXAMPLE: 8-PUZZLE

 Average solution cost for a random puzzle is 22


In computing, tree data structures, and
moves
game theory, the branching factor is the
 Branching factor is about 3
number of children at each node
o Empty tile in the middle -> four moves
o Empty tile on the edge -> three moves
o Empty tile in corner -> two moves
 322 is approx 3.1e10
o Get rid of repeated states
o 181440 distinct states

To use A* a heuristic function must be used that never overestimates the number of steps to the goal

h1=the number of misplaced tiles

h2=the sum of the Manhattan distances of the tiles from their goal positions

h1 = 7

h2 = 4+0+3+3+1+0+2+1 = 14

 If h2(n) > h1(n) for all n (both admissible) then h2(n) dominates h1(n) and is better for the search

6 LOCAL SEARCH ALGORITHMS AND OPTIMIZATION PROBLEMS


The search algorithms that we have seen so far are designed to explore search spaces systematically.
This systematicity is achieved by keeping one or more paths in memory and by recording which alternatives have
been explored at each point along the path and which have not.

When a goal is found, the path to that goal also constitutes a solution to the problem.

In many problems, however, the path to the goal is irrelevant.

 If the path to the goal does not matter, we might consider a different class of algorithms, ones that do
not worry about paths at all. Local search algorithms operate using a single current state (rather than
multiple paths) and generally move only to neighbors of that state.
 In addition to finding goals, local search algorithms are useful for solving pure problems, in which the aim
is to find the best state according to an objective function.

6.1 HILL-CLIMBING SEARCH


The hill-climbing search algorithm is shown in Figure. 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 algorithm does not maintain a search tree, so the current node data structure need
only record the state and its objective function value.

 Hill climbing is sometimes called greedy local because it grabs a good neighbor state without
thinking ahead about where to go next.

 Local Maximum: Local maximum is a state which is better than its neighbor states, but there is
also another state which is higher than it.
 Global Maximum: Global maximum is the best possible state of state space landscape. It has the
highest value of objective function.
 Current state: It is a state in a landscape diagram where an agent is currently present.
 Flat local maximum: It is a flat space in the landscape where all the neighbor states of current
states have the same value.
 Shoulder: It is a plateau region which has an uphill edge.
6.1.1 8-queens problem
The eight queens puzzle is the problem of
placing eight chess queens on an 8×8 chessboard
so that no two queens threaten each other; thus,
a solution requires that no two queens share the
same row, column, or diagonal.

6.1.2 Problems
 Local maxima
 Ridges and alleys
 Plateau

6.1.2.1 Local maxima


Hill climbing will not necessarily find the global maximum, but may instead converge on
a local maximum.

6.1.2.2 Ridges and alleys


Ridges are a challenging problem for hill climbers that optimize in continuous spaces.
Because hill climbers only adjust one element in the vector at a time, each step will move
in an axis-aligned direction.

If the target function creates a narrow ridge then the hill climber can only ascend the
ridge.

Thus, it may take an unreasonable length of time for it to ascend the ridge (or descend
the alley).

6.1.2.3 Plateau
Another problem that sometimes occurs with hill climbing is that of a plateau. A plateau
is encountered when the search space is flat

You might also like