Informed Search: CS 4804 Fall 2020

Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

Informed Search

CS 4804 Fall 2020


Virginia Tech
Today’s Topics

• Informed Search Strategies


– Heuristics
– Greedy Search
– A* Search
Recap: Uninformed Search
• Breadth First Search uses S S
a FIFO(First In First Out)
Queue S->A S->B

• Depth First Search uses a A B


LIFO(Last In First Out)
Stack S->A->G S->B->G

• Demo G
Recap: Uninformed Search Algorithms
1. Is Depth-first graph search guaranteed to
return an optimal solution?
2. Is Breadth-first graph search guaranteed to
return an optimal solution?
3. Is Uniform-cost graph search guaranteed to
return an optimal solution?
4. Is Iterative Deepening graph search
guaranteed to return an optimal solution?
Informed Search
• Uniformed search: can be both complete and
optimal, but can be very slow
• Informed search:
– Uses domain-specific hints
– More focus
– Can find solutions more efficiently
– Heuristic function: h(n)
Heuristics
• Heuristic is a problem-solving technique that finds a
satisfactory(good-enough) solution given a limited time frame
• The heuristic function is a way to inform the search about
the direction to a goal
• Heuristic function h(n):
– Estimated cost of the cheapest path from the state at node n to a
goal state
• Designed for a particular search problem
• Examples: Euclidean distance
– Manhattan distance: |x1 −x2|+|y1 −y2|
B
– Euclidean distance:

A
HSLD: Straight-line distance

HSLD(n)
Greedy best-first Search
• From city A (Arad) to city B (Bucharest)
• Strategy: Expand a node with the lowest h(n) value
A->S->F->B = 450
Greedy Best-first Search
• Operates like UCS (Uniform Cost Search) with a
priority queue
– Difference: use estimated forward cost, not computed
backward cost
• Not optimal
• May not find the best solution
• May not find the solution (if use a very bad h(n))
• Worse-case: Just like a badly-guided DFS and
exploring all the wrong areas
A* Search
• Combing UCS and Greedy
• f(n) = g(n) + h(n): lowest estimated cost of the path
from n to G
• g(n) is the path cost from the initial state to node n
• Uses a priority queue
• A* combines the total backward cost and estimated
forward cost (heuristic value)
• Effectively yielding an estimated total cost from start to
goal
140
140

80
140

99
140

80

97 A -> S - > R -> P -> B = 418


A* Search (Continued.)
• Completeness: Yes
• Cost optimality: Depends on the properties of the heuristic
• Properties of the heuristic:
– Admissibility: admissible (optimistic) heuristic never overestimates the
cost. 0<= h(𝑛)<=h*(𝑛)
– Consistency: h(𝑛) <= h(𝑛′) + cost(n, a, n’)
– Consistent heuristic is admissible

• A* may or may not cost-optimal with an inadmissible heuristic


A* is cost-optimal with an admissible heuristic
• admissible (optimistic) heuristic never overestimates the cost. 0<=
h(𝑛)<=h*(𝑛)
• C* is the optimal path cost
• If A* is not cost-optimal, f(n) > C*
– (There must be some node n is on the optimal path and is unexpanded)
• f(n) = g(n) + h(n)
• f(n) = g*(n) + h(n)
– n is on the optimal path
• f(n) <= g*(n) + h*(n)
• f(n) <= C*, Contradiction! So A* is cost-optimal
Example: Consistency

• h(B) is consistent B
– h(A)<= c(A, a,B) + h(B) 2 1
– h(B)<= c(B, a, A) + h(A)
A C
– h(C)<= c(C, a, B) + h(B)
– h(B)<= c(B, a, C) + h(C)
– h(A) = 7, h(B) = 5, h(C) = 5
Search Contours
• Demo
• Pruning: eliminating possibilities from consideration
without having to examine them
Inadmissible Heuristics and Weighted A*
• Weighted A* search:
– f(n) = g(n) + W x h(n), W>1
– With slightly more costs, but could search faster
– Optimal path may not be found
• Cost of Weighted A* search: between C* and W x C*
A* search g(n) + h(n) W=1
UCS search g(n) W=0
Greedy search h(n) W=∞
Weighted A* search g(n) + W x h(n) W>1
Heuristic Functions
• Start States: any tile can be
designated as the start state
• Actions: Blank space moving

• Action cost: 1
• h1: # of misplaced tiles
• h2: sum of the distances of the
tiles from their goal positions
Heuristic Quality
• Effective branching factor b*
N + 1 = 1+ b* + (b*)2 + ... + (b*)d
• Dominance: h2(n) >= h1(n)
Memory-bounded Search

• Beam search: limits the size of the frontier


• Iterative-deepening A* search (IDA*)
• Bidirectional A* Search
• Recursive best-first search (RBFS)
• Simplified memory-bounded A* (SMA*)
• …
Reading and Next Class

• Informed Search: AIMA 3.5, 3.6


• Game: AIMA 5.1-5.3

You might also like