Docsity

Blind Searches: Characteristics and Algorithms, Essays (university) of Artificial Intelligence

Partial preview of the text

Download Blind Searches: Characteristics and Algorithms and more Essays (university) Artificial Intelligence in PDF only on Docsity!

Artificial

Artificial

Intelligence

Intelligence

Blind Searches

Is ant search for food is Blind

Searches??

Blind Searches - Characteristics

Blind Searches - Characteristics

Simply searches the State Space

Simply searches the State Space

Can only distinguish between a goal state

Can only distinguish between a goal state

and a non-goal state

and a non-goal state

Sometimes called an uninformed search

Sometimes called an uninformed search

as it has no knowledge about its domain

as it has no knowledge about its domain

Blind Searches - Why Use

Blind Searches - Why Use

We may not have any domain knowledge

We may not have any domain knowledge

we can give the search

we can give the search

We may not want to implement a specific

We may not want to implement a specific

search for a given problem. We may

search for a given problem. We may

prefer just to use a blind search

prefer just to use a blind search

5

Example: the 8-puzzle.

Example: the 8-puzzle.

Given:

Given: a board situation for the 8-puzzle:

a board situation for the 8-puzzle:

Problem

Problem :

find a sequence of moves (allowed

find a sequence of moves (allowed

under the rules of the 8-puzzle game) that

under the rules of the 8-puzzle game) that

transform this board situation in a desired goal

transform this board situation in a desired goal

situation:

situation:

7

Any path, versus shortest path,

Any path, versus shortest path,

versus best path:

versus best path:

Ex.:

Ex.: Traveling salesperson problem:

Traveling salesperson problem:

Find a sequence of cities ABCDEA such that the

Find a sequence of cities ABCDEA such that the

total distance is MINIMAL.

total distance is MINIMAL.

Boston

Boston

Miami

Miami

NewYork

NewYork

SanFrancisco

SanFrancisco

Dallas

Dallas

3000

3000

250

250

14501450

1200

1200

1700

1700

3300

3300

2900

2900

1500

1500

1600

1600

1700

1700

Best path problem

Best path problem

8

State space representation:

State space representation:

State:

State:

the list of cities that are already visited

the list of cities that are already visited

Ex.:

Ex.: ( NewYork, Boston

( NewYork, Boston )

)

Initial state:

Initial state:

Ex.:

Ex.: ( NewYork )

( NewYork )

Rules:

Rules:

add 1 city to the list that is not yet a member

add 1 city to the list that is not yet a member

add the first city if you already have 5 members

add the first city if you already have 5 members

Goal criterion:

Goal criterion:

first and last city are equal

first and last city are equal

Boston

Boston

Miami

Miami

NewYork

NewYork

SanFrancisco

SanFrancisco

Dallas

Dallas

Depth-first search

Depth-first search

Expand the tree as deep as possible,

Expand the tree as deep as possible,

returning to upper levels when needed.

returning to upper levels when needed.

11

Depth-first search

Depth-first search

= Chronological backtracking

= Chronological backtracking

Select a child

Select a child

convention: left-to-right

convention: left-to-right

Repeatedly go to next

Repeatedly go to next

child, as long as

child, as long as

possible.

possible.

Return to left-over

Return to left-over

alternatives (higher-up)

alternatives (higher-up)

only when needed.

only when needed.

B

B

C

C E

E

D

D

F

F

G

G

S

S

A

A

13

A
A
D
D
B
B
E
E
C
C
F
F
G
G
S
S

QUEUE

QUEUE <-- path only containing the root;

<-- path only containing the root;

WHILE

WHILE QUEUE

QUEUE is not empty

is not empty

AND

AND goal is not reached

goal is not reached

DO

DO remove the first path from the

remove the first path from the QUEUE

QUEUE ;

;

create new paths (to all children);

create new paths (to all children);

reject the new paths with loops;

reject the new paths with loops;

add the new paths to front of

add the new paths to front of QUEUE

QUEUE ;

;

IF

IF goal reached

goal reached

THEN

THEN success;

success;

ELSE

ELSE failure;

failure;

14

Trace of depth-first

Trace of depth-first

for running example:

for running example:

(S)

(S) S removed, (SA,SD) computed and added

S removed, (SA,SD) computed and added

(SA, SD)

(SA, SD) SA removed, (SAB,SAD,SAS) computed,

SA removed, (SAB,SAD,SAS) computed,

(SAB,SAD) added

(SAB,SAD) added

(SAB,SAD,SD)

(SAB,SAD,SD) SAB removed, (SABA,SABC,SABE)

SAB removed, (SABA,SABC,SABE)

computed,

computed, (SABC,SABE) added

(SABC,SABE) added

(SABC,SABE,SAD,SD)

(SABC,SABE,SAD,SD) SABC removed, (SABCB) computed,

SABC removed, (SABCB) computed,

nothing added

nothing added

(SABE,SAD,SD)

(SABE,SAD,SD) SABE removed, (SABEB,SABED,SABEF)

SABE removed, (SABEB,SABED,SABEF)

computed, (SABED,SABEF)added

computed, (SABED,SABEF)added

(SABED,SABEF,SAD,SD)

(SABED,SABEF,SAD,SD) SABED removed,

SABED removed,

(SABEDS,SABEDA.SABEDE) computed,

(SABEDS,SABEDA.SABEDE) computed,

nothing added

nothing added

(

( SABEF,SAD,SD)

SABEF,SAD,SD) SABEF removed, (SABEFE,SABEFG)

SABEF removed, (SABEFE,SABEFG)

computed, (SABEFG) added

computed, (SABEFG) added

(SABEFG,SAD,SD)

(SABEFG,SAD,SD) goal is reached: reports success

goal is reached: reports success

16

Note: approximations !!

Note: approximations !!

In our complexity analysis, we do not take the

In our complexity analysis, we do not take the

built-in

built-in

loop-detection

loop-detection

into account.

into account.

The results only ‘formally’ apply to the variants

The results only ‘formally’ apply to the variants

of our algorithms

of our algorithms WITHOUT

WITHOUT

loop-checks.

loop-checks.

Studying the effect of the loop-checking on the

Studying the effect of the loop-checking on the

complexity is hard:

complexity is hard:

overhead of the checking MAY or MAY NOT be

overhead of the checking MAY or MAY NOT be

compensated by the reduction of the size of the

compensated by the reduction of the size of the

tree.

tree.

Also

Also : our analysis

: our analysis DOES NOT

DOES NOT

take the length

take the length

(space) of representing paths into account !!

(space) of representing paths into account !!

17

Completeness

Completeness

(depth-first)

(depth-first)

Complete for FINITE (implicit) NETS.

Complete for FINITE (implicit) NETS.

(= NETS with finitely many nodes)

(= NETS with finitely many nodes)

IMPORTANT:
IMPORTANT:

This is due to integration of LOOP-checking in

This is due to integration of LOOP-checking in

this version of Depth-First (and in all other

this version of Depth-First (and in all other

algorithms that will follow)!

algorithms that will follow)!

IF we do not remove paths with loops, then

IF we do not remove paths with loops, then

Depth-First is not complete (may get trapped

Depth-First is not complete (may get trapped

in loops of a finite NET)

in loops of a finite NET)

Note:

Note:

does NOT find the shortest path.

does NOT find the shortest path.

19

Speed

Speed

(depth-first)

(depth-first)

In the worst case:

In the worst case:

the (only) goal node may be on the right-most

the (only) goal node may be on the right-most

branch,

branch,

G

G

d

d

b

b

Time complexity == b

Time complexity == b

d

d

b

b

d-

d-

b

b

d+

d+

Thus: O(b

Thus: O(b

d

d

b - 1

b - 1

20

Memory

Memory

(depth-first)

(depth-first)

Largest number of nodes in QUEUE is reached

Largest number of nodes in QUEUE is reached

in bottom left-most node.

in bottom left-most node.

Example: d = 3, b = 3 :

Example: d = 3, b = 3 :

...

...

QUEUE contains all nodes. Thus: 7.

QUEUE contains all nodes. Thus: 7.

In General: ((b-1) * d) + 1

In General: ((b-1) * d) + 1

Order: O(d*b)

Order: O(d*b)