32
Announcements § This Friday § Project 1 due § Talk by Jeniya Tabassum TweeTIME: A Minimally Supervised Method for Recognizing and Normalizing Time Expressions in Twitter

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

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Optimality

§ Treesearch:§ A*isoptimalifheuristicisadmissible§ UCSisaspecialcase(h=0)

§ Graphsearch:§ A*optimalifheuristicisconsistent§ UCSoptimal(h=0isconsistent)

§ Consistencyimpliesadmissibility

§ Ingeneral,mostnaturaladmissibleheuristicstendtobeconsistent,especiallyiffromrelaxedproblems