thisfriday - wuwei lan · 2020. 8. 4. · video of demo pacman (tiny maze) – ucs / a*. creating...
Post on 11-Sep-2020
2 Views
Preview:
TRANSCRIPT
Announcements
§ This Friday
§ Project 1 due
§ Talk by Jeniya Tabassum
TweeTIME: A Minimally Supervised Method for Recognizing and Normalizing Time Expressions in Twitter
Recap:Search
§ Searchproblem:§ States(configurationsoftheworld)§ Actionsandcosts§ Successorfunction(worlddynamics)§ Startstateandgoaltest
§ Searchtree:§ Nodes:representplansforreachingstates§ Planshavecosts(sumofactioncosts)
§ Searchalgorithm:§ Systematicallybuildsasearchtree§ Choosesanorderingofthefringe(unexplorednodes)§ Optimal:findsleast-costplans
UniformCostSearch
§ Strategy:expandlowestpathcost
§ Thegood:UCSiscompleteandoptimal!
§ Thebad:§ Exploresoptionsinevery“direction”§ Noinformationaboutgoallocation
Start Goal
…
c £ 3
c £ 2c £ 1
[Demo:contoursUCSempty(L3D1)][Demo:contoursUCSpacman smallmaze(L3D3)]
VideoofDemoContoursUCSPacman SmallMaze
InformedSearch
SearchHeuristics§ Aheuristicis:
§ Afunctionthatestimates howcloseastateistoagoal§ Designedforaparticularsearchproblem§ Examples:Manhattandistance,Euclideandistancefor
pathing
10
511.2
Example:HeuristicFunction
h(x)
Example:HeuristicFunctionHeuristic:thenumberofthelargestpancakethatisstilloutofplace
43
0
2
3
3
3
4
4
3
4
4
4
h(x)
GreedySearch
§ Strategy:expandanodethatyouthinkisclosesttoagoalstate§ Heuristic:estimateofdistancetonearestgoalforeachstate
§ Acommoncase:§ Best-firsttakesyoustraighttothe(wrong)goal
§ Worst-case:likeabadly-guidedDFS
…b
…b
[Demo:contoursgreedyempty(L3D1)][Demo:contoursgreedypacman smallmaze(L3D4)]
VideoofDemoContoursGreedy(Empty)
VideoofDemoContoursGreedy(Pacman SmallMaze)
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
AdmissibleHeuristics
§ Aheuristich isadmissible (optimistic)if:
whereisthetruecosttoanearestgoal
§ Examples:
§ Comingupwithadmissibleheuristicsismostofwhat’sinvolvedinusingA*inpractice.
415
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
…
PropertiesofA*
…b
…b
Uniform-Cost A*
UCSvs A*Contours
§ Uniform-costexpandsequallyinall“directions”
§ A*expandsmainlytowardthegoal,butdoeshedgeitsbetstoensureoptimality
Start Goal
Start Goal
[Demo:contoursUCS/greedy/A*empty(L3D1)][Demo:contoursA*pacman smallmaze(L3D5)]
VideoofDemoContours(Empty)-- UCS
VideoofDemoContours(Empty)-- Greedy
VideoofDemoContours(Empty)– A*
VideoofDemoContours(Pacman SmallMaze)– A*
Comparison
Greedy UniformCost A*
A*Applications
§ Videogames§ Pathing /routingproblems§ Resourceplanningproblems§ Robotmotionplanning§ Languageanalysis§ Machinetranslation§ Speechrecognition§ …
[Demo:UCS/A*pacman tinymaze(L3D6,L3D7)][Demo:guessalgorithmEmptyShallow/Deep(L3D8)]
VideoofDemoPacman (TinyMaze)– UCS/A*
CreatingHeuristics
CreatingAdmissibleHeuristics
§ Mostoftheworkinsolvinghardsearchproblemsoptimallyisincomingupwithadmissibleheuristics
§ Often,admissibleheuristicsaresolutionstorelaxedproblems,wherenewactionsareavailable
§ Inadmissibleheuristicsareoftenusefultoo
15366
Example:8Puzzle
§ Whatarethestates?§ Howmanystates?§ Whataretheactions?§ Howmanysuccessorsfromthestartstate?§ Whatshouldthecostsbe?
StartState GoalStateActions
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
8PuzzleII
§ Whatifwehadaneasier8-puzzlewhereanytilecouldslideanydirectionatanytime,ignoringothertiles?
§ TotalManhattandistance
§ Whyisitadmissible?
§ h(start)= 3+1+2+…=18Averagenodesexpandedwhentheoptimalpathhas……4steps …8steps …12steps
TILES 13 39 227MANHATTAN 12 25 73
StartState GoalState
8PuzzleIII
§ Howaboutusingtheactualcost asaheuristic?§ Woulditbeadmissible?§ Wouldwesaveonnodesexpanded?§ What’swrongwithit?
§ WithA*:atrade-offbetweenqualityofestimateandworkpernode§ Asheuristicsgetclosertothetruecost,youwillexpandfewernodesbutusuallydomoreworkpernodetocomputetheheuristicitself
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
OptimalityofA*GraphSearch
§ Sketch:considerwhatA*doeswithaconsistentheuristic:
§ Fact1:Intreesearch,A*expandsnodesinincreasingtotalfvalue(f-contours)
§ Fact2:Foreverystates,nodesthatreachsoptimallyareexpandedbeforenodesthatreachssuboptimally
§ Result:A*graphsearchisoptimal
…
f£ 3
f£ 2
f£ 1
Optimality
§ Treesearch:§ A*isoptimalifheuristicisadmissible§ UCSisaspecialcase(h=0)
§ Graphsearch:§ A*optimalifheuristicisconsistent§ UCSoptimal(h=0isconsistent)
§ Consistencyimpliesadmissibility
§ Ingeneral,mostnaturaladmissibleheuristicstendtobeconsistent,especiallyiffromrelaxedproblems
top related