ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating...
Transcript of ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating...
![Page 1: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/1.jpg)
Announcements
§ This Friday
§ Project 1 due
§ Talk by Jeniya Tabassum
TweeTIME: A Minimally Supervised Method for Recognizing and Normalizing Time Expressions in Twitter
![Page 2: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/2.jpg)
Recap:Search
§ Searchproblem:§ States(configurationsoftheworld)§ Actionsandcosts§ Successorfunction(worlddynamics)§ Startstateandgoaltest
§ Searchtree:§ Nodes:representplansforreachingstates§ Planshavecosts(sumofactioncosts)
§ Searchalgorithm:§ Systematicallybuildsasearchtree§ Choosesanorderingofthefringe(unexplorednodes)§ Optimal:findsleast-costplans
![Page 3: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/3.jpg)
UniformCostSearch
§ Strategy:expandlowestpathcost
§ Thegood:UCSiscompleteandoptimal!
§ Thebad:§ Exploresoptionsinevery“direction”§ Noinformationaboutgoallocation
Start Goal
…
c £ 3
c £ 2c £ 1
[Demo:contoursUCSempty(L3D1)][Demo:contoursUCSpacman smallmaze(L3D3)]
![Page 4: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/4.jpg)
VideoofDemoContoursUCSPacman SmallMaze
![Page 5: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/5.jpg)
InformedSearch
![Page 6: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/6.jpg)
SearchHeuristics§ Aheuristicis:
§ Afunctionthatestimates howcloseastateistoagoal§ Designedforaparticularsearchproblem§ Examples:Manhattandistance,Euclideandistancefor
pathing
10
511.2
![Page 7: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/7.jpg)
Example:HeuristicFunction
h(x)
![Page 8: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/8.jpg)
Example:HeuristicFunctionHeuristic:thenumberofthelargestpancakethatisstilloutofplace
43
0
2
3
3
3
4
4
3
4
4
4
h(x)
![Page 9: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/9.jpg)
GreedySearch
§ Strategy:expandanodethatyouthinkisclosesttoagoalstate§ Heuristic:estimateofdistancetonearestgoalforeachstate
§ Acommoncase:§ Best-firsttakesyoustraighttothe(wrong)goal
§ Worst-case:likeabadly-guidedDFS
…b
…b
[Demo:contoursgreedyempty(L3D1)][Demo:contoursgreedypacman smallmaze(L3D4)]
![Page 10: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/10.jpg)
VideoofDemoContoursGreedy(Empty)
![Page 11: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/11.jpg)
VideoofDemoContoursGreedy(Pacman SmallMaze)
![Page 12: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/12.jpg)
A*: CombiningUCSandGreedy
§ Uniform-cost ordersbypathcost,orbackwardcostg(n)§ Greedy ordersbygoalproximity,orforwardcosth(n)
§ A*Search ordersbythesum:f(n)=g(n)+h(n)
S a d
b
Gh=5
h=6
h=2
1
8
11
2
h=6 h=0
c
h=7
3
e h=11
Example:Teg Grenager
S
a
b
c
ed
dG
G
g=0h=6
g=1h=5
g=2h=6
g=3h=7
g=4h=2
g=6h=0
g=9h=1
g=10h=2
g=12h=0
![Page 13: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/13.jpg)
AdmissibleHeuristics
§ Aheuristich isadmissible (optimistic)if:
whereisthetruecosttoanearestgoal
§ Examples:
§ Comingupwithadmissibleheuristicsismostofwhat’sinvolvedinusingA*inpractice.
415
![Page 14: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/14.jpg)
OptimalityofA*TreeSearch:Blocking
Proof:§ ImagineBisonthefringe§ Someancestorn ofAisonthe
fringe,too(maybeA!)§ Claim:n willbeexpandedbeforeB
1. f(n)islessorequaltof(A)2. f(A)islessthanf(B)3. n expandsbeforeB
§ AllancestorsofAexpandbeforeB§ AexpandsbeforeB§ A*searchisoptimal
…
![Page 15: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/15.jpg)
PropertiesofA*
…b
…b
Uniform-Cost A*
![Page 16: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/16.jpg)
UCSvs A*Contours
§ Uniform-costexpandsequallyinall“directions”
§ A*expandsmainlytowardthegoal,butdoeshedgeitsbetstoensureoptimality
Start Goal
Start Goal
[Demo:contoursUCS/greedy/A*empty(L3D1)][Demo:contoursA*pacman smallmaze(L3D5)]
![Page 17: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/17.jpg)
VideoofDemoContours(Empty)-- UCS
![Page 18: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/18.jpg)
VideoofDemoContours(Empty)-- Greedy
![Page 19: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/19.jpg)
VideoofDemoContours(Empty)– A*
![Page 20: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/20.jpg)
VideoofDemoContours(Pacman SmallMaze)– A*
![Page 21: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/21.jpg)
Comparison
Greedy UniformCost A*
![Page 22: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/22.jpg)
A*Applications
§ Videogames§ Pathing /routingproblems§ Resourceplanningproblems§ Robotmotionplanning§ Languageanalysis§ Machinetranslation§ Speechrecognition§ …
[Demo:UCS/A*pacman tinymaze(L3D6,L3D7)][Demo:guessalgorithmEmptyShallow/Deep(L3D8)]
![Page 23: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/23.jpg)
VideoofDemoPacman (TinyMaze)– UCS/A*
![Page 24: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/24.jpg)
CreatingHeuristics
![Page 25: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/25.jpg)
CreatingAdmissibleHeuristics
§ Mostoftheworkinsolvinghardsearchproblemsoptimallyisincomingupwithadmissibleheuristics
§ Often,admissibleheuristicsaresolutionstorelaxedproblems,wherenewactionsareavailable
§ Inadmissibleheuristicsareoftenusefultoo
15366
![Page 26: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/26.jpg)
Example:8Puzzle
§ Whatarethestates?§ Howmanystates?§ Whataretheactions?§ Howmanysuccessorsfromthestartstate?§ Whatshouldthecostsbe?
StartState GoalStateActions
![Page 27: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/27.jpg)
8PuzzleI
§ Heuristic:Numberoftilesmisplaced§ Whyisitadmissible?§ h(start)=§ Thisisarelaxed-problem heuristic
8
Averagenodesexpandedwhentheoptimalpathhas……4steps …8steps …12steps
UCS 112 6,300 3.6x106
TILES 13 39 227
StartState GoalState
StatisticsfromAndrewMoore
![Page 28: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/28.jpg)
8PuzzleII
§ Whatifwehadaneasier8-puzzlewhereanytilecouldslideanydirectionatanytime,ignoringothertiles?
§ TotalManhattandistance
§ Whyisitadmissible?
§ h(start)= 3+1+2+…=18Averagenodesexpandedwhentheoptimalpathhas……4steps …8steps …12steps
TILES 13 39 227MANHATTAN 12 25 73
StartState GoalState
![Page 29: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/29.jpg)
8PuzzleIII
§ Howaboutusingtheactualcost asaheuristic?§ Woulditbeadmissible?§ Wouldwesaveonnodesexpanded?§ What’swrongwithit?
§ WithA*:atrade-offbetweenqualityofestimateandworkpernode§ Asheuristicsgetclosertothetruecost,youwillexpandfewernodesbutusuallydomoreworkpernodetocomputetheheuristicitself
![Page 30: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/30.jpg)
ConsistencyofHeuristics
§ Mainidea:estimatedheuristiccosts≤actualcosts
§ Admissibility:heuristiccost≤actualcosttogoal
h(A)≤ actualcostfromAtoG
§ Consistency:heuristic“arc”cost≤actualcostforeacharc
h(A)– h(C) ≤cost(AtoC)
§ Consequencesofconsistency:
§ Thefvaluealongapathneverdecreases
h(A)≤cost(AtoC)+ h(C)
§ A*graphsearchisoptimal
3
A
C
G
h=4 h=11
h=2
![Page 31: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/31.jpg)
OptimalityofA*GraphSearch
§ Sketch:considerwhatA*doeswithaconsistentheuristic:
§ Fact1:Intreesearch,A*expandsnodesinincreasingtotalfvalue(f-contours)
§ Fact2:Foreverystates,nodesthatreachsoptimallyareexpandedbeforenodesthatreachssuboptimally
§ Result:A*graphsearchisoptimal
…
f£ 3
f£ 2
f£ 1
![Page 32: ThisFriday - Wuwei Lan · 2020. 8. 4. · Video of Demo Pacman (Tiny Maze) – UCS / A*. Creating Heuristics. Creating Admissible Heuristics § Most of the work in solving hard search](https://reader034.fdocuments.net/reader034/viewer/2022051900/5fee662bcc72d3349052e03e/html5/thumbnails/32.jpg)
Optimality
§ Treesearch:§ A*isoptimalifheuristicisadmissible§ UCSisaspecialcase(h=0)
§ Graphsearch:§ A*optimalifheuristicisconsistent§ UCSoptimal(h=0isconsistent)
§ Consistencyimpliesadmissibility
§ Ingeneral,mostnaturaladmissibleheuristicstendtobeconsistent,especiallyiffromrelaxedproblems