Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

State-Space Search: Depth-First and Breadth-First Algorithms, Study notes of Algorithms and Programming

Graph traversal algorithms, specifically depth-first search (dfs) and breadth-first search (bfs). It also covers the concept of state-space search, which involves generating the graph as we search. Examples of state-space problems and tree search algorithms.

Typology: Study notes

Pre 2010

Uploaded on 08/18/2009

koofers-user-dzp
koofers-user-dzp 🇺🇸

10 documents

1 / 61

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
StateSpace
Search
COMP157
Oct10,2007
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d

Partial preview of the text

Download State-Space Search: Depth-First and Breadth-First Algorithms and more Study notes Algorithms and Programming in PDF only on Docsity!

State

Space

Search

COMP

Oct

Graph

Traversal

Many

problems

require

processing

all

graph

vertices

(and

edges)

in

systematic

fashion

Graph

traversal

algorithms:

Depth

first

search

(DFS)

Breadth

first

search

(BFS)

REVIEW

Depth

First

Search

REVIEW

Depth

First

Search

a

b

e

f

c

d

g

h

a b

f e

g c d h

tree edgeback edge

DFS traversal stack:

h(8)d(7)

e(4) c(6)f(3) g(5)b(2)a(1)

REVIEW

Breadth

First

Search

REVIEW

Breadth

First

Search

BFS tree: a b

e f

g c h d

tree edgecross edge

a

b

e

f

c

d

g

h

BFS

traversal

queue:

a(1) b(2) e(3) f(4)

b(2) e(3) f(4) g(5)

g(5) c(6) h(7)

c(6) h(7) d(8)

REVIEW

FIX THIS

State

space

Search

Problems

A

state

space

search

problem

consists

of:

an

initial

state

a

set

of

possible

actions

-^

an

action

transforms

a

state

into

a

new

state

A

goal

state

(or

states)

path

costs

-^

cost

of

moving

from

one

state

to

another

A

solution

consists

of

a

sequence

of

actions

leading

from

initial

state

to

a

goal

state

Example

Problem:

Vacuum

World

Vacuum world has two cells (left and right),which can be dirty or clean.The vacuum robot which can do any of the following:

  • move to left cell• move right cell• suck (clean the current cell)

The goal is to have both cells clean.

State

Space:

Vacuum

World

State

space

graph

shows

all

possible

states

and

the

state

transitions

caused

by

all

possible

actions

State

space

graph

is

usually

not

explicit,

rather

it

is

implicitly

defined

by

a

successor

function

8 possible statesdue to3 boolean valuedstate variables

Successor

Functions

A

successor

function

maps

a

state

and

action

to

a

new

state

<state,

action>

Æ

state

It

may

be

explicit

(i.e.

a

lookup

table)

or

implicit

(defined

as

a

function)

Example:

The

puzzle

states? locations

of

tiles

actions? move

blank

left,

right,

up,

down

goal

test? goal

state

(see

figure)

path

cost?

1

per

move

Example:

The

puzzle

The

successor

function

is

best

defined

by

a

function

a

table

would

be

excessively

large

How

many

possible

states

are

there

for

this

problem?

Tree

search

algorithms

explore

the

state

space

by

generating

successors

of

already

explored

states

The strategy for selecting the next nodeto expand determines the type of search

Example:

Romania

In this case, we do have an explicit graph of the state space.