Logical Agents. Knowledge bases. Knowledge base = set of sentences in a form a l language Decl a r ati v e approach to building an a gent (or other system): T ELL it what it needs to know Then it can A S K itself what to d o — answers should fo l low from the KB
An Image/Link below is provided (as is) to download presentation
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.Content is provided to you AS IS for your information and personal use only.Download presentation by click this link.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.During download, if you can't get a presentation, the file might be deleted by the publisher.
Knowledge bases • Knowledgebase= setofsentencesina formallanguage • Declarativeapproach to buildingan agent (or other system): TELLitwhat itneedsto know • Then itcan ASKitselfwhat to do—answersshouldfollowfrom theKB • Agents canbeviewedat theknowledgelevel i.e.,what they know,regardless ofhowimplemented • Or at theimplementationlevel i.e., data structures inKBand algorithmsthatmanipulate them
Knowledge-Based Agent • Agent thatuses priororacquired • knowledge to achieve itsgoals • Canmake moreefficientdecisions • Canmake informed decisions • KnowledgeBase (KB): contains a setof representationsof factsabout the Agent’s environment • Each representation iscalleda • sentence • Usesome knowledgerepresentation language,to TELLitwhat to know e.g., (temperature 72F) • ASKagent to querywhatto do • Agent can use inferenceto deducenew facts fromTELLedfacts Domain independentalgorithms ASK Inferenceengine KnowledgeBase TELL Domainspecificcontent
A simple knowledge-based agent • Theagent mustbe able to: • Represent states,actions,etc. • Incorporatenewpercepts • Updateinternalrepresentationsoftheworld • Deducehiddenproperties oftheworld • Deduceappropriate actions
Wumpus World Example • Performance measure • ◦ gold+1000, death-1000 • -1perstep, -10 forusingthe arrow • Environment • Squaresadjacentto wumpusare smelly • Squaresadjacenttopitare breezy • Glitteriff goldisinthe samesquare • Shootingkills wumpusifyou are facing it • Shootingusesup the only arrow • Grabbingpicks upgoldif insame square • Releasingdropsthe goldinsame square • Actuators • Leftturn,Rightturn,Forward, Grab, Release,Shoot • Sensors • Breeze,Glitter,Smell
Wumpus world characterization • Observable?No—only local perception • Deterministic?Yes—outcomes exactly specified • Episodic?No—sequential at the level of actions • Static?Yes—Wumpus and pits do not move • Discrete?Yes • Single-agent?Yes—Wumpus is a feature
Exploring a wumpus world A=Agent B= Breeze S= Smell P= Pit W= Wumpus OK= Safe V = Visited G= Glitter CS561-Lecture09-10-Macskassy-Fall 2010
Exploring a wumpus world A=Agent B= Breeze S= Smell P= Pit W= Wumpus OK= Safe V = Visited G= Glitter CS561-Lecture09-10-Macskassy-Fall 2010 10
Exploring a wumpus world A=Agent B= Breeze S= Smell P= Pit W= Wumpus OK= Safe V = Visited G= Glitter CS561-Lecture09-10-Macskassy-Fall 2010
Exploring a wumpus world A=Agent B= Breeze S= Smell P= Pit W= Wumpus OK= Safe V = Visited G= Glitter CS561-Lecture09-10-Macskassy-Fall 2010
Exploring a wumpus world A=Agent B= Breeze S= Smell P= Pit W= Wumpus OK= Safe V = Visited G= Glitter CS561-Lecture09-10-Macskassy-Fall 2010
Exploring a wumpus world A=Agent B= Breeze S= Smell P= Pit W= Wumpus OK= Safe V = Visited G= Glitter CS561-Lecture09-10-Macskassy-Fall 2010
Exploring a wumpus world A=Agent B= Breeze S= Smell P= Pit W= Wumpus OK= Safe V = Visited G= Glitter CS561-Lecture09-10-Macskassy-Fall 2010
Exploring a wumpus world A=Agent B= Breeze S= Smell P= Pit W= Wumpus OK= Safe V = Visited G= Glitter CS561-Lecture09-10-Macskassy-Fall 2010
Other tight spots Breeze in(1,2) and (2,1) no safeactions Assuming pitsuniformly distributed, (2,2) has pitw/ prob 0.86,vs. 0.31 Smellin(1,1) cannotmove Can use a strategy of coercion: shootstraightahead wumpuswas theredeadsafe wumpuswasn't theresafe CS561-Lecture09-10-Macskassy-Fall 2010
Example Solution S in 1,21,3or2,2has W No S in 2,12,2OK 2,2OK1,3W NoB in 1,2&B in2,13,1P CS561-Lecture09-10-Macskassy-Fall 2010
Another example solution No perception1,2and2,1 OK Moveto2,1 Bin 2,12,2or3,1P? 1,1V no P in1,2 Moveto1,2(only option) CS561-Lecture09-10-Macskassy-Fall 2010
Logic in general • Logicsare formal languagesfor representinginformation suchthat conclusions canbedrawn • Syntaxdefinesthe sentencesinthe language • Semanticsdefinethe“meaning” ofsentences; • i.e., define truthof a sentenceinaworld • E.g., thelanguageof arithmetic • x+ 2≥ yisasentence; x2+y> isnot a sentence • x+2≥yistrue iffthenumberx+2isno lessthan thenumber y • x+2≥yistrue inaworld where x=7; y=1 • x+ 2 ≥ yis falseina worldwherex=0;y=6
Types of logic • Logics arecharacterized by what they commit to as “primitives” • Ontological commitment: what exists—facts?objects?time?beliefs? • Epistemologicalcommitment: whatstatesof knowledge?
The Semantic Wall PhysicalSymbol System World +BLOCKA+ +BLOCKB+ +BLOCKC+ P1:(IS_ON+BLOCKA+ +BLOCKB+) P2:((IS_RED+BLOCKA+)
Inference • KBα=sentenceαcanbederivedfrom KB byprocedurei • Consequencesof KBare a haystack;αisaneedle. • Entailment=needleinhaystack;inference =finding it • Soundness:iissound if • wheneverKBα,itis alsotrue thatKB╞α • Completeness:iiscompleteif • wheneverKB╞α,itisalsotrue thatKBα • Preview:wewilldefinea logic (first-orderlogic)whichis expressive enough to say almost anything ofinterest, and for which there existsa soundand completeinferenceprocedure. • That is,the procedurewillansweranyquestionwhoseanswer follows from what isknownbytheKB.
Basic symbols • Expressionsonlyevaluate to either“true”or “false.” • PQ “P and Q are either bothtrue orboth false”equivalence
Satisfiability • Related to constraint satisfaction • Given a sentence S, try to find an interpretation I where S is true • Analogous to finding an assignment of values to variables such that the constraint hold • Example problem: scheduling nurses in a hospital • Propositional variables represent for example that Nurse1 is working on Tuesday at 2 • Constraints on the schedule are represented using logical expressions over the variables • Brute force method: enumerate all interpretations and check
Example problem • Imagine that we knew that: • If today is sunny, then Amir will be happy (S H) • If Amir is happy, then the lecture will be good (H G) • Today is Sunny (S) • Should we conclude that today the lecture will be good
Checking Interpretations • Start by figuring out what set of interpretations make our original sentences true. • Then, if G is true in all those interpretations, it must be OK to conclude it from the sentences we started out with (our knowledge base). • In a universe with only three variables, there are 8 possible interpretations in total.