cse 573: artificial intelligence - courses.cs.washington.edu · 2019-01-09 · cse 573: artificial...
TRANSCRIPT
![Page 1: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/1.jpg)
CSE 573: Artificial IntelligenceWinter 2019
Hanna Hajishirzi
Problem Spaces and Search
slides from Dan Klein, Stuart Russell, Andrew Moore, Dan Weld, Pieter Abbeel, Luke Zettelmoyer
![Page 2: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/2.jpg)
Logistics
▪ Feedback:
▪ You can submit feedback through the Allen
School’s anonymous feedback tool
https://www.cs.washington.edu/alumni/feedback
▪ Discussions and questions in class
▪ Check the schedule
▪ Remember, there are three penalty-free late
day for the whole quarter (except final
project) 2
![Page 3: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/3.jpg)
Outline
▪ Agents that Plan Ahead
▪ Search Problems
▪ Uninformed Search Methods
▪ Depth-First Search
▪ Breadth-First Search
▪ Uniform-Cost Search
▪ Heuristic Search Methods
▪ Best First / Greedy Search
▪ A*
![Page 4: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/4.jpg)
Review: Agents
Search -- the environment is:
fully observable, single agent, deterministic, static, discrete
Agent
Sensors
?
Actuators
Environment
Percepts
Actions
An agent:
• Perceives and acts
• Selects actions that maximize its utility function
• Has a goal
Environment:
• Input and output to the agent
![Page 5: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/5.jpg)
Reflex Agents
▪ Reflex agents:
▪ Choose action based on current percept (and maybe memory)
▪ Do not consider the future consequences of their actions
▪ Act on how the world IS
▪ Can a reflex agent achieve goals?
![Page 6: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/6.jpg)
Goal Based Agents
▪ Goal-based agents:
▪ Plan ahead
▪ Ask “what if”
▪ Decisions based on (hypothesized) consequences of actions
▪ Must have a model of how the world evolves in response to actions
▪ Act on how the world WOULD BE
![Page 7: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/7.jpg)
Search: it is not just for agents
Hardware verification
Search: It’s not just for Agents
11
Hardware verificationPlanning optimal repair
sequences
Search: It’s not just for Agents
11
Hardware verificationPlanning optimal repair
sequences
Planning optimal repair
sequences
![Page 8: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/8.jpg)
Search thru a
▪ Set of states
▪ Successor Function [and costs - default to 1.0]
▪ Start state
▪ Goal state [test]
• Path: start a state satisfying goal test
• [May require shortest path]
• [Sometimes just need state passing test]
• Input:
• Output:
Problem Space / State Space
![Page 9: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/9.jpg)
Example: Simplified Pac-Man
▪ Input:▪ A state space
▪ A successor function
▪ A start state
▪ A goal test
▪ Output:
“N”, 1.0
“E”, 1.0
![Page 10: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/10.jpg)
Ex: Route Planning: Romania → Bucharest
▪ Input:
▪ Set of states
▪ Operators [and costs]
▪ Start state
▪ Goal state (test)
▪ Output:
![Page 11: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/11.jpg)
Example: N Queens
▪ Input:▪ Set of states
▪ Operators [and costs]
▪ Start state
▪ Goal state (test)
▪ Output
Q
Q
Q
Q
![Page 12: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/12.jpg)
Algebraic Simplification
▪ Input:
▪ Set of states
▪ Operators [and costs]
▪ Start state
▪ Goal state (test)
▪ Output:
![Page 13: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/13.jpg)
Parsing Natural Language
13
▪ Input:
▪ Set of states
▪ Operations
▪ Start state
▪ Goal state (test)
▪ Output:
This lecture is about search algorithms.
1/3/2019 corenlp.run
http://corenlp.run/ 1/2
art-of-Speech:
This lecture is about search algorithms .
DT NN VBZ IN NN NNS .
1
asic Dependencies:
This lecture is about search algorithms .
DT NN VBZ IN NN NNS .det punctcompound
casecop
nsubj
1
nhanced++ Dependencies:
This lecture is about search algorithms .
DT NN VBZ IN NN NNS .det punctcompound
casecop
nsubj
1
oreNLP Tools:
Enter a TokensRegex (http:/ /nlp.stanford.edu/software/tokensregex.shtml) expression to run against the above sentence:
Visualisation provided using the brat visualisation/annotation software (http://brat.nlplab.org/).
— Text to annotate —
— Annotations —
dependency parse parts-of-speech
— Language —
Submit
TokensRegex Semgrex Tregex
![Page 14: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/14.jpg)
What is in State Space?
▪ A world state includes every details of the environment
!
!
!
!
!
!
!
!
!
!
▪ A search state includes only details needed for planning
Problem: Pathing Problem: Eat-all-dots
States: {x,y} locations
Actions: NSEW moves
Successor: update location
Goal: is (x,y) End?
States: {(x,y), dot booleans}
Actions: NSEW moves
Successor: update location
and dot boolean
Goal: dots all false?
![Page 15: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/15.jpg)
State Space Sizes?
▪ World states:
▪ Pacman positions:
10 x 12 = 120
▪ Pacman facing:
up, down, left, right
▪ Food Count: 30
▪ Ghost positions: 12
![Page 16: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/16.jpg)
State Space Sizes?
▪ How many?
▪ World State:
▪ States for Pathing:
▪ States for eat-all-dots:
120*(230)*(122)*4
120
120*(230)
![Page 17: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/17.jpg)
State Representation
▪ Real-world applications:
▪ Requires approximations and heuristics
▪ Need to design state representation so that
search is feasible
▪ Only focus on important aspects of the state
▪ E.g., Use features to represent world states
17
![Page 18: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/18.jpg)
State Space Graphs
▪ State space graph:
▪ Each node is a state
▪ The successor function
is represented by arcs
▪ Edges may be labeled
with costs
▪ We can rarely build this
graph in memory (so we don’t)
![Page 19: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/19.jpg)
Search Trees
▪ A search tree:
▪ Start state at the root node
▪ Children correspond to successors
▪ Nodes contain states, correspond to PLANS to those states
▪ Edges are labeled with actions and costs
▪ For most problems, we can never actually build the whole tree
“E”, 1.0“N”, 1.0
![Page 20: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/20.jpg)
Example: Tree Search
S
G
d
b
pq
c
e
h
a
f
r
State Graph:
What is the search tree?
![Page 21: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/21.jpg)
State Graphs vs. Search Trees
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c Ga
S
G
d
b
pq
c
e
h
a
f
r
We construct both
on demand – and
we construct as
little as possible.
Each NODE in the
search tree is an entire
PATH in the problem
graph.
![Page 22: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/22.jpg)
States vs. Nodes
▪ Nodes in state space graphs are problem states
▪ Represent an abstracted state of the world
▪ Have successors, can be goal / non-goal, have multiple predecessors
▪ Nodes in search trees are plans
▪ Represent a plan (sequence of actions) which results in the node’s
state
▪ Have a problem state and one parent, a path length, a depth & a cost
▪ The same problem state may be achieved by multiple search tree
nodes
Depth 5
Depth 6
Parent
Node
Search NodesProblem States
Action
![Page 23: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/23.jpg)
Quiz:#State#Graphs#vs.#Search#Trees#
S G
b
a
Consider#this#4Jstate#graph:##
Important:#Lots#of#repeated#structure#in#the#search#tree!#
How#big#is#its#search#tree#(from#S)?#
![Page 24: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/24.jpg)
Building Search Trees
▪ Search:▪ Expand out possible plans
▪ Maintain a fringe of unexpanded plans
▪ Try to expand as few tree nodes as possible
![Page 25: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/25.jpg)
General Tree Search
▪ Important ideas:▪ Fringe
▪ Expansion
▪ Exploration strategy
▪ Main question: which fringe nodes to explore?
Detailed pseudocode is
in the book!
![Page 26: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/26.jpg)
Search Algorithms
▪ Uninformed Search Methods
▪ Depth-First Search
▪ Breadth-First Search
▪ Uniform-Cost Search
▪ Heuristic Search Methods
▪ Best First / Greedy Search
▪ A*
![Page 27: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/27.jpg)
Review: Depth First Search
S
G
d
b
pq
c
e
h
a
f
r
Strategy: expand
deepest node first
Implementation:
Fringe is a LIFO
queue (a stack)
![Page 28: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/28.jpg)
Review: Depth First Search
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
S
G
d
b
pq
c
e
h
a
f
rq
p
h
fd
b
a
c
e
r
Expansion ordering:
(d,b,a,c,a,e,h,p,q,q,r,f,c,a,G)
![Page 29: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/29.jpg)
Review: Breadth First Search
S
G
d
b
pq
c
e
h
a
f
r
Strategy: expand
shallowest node
first
Implementation:
Fringe is a FIFO
queue
![Page 30: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/30.jpg)
Review: Breadth First Search
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
S
G
d
b
p q
c
e
h
a
f
r
Search
Tiers
Expansion order:
(S,d,e,p,b,c,e,h,r,q,a,a
,h,r,p,q,f,p,q,f,q,c,G)
![Page 31: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/31.jpg)
Search Algorithm Properties
▪ Complete? Guaranteed to find a solution if one exists?
▪ Optimal? Guaranteed to find the least cost path?
▪ Time complexity?
▪ Space complexity?
Variables:
n Number of states in the problem
b The maximum branching factor B
(the maximum number of successors for a state)
C* Cost of least cost solution
d Depth of the shallowest solution
m Max depth of the search tree
![Page 32: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/32.jpg)
DFS
▪ Infinite paths make DFS incomplete…
▪ How can we fix this?
▪ Check new nodes against path from S
▪ Infinite search spaces still a problem
▪ If the left subtree has unbounded depth
Algorithm Complete Optimal Time Space
DFS Depth First
SearchN N O(BLMAX) O(LMAX)
START
GOALa
b
No No Infinite Infinite
![Page 33: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/33.jpg)
DFS
Algorithm Complete Optimal Time Space
DFS w/ Path
Checking Y if finite N O(bm) O(bm)
…b
1 node
b nodes
b2 nodes
bm nodes
m tiers
![Page 34: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/34.jpg)
BFS
Algorithm Complete Optimal Time Space
DFS w/ Path
Checking
BFS
Y N O(bm) O(bm)
Y Y* O(bd) O(bd)
…b
1 node
b nodes
b2 nodes
bm nodes
d tiers
bd nodes
![Page 35: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/35.jpg)
Comparisons
▪ When will BFS outperform DFS?
▪ When will DFS outperform BFS?
![Page 36: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/36.jpg)
![Page 37: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/37.jpg)
38
![Page 38: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/38.jpg)
Iterative Deepening
Iterative deepening uses DFS as a subroutine:
1. Do a DFS which only searches for paths of
length 1 or less.
2. If “1” failed, do a DFS which only searches paths
of length 2 or less.
3. If “2” failed, do a DFS which only searches paths
of length 3 or less.
….and so on.
Algorithm Complete Optimal Time Space
DFS w/ Path
Checking
BFS
ID
Y N O(bm) O(bm)
Y Y* O(bd) O(bd)
Y Y* O(bd) O(bd)
…b
![Page 39: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/39.jpg)
Search Methods
▪ Blind Search:
▪ Depth First Search
▪ Breadth First Search
▪ Iterative Deepening Search
40
![Page 40: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/40.jpg)
Search Methods
▪ Blind Search:
▪ Depth First Search
▪ Breadth First Search
▪ Iterative Deepening Search
▪ Heuristic Search
▪ Best First Search
▪ Uniform Cost Search
▪ Greedy Search
▪ A*
▪ Iterative Deepening A*
▪ Beam Search
▪ Hill Climbing41
![Page 41: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/41.jpg)
Blind Vs. Heuristic Search
▪ Cost of actions
▪ Heuristic guidance
42
![Page 42: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/42.jpg)
Costs on Actions
Notice that BFS finds the shortest path in terms of number of transitions. It does not find the least-cost path.
START
GOAL
d
b
pq
c
e
h
a
f
r
2
9 2
81
8
2
3
1
4
4
15
1
32
2
![Page 43: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/43.jpg)
Uniform Cost Search
START
GOAL
d
b
pq
c
e
h
a
f
r
2
9 2
81
8
2
3
1
4
4
15
1
32
2
Expand
cheapest
node first:
Fringe is a
priority
queue
![Page 44: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/44.jpg)
Uniform Cost Search
▪ Generalization of breadth-first search
▪ Priority queue of nodes to be explored
▪ Cost function f(n) applied to each node
Add initial state to priority queue
While queue not empty
Node = head(queue)
If goal?(node) then return node
Add children of node to queue
![Page 45: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/45.jpg)
Uniform Cost Search
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Expansion order:
(S,p,d,b,e,a,r,f,e,G) S
G
d
b
pq
c
e
h
a
f
r
3 9 1
16411
5
713
8
1011
17 11
0
6
39
1
1
2
8
81
15
1
2
Cost
contours
2
![Page 46: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/46.jpg)
Uniform Cost Search
Algorithm Complete Optimal Time Space
DFS w/ Path
Checking
BFS
UCS
Y N O(bm) O(bm)
Y Y* O(bd) O(bd)
Y* Y O(bC*/) O(bC*/)
…b
C*/ tiers
Every action costs at least ε
![Page 47: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/47.jpg)
Uniform Cost Issues
▪ Remember: explores increasing cost contours
▪ The good: UCS is complete and optimal!
▪ The bad:▪ Explores options in every
“direction”▪ No information about goal
location Start Goal
…
c 3
c 2
c 1
![Page 48: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/48.jpg)
Uniform Cost: Pac-Man
▪ Cost of 1 for each action
▪ Explores all of the states, but one
![Page 49: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/49.jpg)
Search Heuristics
▪ Any estimate of how close a state is to a goal
▪ Designed for a particular search problem
10
5
11.2
▪ Examples: Manhattan distance, Euclidean distance
![Page 50: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/50.jpg)
Heuristics
H(x)
![Page 51: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/51.jpg)
Best First / Greedy Search
Best first with f(n) = heuristic estimate of distance to goal
![Page 52: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/52.jpg)
Best First / Greedy Search
▪ Expand the node that seems closest…
▪ What can go wrong?
253
178
![Page 53: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/53.jpg)
Best First / Greedy Search
▪ A common case:▪ Best-first takes you straight
to the (wrong) goal
▪ Worst-case: like a badly-guided DFS in the worst case▪ Can explore everything
▪ Can get stuck in loops if no cycle checking
▪ Like DFS in completeness (finite states w/ cycle checking)
…b
…b
![Page 54: CSE 573: Artificial Intelligence - courses.cs.washington.edu · 2019-01-09 · CSE 573: Artificial Intelligence Winter 2019 Hanna Hajishirzi Problem Spaces and Search ... / / n lp](https://reader030.vdocument.in/reader030/viewer/2022040612/5edc69bfad6a402d66670f7a/html5/thumbnails/54.jpg)
To Do:
▪ Look at the course website:
▪ https://courses.cs.washington.edu/courses/c
se573/19wi/
▪ Do the readings (Ch 3)
▪ Start PS1
▪ START PS1 ASAP
▪ Try this visualization tool:
▪ interactive search visualization