0% found this document useful (0 votes)
32 views

Informed Search

The document discusses informed search techniques for artificial intelligence. It introduces the concept of a heuristic function that estimates how close a state is to the goal. It describes greedy search, which expands the node closest to the goal based on the heuristic, and A* search, which combines the cost to reach a node with the heuristic estimate to prioritize exploration. A* is shown to be optimal if the heuristic is admissible. Examples of heuristic functions and A* search are provided.

Uploaded by

yusifovyadigar1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Informed Search

The document discusses informed search techniques for artificial intelligence. It introduces the concept of a heuristic function that estimates how close a state is to the goal. It describes greedy search, which expands the node closest to the goal based on the heuristic, and A* search, which combines the cost to reach a node with the heuristic estimate to prioritize exploration. A* is shown to be optimal if the heuristic is admissible. Examples of heuristic functions and A* search are provided.

Uploaded by

yusifovyadigar1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 106

Artificial Intelligence

SEARCH AGENTS / INFORMED SEARCH

[These slides were created by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley. All CS188 materials are available at http://ai.berkeley.edu.]

Some slides were taken from Columbia University AI course]


Informed search
Use domain knowledge!
• Are we getting close to the
goal?
• Use a heuristic function that
estimates how close a state is to
the goal
• A heuristic does NOT have to
be perfect!
• Example of strategies:
1. Greedy best-first search
2. A* search

https://s2.studylib.net/store/data/005619980_1-7549df02baee639673f2ec513575f462.png
Search
heuristic
 A heuristic is:
 A function that estimates how
close a state is to a goal
 Designed for a particular search
problem
 Examples: Manhattan distance,
Euclidean distance for pathing

https://thesaurus.plus/img/antonyms/577/heuristic.png
Search
heuristics

10

5
11.2
Informed
search

Heuristic!
Greedy search
• Evaluation function h(n) (heuristic)
• h(n) estimates the cost from n to the
closest goal
• Example: hSLD(n) = straight-line
distance from n to Sault Ste Marie
• Greedy search expands the node that
appears to be closest to goal
Greedy search example
The initial state:
Greedy search example
After expanding St Louis:
Greedy search example
After expanding Chicago:
Greedy search example
After expanding Duluth:
Examples using the map
Start: Saint Louis
Goal: Sault Ste Marie

Greedy search
Examples using the map
Start: Las Vegas
Goal: Calgary

Greedy search
Example: Heuristic Function

h(x)
Greedy Search
Expand the node that seems closest…

What can go wrong?


Greedy Search
b

Strategy: expand a node that you
think is closest to a goal state
◦ Heuristic: estimate of distance to
nearest goal for each state
A common case: b
◦ Best-first takes you straight to the …

(wrong) goal
Worst-case: like a badly-guided DFS
Properties of Gready Search
Video of Demo Contours Greedy (Empty)
Video of Demo Contours Greedy (Pacman Small Maze)
A* Search

UCS Greedy

A*
Combining UCS and Greedy
Uniform-cost orders by path cost, or backward cost g(n)
Greedy orders by goal proximity, or forward cost h(n)

8 g=0
S h=6
h=1 g=1
e a
1 h=5

1 3 2 g=2 g=9
S a d G
h=6 b d g=4 e h=1
h=6 h=5 h=2
1 h=2 h=0
1 g=3 g=6
c b g = 10
h=7 c G h=0 d
h=2
h=7 h=6
g = 12
G h=0
A* Search orders by the sum: f(n) = g(n) + h(n)
Example: Teg Grenager
F(n) is the estimated cost of the cheapest solution through n

A* search
• Minimize the total
estimated solution cost
• Combines:
- g(n): cost to reach node n
- h(n): cost to get from n to
the goal
- f(n) = g(n) + h(n)
A* search example
The initial state:
A* search example
After expanding St Louis:
A* search example
After expanding Chicago:
A* search example
After expanding Kansas City:
A* search example
After expanding Little Rock:
A* search example
After expanding Nashville:
A* search example
After expanding Pittsburgh:
A* search example
After expanding Toronto:
Examples using the map
Start: Saint Louis
Goal: Sault Ste Marie

A*
Example: Heuristic Function

h(x)
Examples using the map
Start: Las Vegas
Goal: Calgary

A*
When should A* terminate?
Should we stop when we enqueue a goal? h=2

2 A 2

S h=3 h=0 G

2 B 3
h=1
No: only stop when we dequeue a goal
Is A* Optimal? h=6

1 A 3

S h=7
G h=0

What went wrong?


Actual bad goal cost < estimated good goal cost
We need estimates to be less than actual costs!
Admissibilit
y
Inadmissible (pessimistic) heuristics break Admissible (optimistic) heuristics slow down
optimality by trapping good plans on the fringe bad plans, but never outweigh true costs
A* Optimality
If h(n) is admissible, A* using tree search is optimal.
A* Search Criteria
• Complete: Yes

• Time: exponential

• Space: keeps every node in memory, the biggest problem

• Optimal: Yes!
Properties of A*

Uniform-Cost A*

b b
… …
UCS vs A* Contours

Uniform-cost expands equally in all “directions”


Start Goal

A* expands mainly toward the goal, but does


hedge its bets to ensure optimality
Start Goal
Video of Demo Contours (Empty) --
UCS
Video of Demo Contours (Empty) --
Greedy
Video of Demo Contours (Empty) – A*
Video of Demo Contours (Pacman Small
Maze) – A*
Comparison

Greedy Uniform Cost A*


A*
applications
Video games
Pathing / routing problems
Resource planning problems
Robot motion planning
Language analysis
Machine translation
Speech recognition
http://www.shiningrocksoftware.com/wp-content/uploads/2013/11/LongPath-1024x576.jpg …
Search Algorithms Recap
• Uninformed Search: Use no domain knowledge.
◦ BFS, DFS, DLS, IDS, UCS.
• Informed Search: Use a heuristic function that estimates
how close a state is to the goal.
◦ Greedy search, A*
DFS

Searches branch by branch


... with each branch pursued to maximum depth.
DFS

Searches branch by branch


... with each branch pursued to maximum depth.
DFS

Searches branch by branch


... with each branch pursued to maximum depth.
DFS

Searches branch by branch


... with each branch pursued to maximum depth.
DFS

Searches branch by branch


... with each branch pursued to maximum depth.
DFS

Searches branch by branch


... with each branch pursued to maximum depth.
DFS

Searches branch by branch


... with each branch pursued to maximum depth.
DFS

Searches branch by branch


... with each branch pursued to maximum depth.
DFS

The frontier consists of unexplored siblings of all ancestors.


Search proceeds by exhausting one branch at a time.
IDS

Searches subtree by subtree


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree


... with each subtree increasing by depth limit.
IDS

Each iteration is simply an instance of depth-limited search.


Search proceeds by exhausting larger and larger subtrees.
IDS

Each iteration is simply an instance of depth-limited search.


Search proceeds by exhausting larger and larger subtrees.
IDS

Each iteration is simply an instance of depth-limited search.


Search proceeds by exhausting larger and larger subtrees.
IDS

Each iteration is simply an instance of depth-limited search.


Search proceeds by exhausting larger and larger subtrees.
IDS

Each iteration is simply an instance of depth-limited search.


Search proceeds by exhausting larger and larger subtrees.
IDS

Each iteration is simply an instance of depth-limited search.


Search proceeds by exhausting larger and larger subtrees.
BFS

Searches layer by layer


... with each layer organized by node depth.
BFS

Searches layer by layer


... with each layer organized by node depth.
BFS

Searches layer by layer


... with each layer organized by node depth.
BFS

Searches layer by layer


... with each layer organized by node depth.
BFS

Searches layer by layer


... with each layer organized by node depth.
BFS

Searches layer by layer


... with each layer organized by node depth.
BFS

Searches layer by layer


... with each layer organized by node depth.
BFS

Searches layer by layer


... with each layer organized by node depth.
BFS

The frontier consists of nodes of similar depth (horizontal).


Search proceeds by exhausting one layer at a time.
BFS

The frontier consists of nodes of similar depth (horizontal).


Search proceeds by exhausting one layer at a time.
BFS

The frontier consists of nodes of similar depth (horizontal).


Search proceeds by exhausting one layer at a time.
BFS

The frontier consists of nodes of similar depth (horizontal).


Search proceeds by exhausting one layer at a time.
BFS

The frontier consists of nodes of similar depth (horizontal).


Search proceeds by exhausting one layer at a time.
UCS

Searches layer by layer


... with each layer organized by path cost.
UCS

Searches layer by layer


... with each layer organized by path cost.
UCS

Searches layer by layer


... with each layer organized by path cost.
UCS

Searches layer by layer


... with each layer organized by path cost.
UCS

Searches layer by layer


... with each layer organized by path cost.
UCS

Searches layer by layer


... with each layer organized by path cost.
UCS

Searches layer by layer


... with each layer organized by path cost.
UCS

Searches layer by layer


... with each layer organized by path cost.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
Recap
Which cost function?

• UCS searches layers of increasing path cost.


• Greedy best first search searches layers of increasing heuristic
function.
• A* search searches layers of increasing path cost + heuristic
function.
Summary of algorithms

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy