Use Arch 6
Use Arch 6
1 2
5 6
1
Problem - solving by searching Problem - solving by searching
Expanding the nodes in search tree • Measuring performance for a search algorithm:
1. Completeness : Does it find a solution if there is one?
• The leaf nodes are normally collected in a queue for 2. Time complexity: How long does it take to find the solution?
reasons of efficiency. 3. Space complexity: How much memory is required?
• The way new nodes are added to the queue distinguishes 4. Optimality: Is it the best possible solution?
the different search methods. Note that an Optimal algorithm only is guaranteed to find the
• Branching factor b :The number of new states generated best solution. The time and space requirements may still be a
when expanding a state. disadvantage.
The maximum number of states in a search tree of depth d
is:
b d? 1 ? 1
1? b ? b 2 ? ? ? b d ?
?? b?1
7 8
• Breadth first.
2 • 3. Set n to be the first node in N, and remove n from N.
• 4. If n is a goal node, then exit and signal success.
• Uniform cost. • 5. Otherwise, add the children of n to the end of N and
• Depth first. return to step 2.
• Depth limited. Complete. I.e: Finds a goal node if such node exists even if
• Iterative Deepening. the tree has infinite depth.
Uses space proportional to bd which may be a lot!
9 10
2
Problem - solving by search Problem - solving by search
b d? 1 ? 1
1? b ? b 2 ? ? ? b d ?
?? b?1
13 14
15 16