+ All Categories
Home > Documents > Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses...

Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses...

Date post: 18-Oct-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
19
Ar#ficial Intelligence Dr. Qaiser Abbas Department of Computer Science & IT, University of Sargodha, Sargodha, 40100, Pakistan [email protected] Saturday, 23 April 16 1
Transcript
Page 1: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

Ar#ficialIntelligence

Dr.QaiserAbbasDepartmentofComputerScience&IT,

UniversityofSargodha,Sargodha,40100,[email protected]

Saturday,23April16 1

Page 2: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5INFORMED(HEURISTIC)SEARCHSTRATEGIES

•  Informedsearchstrategy—onethatusesproblem-specificknowledgebeyondthedefiniOonoftheproblemitself—canfindsoluOonsmoreefficientlythancananuninformedstrategy.

•  Mostbest-firstalgorithmsincludeaheuris#cfunc#on,denotedh(n),whereh(n)=esOmatedcostofthecheapestpathfromthestateatnodentoagoalstate.

•  h(n)takesanodeasinputanditdependsonlyonthestateatthatnode.Forexample,inRomania,onemightesOmatethecostofthecheapestpathfromAradtoBucharestviathestraight-linedistancefuncOonfromAradtoBucharest.

•  HeurisOcfuncOonsarethemostcommonforminwhichaddiOonalknowledgeoftheproblemisimpartedtothesearchalgorithm.

•  ThissecOoncoverstwowaystouseheurisOcinformaOontoguidesearch.

Saturday,23April16 2

Page 3: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.1Greedybest-firstsearch•  Greedybest-firstsearchtriestoexpandthenodethatisclosesttothegoal.•  Letusseehowthisworksforroute-findingproblemsinRomania.•  weusethestraight-linedistanceheurisOc,whichwewillcallh.Ifthegoalis

Bucharest,weneedtoknowthestraight-linedistancestoBucharest,whichareshowninFigure3.2and3.22.

Saturday,23April16 3

Page 4: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.1Greedybest-firstsearch•  Figure3.23showstheprogressofagreedybest-firstsearchusinghSLDtofinda

pathfromAradtoBucharest.ThefirstnodetobeexpandedfromAradwillbeSibiubecauseitisclosertoBucharestthaneitherZerindorTimisoara.ThenextnodetobeexpandedwillbeFagarasbecauseitisclosest.FagarasinturngeneratesBucharest,whichisthegoal.

•  ItisnotopOmal,however:thepathviaSibiuandFagarastoBucharestis32kilometerslongerthanthepaththroughRimnicuVilceaandPitesO.Thisshowswhythealgorithmiscalled“greedy”—ateachstepittriestogetasclosetothegoalasitcan.

Saturday,23April16 4

Page 5: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.1Greedybest-firstsearch

Saturday,23April16 5

Page 6: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.1Greedybest-firstsearch•  Greedybest-firsttreesearchisalsoincompleteeveninafinitestatespace,much

likedepth-firstsearch.•  ConsidertheproblemofgebngfromIasitoFagaras.TheheurisOcsuggeststhat

NeamtbeexpandedfirstbecauseitisclosesttoFagaras,butitisadeadend.•  ThesoluOonistogofirsttoVaslui—astepthatisactuallyfartherfromthegoal

accordingtotheheurisOc—andthentoconOnuetoUrziceni,Bucharest,andFagaras.

•  ThealgorithmwillneverfindthissoluOon,however,becauseexpandingNeamtputsIasibackintothefronOer,IasiisclosertoFagarasthanVasluiis,andsoIasiwillbeexpandedagain,leadingtoaninfiniteloop.(Thegraphsearchversioniscompleteinfinitespaces,butnotininfiniteones.)

•  Theworst-caseOmeandspacecomplexityforthetreeversionisO(bm),wheremisthemaximumdepthofthesearchspace.

•  WithagoodheurisOcfuncOon,however,thecomplexitycanbereducedsubstanOally.TheamountofthereducOondependsontheparOcularproblemandonthequalityoftheheurisOc.

Saturday,23April16 6

Page 7: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.2A*search:Minimizingthetotales#matedsolu#oncost3.5.2A*search:Minimizingthetotal

•  Themostwidelyknownformofbest-firstsearchiscalledA∗search(pronounced“A-starsearch”).

•  Itevaluatesnodesbycombiningg(n)andh(n)asf(n)=g(n)+h(n),where•  Themostwidelyknownformofbest-firstsearchiscalledA∗search(pronounced“A-starsearch”).•  Itevaluatesnodesbycombiningg(n)andh(n)asf(n)=g(n)+h(n),where

g(n)givesthepathcostfromthestartnodetonoden,andh(n)istheesOmatedcostofthecheapestpathfromntothegoal,so,wehavef(n)=

esOmatedcostifthecheapestsoluOonthroughn.•  Condi#onsforop#mality:Admissibilityandconsistency–  ThefirstcondiOonwerequireforopOmalityisthath(n)beanadmissibleheuris#c

•  ThealgorithmisidenOcaltoUNIFORM-COST-SEARCHexceptthatA∗usesg+hinsteadofg.•  Condi#onsforop#mality:Admissibilityandconsistency–  ThefirstcondiOonwerequireforopOmalityisthath(n)beanadmissibleheuris#c(acceptable).

Saturday,23April16 7

Page 8: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.2A*search:Minimizingthetotales#matedsolu#oncostes#matedsolu#oncost

straight-linedistancestraight-linedistancehSLDhSLDthatweusedingebngto

Bucharest.Straight-linedistanceisadmissiblebecausetheshortestpathbetweenanytwopointsisastraightline,sothestraightlinecannotbeanoveresOmate.InFigure3.24givenonnextslide,weshowtheprogressofanA∗treesearchforBucharest.ThevaluesofgarecomputedfromthestepcostsinFigure3.2,andthevaluesofhSLD

aregiveninFigure3.22.Havealookovertitfirst!

–  Asecond,slightlystrongercondiOoncalledconsistency(orsomeOmesmonotonicity)isrequiredonlyforapplicaOons

Page 9: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

Saturday,23April16 9Figure3.24

Page 10: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.2A*search:Minimizingthetotales#matedsolu#oncost

–  AheurisOch(n)isconsistentif,foreverynodenandeverysuccessornʹofngeneratedbyanyacOona,theesOmatedcostofreachingthegoalfromnisnogreaterthanthestepcostofgebngtonʹplustheesOmatedcostofreachingthegoalfromnʹ:h(n)≤c(n,a,nʹ)+h(nʹ).

–  Thisisaformofthegeneraltriangleinequality,whichsOpulatesthateachsideofatrianglecannotbelongerthanthesumoftheothertwosides.Consider,forexample,hSLD.WeknowthatthegeneraltriangleinequalityissaOsfiedwheneachsideismeasuredbythestraight-linedistanceandthatthestraight-linedistancebetweennandnʹisnogreaterthanc(n,a,nʹ).Hence,hSLDisaconsistentheurisOc.

Saturday,23April16 10

Page 11: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.2A*search:Minimizingthetotales#matedsolu#oncost

•  Op#malityofA*–  A∗hasthefollowingproperOes:(1)thetree-searchversionofA∗isop1malifh(n)isadmissible,(2)whilethegraph-searchversionisop1malifh(n)isconsistent.

–  Weshowthesecondofthesetwoclaimssinceitismoreuseful.TheargumentessenOallymirrorstheargumentfortheopOmalityofuniform-costsearch.

–  Thefirststepistoestablishthefollowing:ifh(n)isconsistent,thenthevaluesoff(n)alonganypatharenondecreasing.

–  TheprooffollowsdirectlyfromthedefiniOonofconsistency.Supposenʹisasuccessorofn;theng(nʹ)=g(n)+c(n,a,nʹ)forsomeacOona,andwehavef(nʹ)=g(nʹ)+h(nʹ)=g(n)+c(n,a,nʹ)+h(nʹ)≥g(n)+h(n)=f(n).

Saturday,23April16 11

Page 12: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.2A*search:Minimizingthetotales#matedsolu#oncost

–  SecondStep:A∗selectsanodenforexpansion,theop1malpathtothatnodehasbeenfound.Werethisnotthecase,therewouldhavetobeanotherfronOernodenʹontheopOmalpathfromthestartnodeton,becausefisnondecreasingalonganypath,nʹwouldhavelowerf-costthannandwouldhavebeenselectedfirst.

–  FromthetwoprecedingobservaOons,itfollowsthatthesequenceofnodesexpandedbyA∗usingGRAPH-SEARCHisinnondecreasingorderoff(n).Hence,thefirstgoalnodeselectedforexpansionmustbeanopOmalsoluOonbecausefisthetruecostforgoalnodes(whichhaveh=0)andalllatergoalnodeswillbeatleastasexpensive.

Saturday,23April16 12

Page 13: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.2A*search:Minimizingthetotales#matedsolu#oncost

–  Hence,completenessrequiresthattherewouldbeonlyfinitelymanynodeswithcostlessthanorequaltoC∗,acondiOonthatistrueifallstepcostsexceedsomefiniteεandifbisfinite.

–  A∗expandsnonodeswithf(n)>C∗—forexample,TimisoaraisnotexpandedinFigure3.24eventhoughitisachildoftheroot.WesaythatthesubtreebelowTimisoaraispruned;

–  BecausehSLDisadmissible,thealgorithmcansafelyignorethissubtreewhilesOllguaranteeingopOmality.Theconceptofpruning—eliminaOngpossibiliOesfromconsideraOonwithouthavingtoexaminethem—isimportantformanyareasofAI.

Saturday,23April16 13

Page 14: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.2A*search:Minimizingthetotales#matedsolu#oncost

–  AmongopOmalalgorithmsofthistype—algorithmsthatextendsearchpathsfromtherootandusethesameheurisOcinformaOon—A∗isop#mallyefficientforsuchgivenconsistentheurisOc.

–  Unfortunately,itdoesnotmeanthatA∗istheanswertoalloursearchingneeds.

•  ComplexityofA*dependsontheheurisOc.–  Intheworstcaseofanunboundedsearchspace,thenumberofnodesexpandedisexponenOalinthelengthofthesoluOond:O(bd),wherebisthebranchingfactor.Thisassumesthatagoalstateexistsatall,andisreachablefromthestartstate;ifitisnot,andthestatespaceisinfinite,thealgorithmwillnotterminate.

Saturday,23April16 14

Page 15: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.2A*search:Minimizingthetotales#matedsolu#oncost

–  TheexponenOalcomplexityofA∗withrespecttodepthofgoalosenmakesitimpracOcalinfindinganopOmalsoluOon.

–  ComputaOonOmeisnotthemaindrawbackofA∗.AsA*keepsallgeneratednodesinmemory(asdoallGRAPH-SEARCHalgorithms),andusuallyrunsoutofspacelongbeforeitrunsoutofOme.Forthisreason,A∗isnotpracOcalformanylarge-scaleproblems.

Saturday,23April16 15

Page 16: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.3Memory-boundedheuris#csearch

•  (ReaditYourself)

Saturday,23April16 16

Page 17: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.5.4LearningtosearchbeUer•  (Readityourself)

Saturday,23April16 17

Page 18: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

3.6HEURISTICFUNCTIONS

•  Readityourself.

Saturday,23April16 18

Page 19: Ar#ficial Intelligence · STRATEGIES • Informed search strategy—one that uses problem-specific knowledge beyond the definiOon of the problem itself—can find soluOons more

AssignmentNo.4

•  ExercisesNo’s:3.9,3.13,3.17,3.19,3.22,3.29

Saturday,23April16 19


Recommended