search 041005
TRANSCRIPT
-
7/24/2019 Search 041005
1/39
1
Lecture 3
Uninformed Search
http://www.darpa.mil/grandchallenge/
http://www.darpa.mil/grandchallenge/http://www.darpa.mil/grandchallenge/ -
7/24/2019 Search 041005
2/39
2
Complexity Recap app.!"
#We often want to characterize algorithms independent of the implementation.
#This algorithm took 1 hour and 43 seconds on my laptop.Is not very useful, because tomorrow computers are faster.
#Better is: This algorithm takes O(nlog(n)) time to run and O(n) to storbecause this statement is abstracts away from irrelevant deta
Timen! " #fn!! means:Timen! $ constant fn! for n%n& for some n&
'pacen! idem.
n is some variable which characterizes the size of the problem,e.g. number of data(points, number of dimensions, branching(of search tree, etc.
#Worst caseanalysis versus average caseanalyis
-
7/24/2019 Search 041005
3/39
3
Uninformed $earch$trategie$
Uninformed: %hile $earching you ha&e noclue whether one non'goal $tate i$ (etterthan any other. )our $earch i$ (lind.
*ariou$ (lind $trategie$: +readth',r$t $earch
Uniform'co$t $earch
-epth',r$t $earch terati&e deepening $earch
-
7/24/2019 Search 041005
4/39
+readth',r$t $earch
0xpand $hallowe$t unexpanded node
mplementation: fringei$ a ,r$t'in',r$t'out " ueue4
i.e.4 new $ucce$$or$ go at end of theueue.
$ ! a goal $tate5
-
7/24/2019 Search 041005
5/39
6
+readth',r$t $earch
0xpand $hallowe$t unexpanded node
mplementation: fringei$ a ueue4 i.e.4 new
$ucce$$or$ go at end
0xpand:fringe 7 8+4C9
$ + a goal $tate5
-
7/24/2019 Search 041005
6/39
+readth',r$t $earch
0xpand $hallowe$t unexpanded node
mplementation: fringei$ a ueue4 i.e.4 new $ucce$$or$
go at end
0xpand:fringe78C4-409
$ C a goal $tate5
-
7/24/2019 Search 041005
7/39
;
+readth',r$t $earch
0xpand $hallowe$t unexpanded node
mplementation: fringei$ a ueue4 i.e.4 new $ucce$$or$
go at end
0xpand:fringe78-4044
-
7/24/2019 Search 041005
8/39
=
0xample
+S
-
7/24/2019 Search 041005
9/39
>
?ropertie$ of (readth',r$t$earch
Complete5)e$ it alway$ reache$ goal if bi$,nite"
@ime51+b+b2+b3AB AbdA bd+1-b)" 7 (dA1"
thi$ i$ the num(er of node$ we generate" Space5O(bd+1)eep$ e&ery node in memory4
either in fringe or on a path to fringe". ptimal5)e$ if we guarantee that deeper
$olution$ are le$$ optimal4 e.g. $tep'co$t71".
Spacei$ the (igger pro(lem more than time"
-
7/24/2019 Search 041005
10/39
1D
Uniform'co$t $earch
+readth',r$t i$ only optimal if $tep co$t$ i$ increa$ingwith depth e.g. con$tant". Can we guaranteeoptimality for any $tep co$t5
Uniform'co$t Search: 0xpand node with
$malle$t path co$tgn".
-
7/24/2019 Search 041005
11/39
11
Uniform'co$t $earch
mplementation: fringe7 ueue ordered (y path co$t0ui&alent to (readth',r$t if all $tep co$t$ all eual.
Complete5)e$4 if $tep co$t E Fotherwi$e it can get $tuc in in,nite loop$"
@ime5G of node$ withpath cost H co$t of optimal
$olution.
Space5G of node$ on path$ with path co$t H co$t ofoptimal
$olution.
-
7/24/2019 Search 041005
12/39
12
-epth',r$t $earch
0xpand deepestunexpanded node
mplementation: fringe 7 La$t n ir$t ut L?" ueue4 i.e.4 put
$ucce$$or$ at front
$ ! a goal $tate5
-
7/24/2019 Search 041005
13/39
13
-epth',r$t $earch
0xpand deepe$t unexpanded node
mplementation: fringe 7 L ueue4 i.e.4 put $ucce$$or$ at front
ueue78+4C9
$ + a goal $tate5
-
7/24/2019 Search 041005
14/39
1
-epth',r$t $earch
0xpand deepe$t unexpanded node
mplementation: fringe 7 L ueue4 i.e.4 put $ucce$$or$ at front
ueue78-404C9
$ - 7 goal $tate5
-
7/24/2019 Search 041005
15/39
16
-epth',r$t $earch
0xpand deepe$t unexpanded node
mplementation: fringe 7 L ueue4 i.e.4 put $ucce$$or$ at front
ueue78I4404C9
$ I 7 goal $tate5
-
7/24/2019 Search 041005
16/39
1
-epth',r$t $earch
0xpand deepe$t unexpanded node
mplementation: fringe 7 L ueue4 i.e.4 put $ucce$$or$ at front
ueue78404C9
$ 7 goal $tate5
-
7/24/2019 Search 041005
17/39
1;
-epth',r$t $earch
0xpand deepe$t unexpanded node
mplementation: fringe 7 L ueue4 i.e.4 put $ucce$$or$ at front
ueue7804C9
$ 0 7 goal $tate5
-
7/24/2019 Search 041005
18/39
1=
-epth',r$t $earch
0xpand deepe$t unexpanded node
mplementation: fringe 7 L ueue4 i.e.4 put $ucce$$or$ at front
ueue78J4K4C9
$ J 7 goal $tate5
-
7/24/2019 Search 041005
19/39
1>
-epth',r$t $earch
0xpand deepe$t unexpanded node
mplementation: fringe 7 L ueue4 i.e.4 put $ucce$$or$ at front
ueue78K4C9
$ K 7 goal $tate5
-
7/24/2019 Search 041005
20/39
2D
-epth',r$t $earch
0xpand deepe$t unexpanded node
mplementation: fringe 7 L ueue4 i.e.4 put $ucce$$or$ at front
ueue78C9
$ C 7 goal $tate5
-
7/24/2019 Search 041005
21/39
21
-epth',r$t $earch
0xpand deepe$t unexpanded node
mplementation: fringe 7 L ueue4 i.e.4 put $ucce$$or$ at front
ueue784
-
7/24/2019 Search 041005
22/39
22
-epth',r$t $earch
0xpand deepe$t unexpanded node
mplementation: fringe 7 L ueue4 i.e.4 put $ucce$$or$ at front
ueue78L44
-
7/24/2019 Search 041005
23/39
23
-epth',r$t $earch
0xpand deepe$t unexpanded node
mplementation: fringe 7 L ueue4 i.e.4 put $ucce$$or$ at front
ueue784
-
7/24/2019 Search 041005
24/39
2
0xample -S
-
7/24/2019 Search 041005
25/39
26
?ropertie$ of depth',r$t$earch
Complete5Mo: fail$ in in,nite'depth $pace$
Can modify to a&oid repeated $tate$ along path
@ime5O(bm)with m7maximum depth
terri(le if mi$ much larger than d (ut if $olution$ are den$e4 may (e much fa$ter than
(readth',r$t
Space5O(bm), i.e.4 linear $paceN we only need to
remem(er a $ingle path A expanded unexplored node$" ptimal5Mo t may ,nd a non'optimal goal ,r$t"
-
7/24/2019 Search 041005
26/39
2
terati&e deepening $earch
#@o a&oid the in,nite depth pro(lem of -S4 we candecide to only $earch until depth L4 i.e. we donOt expand (eyond de-epth'Limited Search
#%hat of $olution i$ deeper than L5 ncrea$e L iterati&ely. terati&e -eepening Search
#!$ we $hall $ee: thi$ inherit$ the memory ad&antage of -epth'ir$t$earch.
-
7/24/2019 Search 041005
27/39
2;
terati&e deepening $earchL7D
-
7/24/2019 Search 041005
28/39
2=
terati&e deepening $earchL71
-
7/24/2019 Search 041005
29/39
2>
terati&e deepening $earchlL72
-
7/24/2019 Search 041005
30/39
3D
terati&e deepening $earchlL73
-
7/24/2019 Search 041005
31/39
31
terati&e deepening $earch
Mum(er of node$ generated in a depth'limited $earch todepth dwith (ranching factor b:
NDLS b!+ b1+ b2+ " + bd-2+ bd-1+ bd
Mum(er of node$ generated in an iterati&e deepening$earch to depth dwith (ranching factor b:M-S7 dA1"(DA d (1A d'1"(2A B A 3(d'2A2(d'1A 1(d
7
or b 1!4 d #4 M-LS 7 1 A 1D A 1DD A 14DDD A 1D4DDD A 1DD4DDD 7 1114111 M-S7 A 6D A DD A 34DDD A 2D4DDD A 1DD4DDD 7 12346D M+S 7 ............................................................................................ 7 1411141DD
1( ) ( )d dO b O b +
+S
-
7/24/2019 Search 041005
32/39
32
?ropertie$ of iterati&e deepening$earch
Complete5)e$
@ime5 (d+1)b!+ d b1+ (d-1)b2+ " +
bd O(bd) Space5O(bd)
ptimal5)e$4 if $tep co$t 7 1 or
increa$ing function of depth.
-
7/24/2019 Search 041005
33/39
33
0xample -S
-
7/24/2019 Search 041005
34/39
3
+idirectional Search
dea $imultaneou$ly $earch forward from S and (acward$
from N 7 324==D $tate$
S
B
C
S
B C
SC B S
State SpaceExample of a Search Tree
$u(optimal (ut practical
optimal (ut memory inecient
-
7/24/2019 Search 041005
39/39
3>
Summary
?ro(lem formulation u$ually reuire$ a($tractingaway real'world detail$ to de,ne a $tate $pace thatcan fea$i(ly (e explored
*ariety of uninformed $earch $trategie$
terati&e deepening $earch u$e$ only linear $paceand not much more time than other uninformedalgorithm$
http://www.c$.rmit.edu.au/!'Search/?roduct/http://aima.c$.(ereley.edu/demo$.html for more demo$"
http://www.cs.rmit.edu.au/AI-Search/Product/http://aima.cs.berkeley.edu/demos.htmlhttp://aima.cs.berkeley.edu/demos.htmlhttp://www.cs.rmit.edu.au/AI-Search/Product/