0% found this document useful (0 votes)
83 views13 pages

Searches (AI)

The document outlines uninformed search methods for problem solving in deterministic single-agent domains. It discusses key terminology used in tree search algorithms like states, nodes, branching factor, and path costs. It then describes the basic search algorithm and how different methods like breadth-first search (BFS) and depth-first search (DFS) are variations that implement the fringe set as a queue with different ordering. The properties, strengths, and weaknesses of BFS, DFS, and iterative deepening search are also covered.

Uploaded by

api-3727188
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views13 pages

Searches (AI)

The document outlines uninformed search methods for problem solving in deterministic single-agent domains. It discusses key terminology used in tree search algorithms like states, nodes, branching factor, and path costs. It then describes the basic search algorithm and how different methods like breadth-first search (BFS) and depth-first search (DFS) are variations that implement the fringe set as a queue with different ordering. The properties, strengths, and weaknesses of BFS, DFS, and iterative deepening search are also covered.

Uploaded by

api-3727188
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Outline

CS380: Intro to Artificial


Problem Solving in Deterministic, Single-
Intelligence Agent Domains
9/29/2006  Uninformed Search Methods
 BFS, DFS, IDS
Jay Modi
Department of Computer Science
Drexel University
www.cs.drexel.edu/~pmodi

An Example Search Problem


Terminology
 b: branching factor, max number of next
states of any state
 d: steps to goal
 m: maximum possible path length
 Not always finite. Why not?

1
Terminology: States vs. Nodes
Tree search algorithms
 A state is a property of the world, e.g., location
 A node is a data structure which specifies state, parent node, action,  Basic idea:
path cost g(x), depth  offline, simulated exploration of state space by
 A state can have multiple nodes
generating successors of already-explored states
Nodes (a.k.a.~expanding states)
State State: Sibiu
Sibiu State of Parent Node: Arad

State: Sibiu
Arad Fagaras State of Parent Node: Fagaras

The Mother of All Search


Complications
Algorithms
 current state <− start state  How to choose next state from fringe set?
 loop:  Answer has significant implications on:
 is current state = the goal state? If yes, output path and  Time complexity
 Number of loops
terminate.
 Space complexity
 generate all next states of current state and add to  Size of fringe set
fringe set
 Completeness
 current state <− choose state from fringe set  Does loop terminate
 Optimality
All search algorithms can be viewed as instances of this.  Quality of output path
Simple, right?

2
How to Choose From Fringe Set? Breadth-First Search
 One idea:
 Implement fringe set as a First-in First-out
(FIFO) queue
f -> e,d,c,b -> a
 We call this Breadth-First Search

Start State: A
Current State: A
Fringe Set: {}

Breadth-First Search Breadth-First Search

Start State: A Start State: A


Current State: A Current State: B
Fringe Set: {C, B} Fringe Set: { E, D, C}
Choose next state: B Choose next state: C

3
Breadth-First Search Properties of BFS
 Is it Complete?
 Is it Optimal?
 Will it always return shortest path?
 Space complexity
 How large can the fringe set get?
 O(bd+1) :( Why?
Start State: A
Current State: C  Time complexity?
Fringe Set: { G, F, E, D}
Choose next state: D

How to Choose From Fringe Set? Depth-First Search


 Another idea:
 Implement fringe set as a Last-in,First-out
(LIFO) queue
f -> e,d,c,b,a

f <- f,e,d,c,b,a

Start State: A
 We call this Depth-First Search Goal State: M
Current State: A
Fringe Set: {}

4
Depth-First Search Depth-First Search

Start State: A Start State: A


Current State: A Current State: B
Fringe Set: {B, C} Fringe Set: {D, E, C}
Choose Next State: B Choose Next State: D

Depth-First Search Depth-First Search

Start State: A Q: What would Start State: A


Current State: B BFS do? Current State: D
Fringe Set: {D, E, C} Fringe Set: {H,I,E,C}
Choose Next State: D Choose Next State: H

5
Depth-First Search Depth-First Search

Start State: A Start State: A


Current State: H Current State: I
Fringe Set: {I,E,C} Fringe Set: {E,C}
Choose Next State: I Choose Next State: E

Depth-First Search Depth-First Search

Start State: A Start State: A


Current State: E Current State: J
Fringe Set: {J, K ,C} Fringe Set: {K ,C}
Choose Next State: J Choose Next State: K

6
Depth-First Search Depth-First Search

Start State: A Start State: A


Current State: K Current State: C
Fringe Set: {C} Fringe Set: {F, G}
Choose Next State: C Choose Next State: F

Depth-First Search Depth-First Search

Start State: A Start State: A


Current State: F Current State: L
Fringe Set: {L, M, G} Fringe Set: {M, G}
Choose Next State: L Choose Next State: M

7
Depth-First Search Properties of depth-first search

 Space?
 bm+1
 Time?
 Optimal?
 Complete?
 No. Why?
Start State: A
Current State: M Goal Reached.  Can we fix this?
Fringe Set: {G} Algorithm Terminates
Current State = Goal State

Properties of depth-first search Guaranteeing Completeness


 Complete? No: fails in infinite-depth spaces,  Idea: Invoke Depth-Limited DFS with
spaces with loops
iteratively increasing values of L
 Modify to avoid repeated states along path
 complete in finite spaces  We call this Iterative Deepening Search
 Idea: Cut off search after depth limit L
 We call this Depth-Limited DFS
 Is it complete?

8
Iterative deepening search l =0 Iterative deepening search l =1

Iterative deepening search l =2 Iterative deepening search l =3

9
Iterative deepening search Iterative deepening search
 Number of nodes generated in a depth-limited search to depth d with
 Iterative Deepening search repeatedly re- branching factor b?
 NDLS = b0 + b1 + b2 + … + bd-2 + bd-1 + bd
expanding nodes
 Number of nodes generated in an iterative deepening search to depth d with
 Seems inefficient, but is it? branching factor b?
 NIDS = (d+1)b0 + d b^1 + (d-1)b^2 + … + 3bd-2 +2bd-1 + 1bd

 For b = 10, d = 5,
 NDLS = 1 + 10 + 100 + 1,000 + 10,000 + 100,000 = 111,111
 NIDS = 6 + 50 + 400 + 3,000 + 20,000 + 100,000 = 123,456

 Overhead = (123,456 - 111,111)/111,111 = 11%

 Iterative Deepening is the method of choice for searching large state spaces
when depth of solution is not known

Properties of iterative deepening Properties of iterative deepening


search search
 Complete?  Complete? Yes
 Time?  Time? d b1 + (d-1)b2 + … + bd = O(bd)
 Space?  Space? O(bd)
 Optimal?  Optimal? Yes, if step cost = 1

10
Bidirectional Search Bidirectional Search
 In IDS, we saw that branching factor gets  In IDS, we saw that branching factor gets
exponentially worse with depth exponentially worse with depth
 Idea: Minimize depth by doing two parallel
searches

Path Costs How to Choose From Fringe Set?


 So far, we have assumed unit cost for each  A third idea:
state transition.  Implement fringe set as an insert-in-order
Priority queue
 What if each transition has a different cost?
(e,6)

(b,10), (a,5), (d,3), (c,1)

 We call this Uniform-Cost Search

11
Uniform Cost Search Uniform Cost Search

1 3 1 3

3 4 0 4 3 4 0 4

Start State: A Start State: A


Current State: A Current State: A
Fringe Set: {} Fringe Set: {(C,3), (B,1)}
Choose next state: B

Uniform Cost Search Uniform Cost Search

1 3 1 3

3 4 0 4 3 4 0 4

Start State: A Start State: A


Current State: B Current State: C
Fringe Set: { (E,5), (D,4), (C,3)} Fringe Set: { (G, 7), (E,5), (D,4), (F,3)}
Choose next state: C Choose next state: F

12
Summary of algorithms Summary
 Agent and Environment Types

 Variety of uninformed search strategies

 Iterative deepening search uses only linear space and not


much more time than other uninformed algorithms

13

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