21
More advanced aspects More advanced aspects of search of search Extensions of A* Extensions of A*

More advanced aspects of search Extensions of A*

Embed Size (px)

Citation preview

Page 1: More advanced aspects of search Extensions of A*

More advanced aspects More advanced aspects of searchof search

Extensions of A*Extensions of A*

Page 2: More advanced aspects of search Extensions of A*

Extensions of A*Extensions of A*

Iterated deepening A*Iterated deepening A*

Simplified Memory-bounded A*Simplified Memory-bounded A*

Page 3: More advanced aspects of search Extensions of A*

Iterative-deepening A*Iterative-deepening A*

Page 4: More advanced aspects of search Extensions of A*

4

Memory problems with A*Memory problems with A*

A* is similar to breadth-first:A* is similar to breadth-first:

Breadth-Breadth-firstfirst

d = 1d = 1

d = 2d = 2

d = 3d = 3

d = 4d = 4

Expand by depth-layersExpand by depth-layers

HereHere: 2 extensions of A* that improve memory : 2 extensions of A* that improve memory usage.usage.

f1f1

f2f2

f3f3

f4f4

A*A*

Expands by f-contoursExpands by f-contours

Page 5: More advanced aspects of search Extensions of A*

5

Depth-firstDepth-firstin each f-in each f-contourcontour

Perform depth-first Perform depth-first search LIMITED to search LIMITED to some f-bound.some f-bound.

IfIf goal found: ok. goal found: ok. ElseElse: increase de f-: increase de f-

bound and restart.bound and restart.

Iterative deepening A*Iterative deepening A*

f4f4

How to establish the f-bounds?How to establish the f-bounds? - - initiallyinitially: : f(f(SS))

generate all successorsgenerate all successorsrecord the record the minimalminimal f(f(succsucc)) >> f(f(SS))

Continue with Continue with minimalminimal f(f(succsucc)) instead of instead of f(f(SS))

f3f3

f2f2

f1f1

Page 6: More advanced aspects of search Extensions of A*

6

Example:Example:

SSf=100f=100

AAf=120f=120

BBf=130f=130

CCf=120f=120

DDf=140f=140

GGf=125f=125

EEf=140f=140

FFf=125f=125

ff-limited, -limited, f-boundf-bound = 100 = 100 f-newf-new = 120 = 120

Page 7: More advanced aspects of search Extensions of A*

7

Example:Example:

SSf=100f=100

AAf=120f=120

BBf=130f=130

CCf=120f=120

DDf=140f=140

GGf=125f=125

EEf=140f=140

FFf=125f=125

ff-limited, -limited, f-boundf-bound = 120 = 120 f-newf-new = 125 = 125

Page 8: More advanced aspects of search Extensions of A*

8

Example:Example:

SSf=100f=100

AAf=120f=120

BBf=130f=130

CCf=120f=120

DDf=140f=140

GGf=125f=125

EEf=140f=140

FFf=125f=125

ff-limited, -limited, f-boundf-bound = 125 = 125

SUCCESSSUCCESS

Page 9: More advanced aspects of search Extensions of A*

9

ff-limited search:-limited search:1. 1. QUEUEQUEUE <-- path only containing the root; <-- path only containing the root; f-boundf-bound <-- <some natural number>; <-- <some natural number>; f-newf-new <-- <--

2. 2. WHILEWHILE QUEUEQUEUE is not empty is not empty ANDAND goal is not reached goal is not reached DODO remove the first path from the remove the first path from the QUEUEQUEUE;; 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 add the new pathpaths with s with f(f(pathpath)) f-boundf-bound to front of to front of QUEUEQUEUE;; f-newf-new <-- minimum of current <-- minimum of current f-newf-new and and

of the minimum of new of the minimum of new ff-values which are-values which are larger than larger than f-boundf-bound

3. 3. IFIF goal reached goal reached THENTHEN success; success; ELSEELSE report report f-newf-new ; ;

Page 10: More advanced aspects of search Extensions of A*

10

Iterative deepening A*:Iterative deepening A*:

1. 1. f-boundf-bound <-- <-- f(f(SS)) 2. 2. WHILEWHILE goal is not reached goal is not reached

DODO perform perform ff-limited search;-limited search; f-boundf-bound <-- <-- f-newf-new

Page 11: More advanced aspects of search Extensions of A*

11

Properties of IDA*Properties of IDA*

Complete and optimal:Complete and optimal: under the same conditions as for A*under the same conditions as for A*

Memory:Memory: Let Let be the minimal cost of an arc:be the minimal cost of an arc:

== O( b* (== O( b* (cost(cost(BB)) / /)) )) Speed:Speed:

depends very strongly on the number of f-depends very strongly on the number of f-contours there are !!contours there are !!

In the worst case: f(In the worst case: f(pp) ) f( f(qq) for every 2 paths:) for every 2 paths: 1 + 2 + ….+ N = O(N1 + 2 + ….+ N = O(N22))

Page 12: More advanced aspects of search Extensions of A*

12

Why is this optimal,Why is this optimal,even without monotonicity ??even without monotonicity ??

SS

AA BB

CC DD FFEE

100100

120120 120120

150150 9090 6060 140140

In absence of Monotonicity:In absence of Monotonicity: we can have search spaces like:we can have search spaces like:

If If ff can decrease, can decrease, how can we be sure that the first goal reached how can we be sure that the first goal reached

is is the optimal one ???the optimal one ???

Page 13: More advanced aspects of search Extensions of A*

13

Properties: practicalProperties: practical IfIf there are only a reduced number of different contours: there are only a reduced number of different contours:

IDA* is one of the very best optimal search IDA* is one of the very best optimal search techniques !techniques ! ExampleExample: the 8-puzzle: the 8-puzzle ButBut: also for MANY other practical problems: also for MANY other practical problems

ElseElse, the gain of the extended f-contour is not , the gain of the extended f-contour is not sufficient to compensate recalculating the previoussufficient to compensate recalculating the previous

In such cases:In such cases:

increase increase f-boundf-bound by a fixed number by a fixed number at each at each iteration:iteration: effectseffects: less re-computations, : less re-computations, BUTBUT: optimality is : optimality is

lost: obtained solution can deviate up to lost: obtained solution can deviate up to

Page 14: More advanced aspects of search Extensions of A*

Simplified Memory-bounded A*Simplified Memory-bounded A*

Page 15: More advanced aspects of search Extensions of A*

15

Simplified Memory-bounded A*Simplified Memory-bounded A*

Fairly complex algorithm.Fairly complex algorithm.

If memory is full and we If memory is full and we need to generate an need to generate an extra node extra node (C)(C):: Remove theRemove the highest f-highest f-

value leafvalue leaf from QUEUEfrom QUEUE (A)(A)..

Remember theRemember the f-value f-value of the best ‘forgotten’ of the best ‘forgotten’ childchild in each parent nodein each parent node (15 in S)(15 in S)..

SS

AA BB

CC

1313

1515 1313

memory of 3 nodes onlymemory of 3 nodes only

Optimizes A* to work within reduced memory.Optimizes A* to work within reduced memory. Key idea:Key idea:

(15)(15)

1818

BB

Page 16: More advanced aspects of search Extensions of A*

16

Generate children 1 by 1Generate children 1 by 1

When expanding a node When expanding a node (S)(S), only add its children , only add its children 1 at a time to QUEUE.1 at a time to QUEUE. we use left-to-rightwe use left-to-right

Avoids Avoids memory overflowmemory overflow and and allows monitoringallows monitoring of of whether we need to whether we need to delete another nodedelete another node

SS

AA BB

1313

First add A, later BFirst add A, later B

AA BB

Page 17: More advanced aspects of search Extensions of A*

17

Too long path: give upToo long path: give up

If extending a node If extending a node would produce a path would produce a path longer than memory: longer than memory: give up on this path (C)give up on this path (C)..

Set the Set the f-valuef-value of the of the node node (C)(C) to to (to remember that we (to remember that we

can’t find a path here)can’t find a path here)

SS

BB

CC

1313

1313

memory of 3 nodes onlymemory of 3 nodes only

DD

1818

BB

CC

Page 18: More advanced aspects of search Extensions of A*

18

Adjust f-valuesAdjust f-values

SS

AA BB

1313

1515 2424

If all children M of a node N If all children M of a node N have been explored and for have been explored and for all M: all M: f(f(S...MS...M)) f(f(S...NS...N))

then reset:then reset: f(f(S…NS…N)) = min { = min { f(f(S…MS…M)) | | MM

child of child of NN}}

A path through A path through NN needs to needs to go through 1 of its children !go through 1 of its children !

better estimate for better estimate for f(f(SS))

1515

Page 19: More advanced aspects of search Extensions of A*

19

SMA*: an example:SMA*: an example:

SS

AA BB

CC G1G1 DD G2G2

EE G3G3 G4G4 FF

0+12=120+12=12

8+5=138+5=1310+5=1510+5=15

24+0=2424+0=2416+2=1816+2=1820+0=2020+0=2020+5=2520+5=25

30+5=3530+5=35 30+0=3030+0=30 24+0=2424+0=24 24+5=2924+5=29

1010 88

10101010

88 1616

1010 1010 88 88

SS1212

SS1212

AA1515

SS1212

AA1515

BB1313

SS1313

BB1313

AA1515

AA1515

DD 1818

(15)(15)

13131212

Page 20: More advanced aspects of search Extensions of A*

20

SS1313

BB

DD

1313

(15)(15)13131515

SS

AA BB

CC G1G1 DD G2G2

EE G3G3 G4G4 FF

0+12=120+12=12

8+5=138+5=1310+5=1510+5=15

24+0=2424+0=2416+2=1816+2=1820+0=2020+0=2020+5=2520+5=25

30+5=3530+5=35 30+0=3030+0=3024+0=2424+0=24 24+5=2924+5=29

1010 88

10101010

88 1616

1010 1010 88 88

SS13 (15)13 (15)

BB1313

DD

Example: continuedExample: continued

DD

(()

G2G22424

13132424

SS1515

BB2424(()

(15)(15)

G2G22424

(15)(15)

G2G22424

(()AA

1515

SS1515

AA1515

BB2424

BB2424

(24)(24)

CC 2525

SS15 (24)15 (24)

AA

CC

1515

CC

()

G1G1 2020

151520 20

151520 20

Page 21: More advanced aspects of search Extensions of A*

21

SMA*: properties:SMA*: properties:

CompleteComplete: : If available memory allows to store If available memory allows to store the the shortestshortest path. path.

OptimalOptimal: : If available memory allows to store If available memory allows to store the the bestbest path. path. OtherwiseOtherwise: returns the best path that fits in : returns the best path that fits in

memory.memory. MemoryMemory: : Uses whatever memory available.Uses whatever memory available. SpeedSpeed: : If enough memory to store entire If enough memory to store entire

tree: tree: same as A*same as A*