out line
play

Out line Using knowledge Heurist ics I nf ormed Search Best -f - PDF document

Out line Using knowledge Heurist ics I nf ormed Search Best -f irst search Greedy best -f irst search A* search CS 486/ 686 Ot her variat ions of A* Univer sit y of Wat erloo Back t o heurist ics May 10 1


  1. Out line • Using knowledge – Heurist ics I nf ormed Search • Best -f irst search – Greedy best -f irst search – A* search CS 486/ 686 – Ot her variat ions of A* Univer sit y of Wat erloo • Back t o heurist ics May 10 1 2 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart Recall f rom last lect ure I nf ormed Search • Uninf ormed search met hods expand nodes based on “dist ance” f rom st art node • Our knowledge is of t en on t he merit of nodes – Never look ahead t o t he goal – Value of being at a node – E.g. in unif orm cost search expand t he cheapest • Dif f erent not ions of merit pat h. We never consider t he cost of get t ing t o t he – I f we are concerned about t he cost of t he goal solut ion, we might want a not ion of how expensive – Advant age is t hat we have t his inf ormat ion it is t o get f rom a st at e t o a goal – I f we are concerned wit h minimizing comput at ion, • But , we of t en have some addit ional knowledge we might want a not ion of how easy it is t o get a about t he problem st at e t o a goal – E.g. in t raveling around Romania we know t he dist ances bet ween cit ies so can measure t he – We will f ocus on cost of solut ion overhead of going in t he wrong direct ion 3 4 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart I nf ormed search I nf ormed search • We need t o develop a domain specif ic • I f h(n1)< h(n2) t hen we guess t hat it is heurist ic f unct ion, h(n) cheaper t o reach t he goal f rom n1 t han • h(n) guesses t he cost of reaching t he it is f rom n2 goal f rom node n – The heur ist ic f unct ion must be domain • We require specif ic – h(n)=0 when n is a goal node – We of t en have some inf ormat ion about t he problem t hat can be used in f or ming a – h(n)> = 0 f or all ot her nodes heurist ic f unct ion (i.e. heur ist ics are domain specif ic) 5 6 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart 1

  2. Gr eedy best -f ir st sear ch: Greedy best -f irst search Example Heur ist ic • Use t he heur ist ic f unct ion, h(n), t o rank f unct ion t he nodes in t he f ringe h=4 h=3 h=2 h=1 h=0 • Search st r at egy S A B C G – Expand node wit h lowest h-value 2 1 1 2 P at h cost • Greedily t rying t o f ind t he least -cost 4 solut ion 7 8 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart Example cont … Example cont … h=4 h=3 h=2 h=1 h=0 h=4 h=3 h=2 h=1 h=0 S A B C G S A B C G 2 1 1 2 2 1 1 2 4 4 9 10 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart Example cont … Example cont … h=4 h=3 h=2 h=1 h=0 h=4 h=3 h=2 h=1 h=0 G S A B C S A B C G 2 1 1 2 2 1 1 2 4 4 11 12 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart 2

  3. Example cont … Anot her Example h=0 h=4 h=3 h=4 h=4 h=3 h=2 h=1 h=0 S A B G S A B C G 2 1 2 1 1 2 2 1 1 Found t he goal 4 C But cheaper pat h is S, A, B, C, G Pat h is S, A, C, G Wit h cost 2+1+1+2=6 h=1 Cost of t he pat h is 2+4+2=8 Greedy best-first is not optimal 13 14 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart Anot her Example Propert ies of greedy search • Not opt imal! • Not complet e! h=0 – I f we check f or repeat ed st at es t hen we are ok h=4 h=3 h=4 • Exponent ial space in worst case since need t o S A B G keep all nodes in memory 2 1 2 • Exponent ial worst case t ime O(b m ) where m is 1 1 t he maximum dept h of t he t ree C – I f we choose a good heurist ic t hen we can do much h=1 bet t er Greedy best -f irst can get st uck in loops Not complet e 15 16 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart A* Search A* Example • Greedy best -f ir st search is t oo greedy – I t does not t ake int o account t he cost of h=4 h=3 h=2 h=1 h=0 t he pat h so f ar! S A B C G • Def ine 2 1 1 2 – f (n)=g(n)+h(n) – g(n) is t he cost of t he pat h t o node n 4 – h(n) is t he heurist ic est imat e of t he cost of 1. Expand S reaching t he goal f rom node n 2. Expand A • A* search 3. Choose bet ween B (f (B)=3+2=5) and C (f (C)=6+1=7) ) expand B – Expand node in f r inge (queue) wit h lowest f 4. Expand C value 5. Expand G – recognize it is t he goal 17 18 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart 3

  4. When should A* t erminat e? When should A* t erminat e? • As soon as we f ind a goal st at e? • As soon as we f ind a goal st at e? 1 1 1 1 S S B B h=3 h=3 A A h=7 h=7 1 1 C C 7 h=2 7 h=2 1 1 G G D D h=1 h=1 7 7 A* Terminat es only when goal st at e is popped f rom t he queue 19 20 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart A* and revisit ing st at es A* and revisit ing st at es What if we revisit a st at e t hat was already expanded? What if we revisit a st at e t hat was already expanded? S S 1 1 1 1 h=7 h=7 A A B h=3 B h=3 2 2 1 1 h=2 h=2 C C G 7 G 7 I f we allow st at es t o be expanded again, we might get a bet t er solut ion! 21 22 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart I s A* Opt imal? Admissible heurist ics • Let h*(n) denot e t he t rue minimal cost h=6 t o t he goal f rom node n A 1 1 • A heurist ic, h, is admissible if S – h(n) ≤ h*(n) f or all n G 3 • Admissible heurist ics never overest imat e t he cost t o t he goal – Opt imist ic No. This example shows why not . 23 24 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart 4

  5. Opt imalit y of A* Opt imalit y of A* • I f t he heurist ic is admissible t hen A* wit h t ree-search is opt imal • For searching graphs we require Let G be an opt imal goal st at e, and f (G) = f * = g(G). somet hing st ronger t han admissibilit y Let G 2 be a subopt imal goal st at e, i.e. f (G 2 ) = g(G 2 ) > f *. Assume f or cont radict ion t hat A* has select ed G 2 f rom t he queue. – Consist ency (monot onicit y): (This would t erminat e A* wit h a subopt imal solut ion) • h(n) ≤ cost (n,n’)+h(n’) Let n be a node t hat is current ly a leaf node on an opt imal pat h t o G. – Almost any admissible heurist ic f unct ion will also be consist ent • A* graph-search wit h a consist ent heurist ic is opt imal Because h is admissible, f * ≥ f (n). 2 , we must have f (n) ≥ f (G I f n is not chosen f or expansion over G 2 ) So, f * ≥ f (G 2 )=0, we have f * ≥ g(G 2 ). Because h(G 2 ), cont radict ion. 25 26 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart Memor y-bounded heur ist ic search Propert ies of A* • A* keeps most generat ed nodes in memory – On many problems A* will run out of memory • Complet e if t he heurist ic is consist ent • I t erat ive deepening A* (I DA*) – Along any pat h, f always increases ) if a – Like I DS but change f -cost rat her t han dept h at solut ion exist s somewhere t he f value will each it erat ion event ually get t o it s cost • SMA* (Simplif ied Memory-Bounded A*) • Exponent ial t ime complexit y in wor st case – Uses all available memory – A good heurist ic will help a lot here – Proceeds like A* but when it runs out of memory it drops t he worst leaf node (one wit h highest f - – O(bm) if t he heurist ic is per f ect value) • Exponent ial space complexit y – I f all leaf nodes have t he same f -value t hen it drops oldest and expands t he newest – Opt imal and complet e if dept h of shallowest goal node is less t han memory size 27 28 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart Heurist ic Funct ions 8-puzzle • A good heurist ic f unct ion can make all 7 2 4 1 2 t he dif f er ence! 5 6 3 4 5 • How do we get heurist ics? 8 3 1 6 7 8 – One appr oach is t o t hink of an easier Start State Goal State problem and let h(n) be t he cost of • Relax t he game reaching t he goal in t he easier problem 1. Can move t ile f rom posit ion A t o posit ion B if A is next t o B (ignore whet her or not posit ion is blank) 2. Can move t ile f rom posit ion A t o posit ion B if B is blank (ignore adj acency) 3. Can move t ile f rom posit ion A t o posit ion B 29 30 cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart 5

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend