Chapter 3
Chapter 3
Reminica
Arad Fagaras Oradea Vikea Arad Lugoj Arad Oradea
Arad
Reminica
Arad Fagaras Oradea Vikea Arad Lugoj Arad Oradea
Arad
Reminica
Arad Fagaras Oradea Vikea Arad Lugoj Arad Oradea
Informal Search algorithm (tree based)
Function : Tree-Search
Input : Problem, strategy
Output : Solution, Failure
Initialize : Select (Search-Node)
Procedure :
loop
if (fringe(empty)) then
return Failure
else
Node = get_Node(fringe)
If (Goal_Node == Node) then
return Solution(Goal_Node)
else
fringe = expand(strategy, Node)
fringe : Fringe is a collection containing the generated but not expanded Nodes
Breadth-first search (BFS)
1. Tree search implementation
2. FIFO input to the fringe in Tree search
3. Newly generated nodes by Successor Function are placed at
the end of fringe
4. Complete if the shallowest goal at d depth
5. Time complexity is O(bd+1)
a. d = depth
b. b = branching factor
6. Space complexity
a. b1+b2+b3+…+bd+bd+1 = O(bd+1)
Breadth-first search (BFS)
Depth-first search (DFS)
• Tree search implementation
• LIFO input to the fringe in the Tree search
• Newly generated nodes by Successor Function are
placed at the start of fringe
• Incomplete if a node at depth d is at infinite length
• Low memory space requirement
• The expanded leaf nodes are dropped from fringe
• Store single path from the root node to the leaf node
along with unexpanded sibling
• O(bm+1) Branching factor b, depth m
• Time complexity O(bm)
Depth-first search (DFS)
Back tracking (variant DFS)
• Only one successor is generated instead of all
successors
• Partially expanded node remember which successor to
generate next
• Space requirement O(m) instead of O(bm)
• Depth limit search perform DFS with a predefined
depth limit l
Iterative deepening DFS
• Iterative deepening depth-first search
• Variation of DFS
• Depth limit increase gradually if goal node is not found,
i.e., 0, 1, 2, d.
• Memory requirement O(bd)
• Regeneration of multiple states (from root node)
• Leaf nodes are only created once
• Generated nodes
o d(b)1 + (d-1)b2+…+(1)bd
• Time complexity O(bd)
Iterative deepening DFS
Bidirectional search
• Begin with start and goal node
• Proceed in opposite direction towards each other
• If a node in the search tree of one search (start to
goal/goal to start) exists in other nodes fringe then
solution is considered to be found
• Time and space complexity is O(bd/2)
Sensorless search
• Agent has no sensors
• Agent may exist in any of available state
• Action leads to next legal state
• Vacuum cleaner agent
• Action : move left, move right, suck
Sensorless vacuum cleaner
• Search in space of belief state than in physical state
• Environment is deterministic, i.e., action leads to a
known state
• Initial state : {1,…8}
• Action (move right) : {2,4,6,8}
• Action (suck) : {4,8}
• Action (move left) : {1, 3, 5, 7}
• Action (suck) : {7} Goal state
Sensorless vacuum cleaner
Contingency problem
• In a Partially observable environment OR uncertain actions
• Percepts provide new information after each action