Example: barber

7 LOGICAL AGENTS - Artificial Intelligence: A Modern Approach

7 LOGICALAGENTSI nwhich wedesignagentsthatcanformrepresentations oftheworld,usea pro-cessof inferenceto derivenew representationsabouttheworld, therepre-sentationofknowledgeandthereaso ningprocessesthatbringknowledgeto life ,it seems, enablesuccessfulbehaviorsthatwouldbevery hardto achieve have seenthatknowledgeofactionoutcomesenables problem-solvingagentstoperformwellincomp lex reflex ,however, ,butdoesnotknowinany usefulsensethatnopiececanbeontwo , ,thisprocesscanbequitefarremovedfromthen eedsofthemoment aswhena mathematicianprovesa theoremoranastronomercalculatestheearth s ,aphysiciandiagnosesa patient thatis,infersa diseasestatethatis notdirectlyobservable priortochoosinga ,andsomeis itsinsidethephysician s head,it ,namely, theinten-tionofthespeaker.

7.1 KNOWLEDGE-BASED AGENTS KNOWLEDGE BASE The central component of a knowledge-based agent is its knowledge base, or KB. Informally, SENTENCE a knowledge base is a set of sentences. (Here “sentence” is used as a technical term. It is related but is not identical to the sentences of English and other natural languages.) Each sen-

Tags:

  Sentences, Logical, Of sentence

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of 7 LOGICAL AGENTS - Artificial Intelligence: A Modern Approach

1 7 LOGICALAGENTSI nwhich wedesignagentsthatcanformrepresentations oftheworld,usea pro-cessof inferenceto derivenew representationsabouttheworld, therepre-sentationofknowledgeandthereaso ningprocessesthatbringknowledgeto life ,it seems, enablesuccessfulbehaviorsthatwouldbevery hardto achieve have seenthatknowledgeofactionoutcomesenables problem-solvingagentstoperformwellincomp lex reflex ,however, ,butdoesnotknowinany usefulsensethatnopiececanbeontwo , ,thisprocesscanbequitefarremovedfromthen eedsofthemoment aswhena mathematicianprovesa theoremoranastronomercalculatestheearth s ,aphysiciandiagnosesa patient thatis,infersa diseasestatethatis notdirectlyobservable priortochoosinga ,andsomeis itsinsidethephysician s head,it ,namely, theinten-tionofthespeaker.

2 Whenwehear, Johnsaw thediamondthroughthewindow andcovetedit, weknow it referstothediamondandnotthewindow wereason,perhapsuncon-sciously, withourknowledgeofrelative , whenwehear, Johnthrewthebrickthroughthewindow andbroke it, weknow it refersto thewindow. difficultywiththiskindofambiguitybecause theirrepresentationofcontingency problemsis theirflexibility. They areabletoacceptnewtasksintheformofexplic itlydescribedgoals,they canachieve competencequicklybybeingtoldorlearningne w knowledgeabouttheenvironment,andthey simplenewenvironment,thewumpusworld,andi llustratestheoperationofa knowledge-basedagentwithoutgoingintoany , ,weexplainthegeneralprinciplesoflogic. alwaysdefinite eachpropositioniseithertrueorfalseinthew orld, representationforknowledge-basedagents, , a largeportionofthereasoningcarriedoutbyhu mansandotheragentsinpartiallyobservablee nvironmentsde-pendsonhandlingknowledgeth atisuncertain.

3 Logiccannotrepresentthisuncertaintywell, soinPartVwecoverprobability, repre-sentations,includingsomebasedoncon tinuousmathematicssuchasmixturesofGaussi ans,neuralnetworks, simplelogiccalledpropositionallogic. Whilemuchlessexpressive thanfirst-orderlogic(Chapter8),propositi onallogicservesto alsoa well-developedtechnologyforreasoninginpr opositionallogic, , , knowledge-basedagentis itsknowledgebase, ,KNOWLEDGEBASEa knowledgebaseis a setofsentences. (Here sentence is usedasa isSENTENCE relatedbut is notidenticalto thesentencesofEnglishandothernaturallang uages.)Eachsen-tenceis expressedin a waytoaddnewsentencestotheknowledgebasean da waytoquerywhatis , respectively. Bothtasksmayinvolveinference thatis, ,INFERENCELOGICALAGENTS whicharethemainsubjectofstudyinthischapt er, inferencemustobey thefundamentalrequirementthatwhenoneASKs a questionoftheknowledgebase,theanswershou ldfollowfromwhathasbeentold(orrather, TELLed)totheknowledgebasepreviously.

4 (percept)returnsanactionstatic:KB, a knowledgebaset, a counter, initially0, indicatingtimeTELL(KB, MAKE-PERCEPT-SENTENCE(percept,t))action ASK(KB, MAKE-ACTION-QUERY(t))TELL(KB, MAKE-ACTION-SENTENCE(action,t))t t+ 1returnactionFigure , wewillbemorepreciseaboutthecrucialword follow. Fornow, take it tomeanthattheinferenceprocessshouldnotju stmake thingsupasit allouragents,it takesa knowledgebase,KB,whichmayinitiallycontai nsomebackgroundknowledge. EachtimetheagentprogramisBACKGROUNDKNOWL EDGE called,it doestwo ,it TELLs theknowledgebasewhatit ,it ASKs theknowledgebasewhatactionit , extensive reasoningmaybedoneaboutthecurrentstateof theworld,abouttheoutcomesofpossibleactio nsequences, , necessarytolettheknowledgebaseknow perceptanda timeandreturnsa timeasinputandreturnsa , however, theknowledge-basedagentis is amenabletoa descriptionat theknowledgelevel, whereweneedspecifyonlywhattheagentknowsa ndwhatitsgoalsare,KNOWLEDGELEVEL inordertofixitsbehavior.

5 Forexample,anautomatedtaximighthave thegoalofdeliveringa passengertoMarinCountyandmightknow thatit is inSanFranciscoandthattheGoldenGateBridge is theonlylinkbetweenthetwo tocrosstheGoldenGateBridgebecauseit knowsthatthatwillachieveitsgoal. Noticethatthisanalysisis independentofhow thetaxiworksat theimplementationlevel. It doesn t matterwhetherIMPLEMENTATIONLEVEL itsgeographicalknowledgeis implementedaslinkedlistsorpixel maps,orwhetherit ,onecanbuilda knowledge-basedagentsimplybyTELL ingit whatit s initialprogram,beforeit startstoreceive percepts,isbuiltbyaddingonebyonethesente ncesthatrepresentthedesigner s iteasytoexpressthisknowledgeintheformofs entencessimplifiestheconstructionproblem enormously.

6 ,theDECLARATIVE proceduralapproachencodesdesiredbehavior sdirectlyasprogramcode;minimizingtherole ofexplicitrepresentationandreasoningcanr esultina , nowunderstandthata successfulagentmustcombinebothdeclarativ e whatit needstoknow, wecanprovidea knowledge-basedagentwithmechanismsthatal lowit ,whicharedis-cussedinChapter18,creategen eralknowledgeabouttheenvironmentoutofa s , representation,reasoning,andlearning , however, wewillcreatea a cave is thewumpus,a ,buttheagenthasonlyonearrow. Someroomscontainbottomlesspitsthatwilltr apanyonewhowandersintotheserooms(exceptf orthewumpus,whichistoobigtofallin).Theon lymitigatingfeatureoflivinginthisenviron mentis thepossibilityoffindinga rathertamebymoderncomputergamestandards, it given,assuggestedinChapter2, bythePEAS description:}Performancemeasure: +1000forpickingupthegold, 1000forfallingintoa pitorbeingeatenbythewumpus, 1foreachactiontakenand 10forusingupthearrow.

7 }Environment: A4 [1,1], , witha uniformdistribution, ,eachsquareotherthanthestartcanbea pit, }Actuators: Theagentcanmove forward,turnleftby90 , orturnrightby90 . Theagentdiesa miserabledeathif it entersa squarecontaininga pitora live wumpus.(Itis safe,albeitsmelly, toentera squarewitha deadwumpus.) thereis a ina straightlineinthedirectiontheagentis continuesuntiliteitherhits(andhencekills )thewumpusorhitsa ,soonlythefirstShootactionhasany effect.}Sensors: Theagenthasfive sensors,eachofwhichgivesa singlebitofinformation: Inthesquarecontainingthewumpusandinthedi rectly(notdiagonally)adjacentsquaresthea gentwillperceive a stench. Inthesquaresdirectlyadjacenttoa pit,theagentwillperceive a breeze. Inthesquarewherethegoldis,theagentwillpe rceive a glitter.

8 Whenanagentwalksintoa wall,it willperceive a bump. Whenthewumpusis killed,it emitsa theagentin theformofa listoffive symbols;forexample,if thereis a stenchanda breeze,butnoglitter, bump,orscream,theagentwillreceivetheperc ept[Stench;Breeze;None;None;None]. itsinitialignoranceoftheconfigurationoft heenvironment; ,it is possiblefortheagenttoretrieve thegoldsafely. Occa-sionally, , becausethegoldis ina s initialknowledgebasecontainstherulesofth eenvironment,aslistedPIT12341234 STARTS tenchStenchBreezeGoldPITPITB reezeBreezeBreezeBreezeBreezeStenchFigur e ;inparticular, it knowsthatit is in[1,1]andthat[1,1]is a willseehow itsknowledgeevolvesasnew perceptsarrive [None;None;None;None;None], (a)showstheagent s list(someof)thesentencesintheknowledgeba seusingletterssuchasB(breezy)andOK(safe, neitherpitnorwumpus) ,ontheotherhand, = Agent = Breeze = Glitter, Gold = Pit = Stench = WumpusOK = Safe squareV = VisitedAOK 1,1 2,1 3,1 4,1 1,2 2,2 3,2 4,2 1,3 2,3 3,3 4,3 1,4 2,4 3,4 4,4 OKOKBP?

9 P?AOKOKOK 1,1 2,1 3,1 4,1 1,2 2,2 3,2 4,2 1,3 2,3 3,3 4,3 1,4 2,4 3,4 4,4V(a)(b)Figure (a)Theinitialsit-uation,afterpercept[Non e;None;None;None;None]. (b)Afteronemove,withpercept[None;Breeze; None;None;None].Fromthefactthattherewasn ostenchorbreezein[1,1],theagentcaninfert hat[1,2]and[2,1] cautiousagentwillmove onlyintoa squarethatit knowsisOK. Letussupposetheagentdecidestomoveforward to[2,1], (b).Theagentdetectsa breezein[2,1],sotheremustbea pitina [1,1],bytherulesofthegame,sotheremustbea pitin[2,2]or[3,1] (b)indicatesa ,thereis ,gobackto[1,1],andthenproceedto[1,2].The newperceptin[1,2]is[Stench;None;None;Non e;None], resultinginthestateofknowledgeshownin (a).Thestenchin [1,2]meansthattheremustbea wumpusnearby.

10 Butthewumpuscannotbein[1,1],bytherulesof thegame,andit cannotbein[2,2](ortheagentwouldhave detecteda stenchwhenit wasin[2,1]).Therefore,theagentcaninferth atthewumpusis in[1,3].ThenotationW! , thelackofaBreezein[1,2]impliesthattherei s nopitin[2,2].Yetwealreadyinferredthatthe remustbea pitineither[2,2]or[3,1],sothismeansit mustbein[3,1].Thisisa fairlydifficultinference,becauseit !AOKOKOK 1,1 2,1 3,1 4,1 1,2 2,2 3,2 4,2 1,3 2,3 3,3 4,3 1,4 2,4 3,4 4,4 VOKW!VP!AOKOKOK 1,1 2,1 3,1 4,1 1,2 2,2 3,2 4,2 1,3 2,3 3,3 4,3 1,4 2,4 3,4 4,4 VSOKW!VVVBSGP?P?(b)(a)SABGPSW = Agent = Breeze = Glitter, Gold = Pit = Stench = WumpusOK = Safe squareV = VisitedFigure laterstagesintheprogressoftheagent.(a)Af terthethirdmove,withpercept[Stench;None; None;None;None].


Related search queries