My AI
My AI
My AI
INTELLIGENCE
UNIT -III
Search:
Informal and informal
algorithms of depth 1st
breadth 1st
hill climbing
beat 1st
search and bound
game playing
Mini-max search
alpha and beta pruning
forward and backward reasoning
Search Methods
Ø State-based Search
Ø Uninformed (blind) search
algorithms
Ø Breadth-First Search (BFS)
Ø Uniform-Cost Search
Ø Depth-First Search (DFS)
Ø Depth-Limited Search
Ø Iterative Deepening
Ø Informed search
Steps for Problem Solving
Formulate — Search — Execute
1. Goal formulation
2. Problem formulation
3. Search algorithm
4. Execution
Single-state problem formulation
1. initial state
2. actions or successor function
3. goal test (explicit or implicit)
4. path cost (∑ c(x,a,y) – sum of step costs)
idea: order the branches under each node so that the “most
promising” ones are explored first
Tree search example
Tree search example
Click to edit Master text styles
Second level
● Third level
● Fourth level
● Fifth level
Tree search example
Click to edit Master text styles
Second level
● Third level
● Fourth level
● Fifth level
Implementation: general tree search
states vs. nodes
Ø A state is a (representation of) a physical configuration
Ø A node is a data structure constituting part of a search tree
includes state, parent node, action, path cost g(x), depth
● Fourth level
● Fifth level
Breadth-first search
Expand shallowest unexpanded node
Implementation:
fringe is a FIFO queue, i.e., new successors
go at end
Breadth-first search
Expand shallowest unexpanded node
Implementation:
fringe is a FIFO queue, i.e., new successors
go at end
Properties of breadth-first search
Complete?
Yes (if b is finite)
Time?
1+b+b2+b3+… +bd + b(bd-1) = O(bd+1)
Space?
O(bd+1) (keeps every node in memory)
Optimal?
Only if cost = 1 per step; not true in general
Time?
O(bm): terrible if m is much larger than d
Ø but if solutions are dense, may be much faster than BFS
Space?
Ø O(bm), i.e., linear space!
Optimal?
No
Depth-limited search
= depth-first search with depth limit d ,
i.e., nodes at depth d have no successors
Recursive implementation:
Example: 8-puzzle
47 nodes
generated
Soluti
on
Example: 8-puzzle
Generated
and
Explored
31 nodes
Generated
but
Not Explored
4 nodes
Soluti
on