Example: stock market

7 LOGICAL AGENTS

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. Whenwehear, Johnsaw thediamondthroughthewindow andcovetedit, weknow it referstothediamondandnotthewindow wereason,perhapsuncon-sciously, withourknowledgeofrelative , whenwehear, Johnthrewthebrickthroughthewindow andbroke it, weknow it refersto thewindow.

The agent in Figure 7.1 appears quite similar to the agents with internal state described in Chapter 2. Because of the definitions of TELL and ASK, however, the knowledge-based agent is not an arbitrary program for calculating actions. It is amenable to a description at the

Tags:

  States, Chapter, Logical, 7 logical

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

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. Whenwehear, Johnsaw thediamondthroughthewindow andcovetedit, weknow it referstothediamondandnotthewindow wereason,perhapsuncon-sciously, withourknowledgeofrelative , whenwehear, Johnthrewthebrickthroughthewindow andbroke it, weknow it refersto thewindow.

2 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. 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.

3 (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. (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.

4 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. 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.

5 ,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.}Environment: A4 [1,1], , witha uniformdistribution, ,eachsquareotherthanthestartcanbea pit, }Actuators: Theagentcanmove forward,turnleftby90 , orturnrightby90.

6 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. 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.

7 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?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.

8 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. 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.

9 (a)Afterthethirdmove,withpercept[Stench; None;None;None;None]. (b)Afterthefifthmove,withpercept[Stench; Breeze;Glitter;None;None].reliesonthelac kofa percepttomake beyondtheabilitiesofmostanimals,butit is typicalofthekindofreasoningthata neithera pitnora wumpusin[2,2],soit isOKtomove willnotshowtheagent s stateofknowledgeat[2,2];wejustassumethat theagentturnsandmovesto[2,3], (b).In[2,3],theagentdetectsa glitter, soit casewhere theagentdrawsa conclusionfromtheavailableinformation,th atconclusionisguaranteedtobecorrectif , postponethetechnicaldetailsofany adoptthisratherunusualapproachbecausethe ideasoflogicarefarmoregeneralandbeautifu lthanis , , clearenoughinordinaryarithmetic: x+y= 4 is a well-formedsentence,whereas x2y+ = is (andofarithmetic,forthatmatter)is ,somewithlotsofGreeklettersandexoticmath ematicalsymbols, ,however, sentencesinanagent s knowledgebasearerealphysicalconfiguratio nsof(partsof) ,semanticsSEMANTICS hastodowiththe meaning , Forexample,theusualsemanticsadoptedforar ithmeticspecifiesthatthesentencePOSSIBLE WORLD x+y= 4 istrueina worldwherexis2 andyis2,butfalseina worldwherexis1andyis ,everysentencemustbeeithertrueorfalseine achpossibleworld thereis no inbetween.

10 2 Whenweneedtobeprecise,wewillusethetermmo delinplaceof possibleworld. MODEL(We willalsousethephrase mis a modelof tomeanthatsentence is trueinmodelm.) Whereaspossibleworldsmightbethoughtofas( potentially)realenvironmentsthattheagent mightormightnotbein,modelsaremathematica labstractions, , wemaythinkofxandyasthenumberofmenandwome nsittingata tableplayingbridge,forexample,andthesent encex+y= 4is truewhentherearefourintotal;formally, thepossiblemodelsarejustallpossibleassig nmentsofnumberstothevariablesxandy. Eachsuchassignmentfixesthetruthofany a notionoftruth, theideathata ,wewriteas j= tomeanthatthesentence entailsthesentence . Theformaldefinitionofentailmentisthis: j= if andonlyif,ineverymodelinwhich is true, is thatif is true,then , thetruthof is contained inthetruthof . Therelationofentailmentis familiarfromarithmetic;wearehappy withtheideathatthesentencex+y= 4entailsthesentence4 =x+y. Obviously, inany modelwherex+y= 4 suchasthemodelinwhichxis 2 andyis 2 itis thecasethat4 =x+ willseeshortlythata knowledgebasecanbeconsidereda statement,andweoftentalkofa knowledgebaseentailinga (b):theagenthasdetectednothingin[1,1]and a breezein[2,1].


Related search queries