knowledge based agents
play

Knowledge-based Agents Can represent knowledge And reason with this - PDF document

Knowledge-based Agents Can represent knowledge And reason with this knowledge CS 331: Artificial Intelligence How is this different from the knowledge Propositional Logic I used by problem-specific agents? More general More


  1. Knowledge-based Agents • Can represent knowledge • And reason with this knowledge CS 331: Artificial Intelligence • How is this different from the knowledge Propositional Logic I used by problem-specific agents? – More general – More flexible 1 2 Outline Knowledge-based Agents • Knowledge of problem solving agents is 1. Knowledge-based Agents specific and inflexible 2. The Wumpus World • Knowledge-based agents can benefit from 3. Logic knowledge expressed in very general forms, combining information in different ways to suit different purposes • Knowledge-based agents can combine general knowledge with current percepts to infer hidden aspects of the current state 3 4 Knowledge-based Agents Knowledge is definite • Knowledge of logical agents is always definite Flexibility of knowledge-based agents: • That is, each proposition is entirely true or entirely • Accept new tasks in the form of explicitly false described goals • Agent may be agnostic about some propositions • Achieve competence quickly by being told • Logic doesn’t handle uncertainty well or learning new knowledge about the environment • Adapt to changes in the environment by updating the relevant knowledge 5 6 1

  2. The Knowledge Base (KB) The Knowledge Base (KB) TELL • A knowledge base is a set • Need to add new of “sentences” sentences to the knowledge base (this task • Each sentence is is called TELL) Knowledge Base : Knowledge Base : expressed in a knowledge Sentence 1 Sentence 1 • Need to query what is representation language Sentence 2 Sentence 2 : : and represents some known (this task is called Sentence N Sentence N assertion about the world ASK) ASK 7 8 Knowledge Base Example Inference TELL • Inference: deriving new sentences from old ones • Must obey fundamental requirement: when one ASKs a question of the knowledge Knowledge Base : Murderer wasn’t Colonel Mustard base, answer should follow from what has Murderer wasn’t Miss Scarlett When you discover a new Weapon wasn’t the Gun fact like “The murder room been TELLed to the KB previously Weapon wasn’t the Candlestick wasn’t the study”, you would Room wasn’t the Library TELL the KB You can then ASK the KB what to ask next ASK 9 10 A Generic Knowledge-based Agent A Generic Knowledge-based Agent Input: Percept Input: Percept Starts out with background knowledge Knowledge Knowledge Base Base Output: Action Output: Action 11 12 2

  3. The Wumpus World A Generic Knowledge-based Agent Input: Percept • Wumpus eats anyone that enters its room • Wumpus can be shot 1. TELL the KB what it by an agent, but agent perceives has one arrow 2. ASK the KB what action Knowledge it should perform Base • Pits trap the agent (but 3. TELL the KB that the not the wumpus) action was executed • Agent’s goal is to pick up the gold Output: Action 13 14 The Wumpus World The Wumpus World • Performance measure : • Actuators : – +1000 for picking up gold, -1000 for death (meeting a – Movement: live wumpus or falling into a pit) • Agent can move forward – -1 for each action taken, -10 for using arrow • Turn 90 degrees left or right • Environment : – Grab: pick up an object in same square – 4x4 grid of rooms – Agent starts in (1,1) and faces right – Shoot: fire arrow in straight line in the direction – Geography determined at the start: agent is facing • Gold and wumpus locations chosen randomly • Each square other than start can be a pit with probability 0.2 15 16 The Wumpus World The Wumpus World • Sensors : • Biggest challenge: Agent is ignorant of the – Returns a 5-tuple of five symbols eg. [stench, breeze, configuration of the 4x4 world glitter, bump, scream] (note that in this 5-tuple, all five • Needs logical reasoning of percepts in order things are present. We indicate absence with the value None) to overcome this ignorance – In squares adjacent to the wumpus, agent perceives a • Note: retrieving gold may not be possible stench due to randomly generated location of pits – In squares adjacent to a pit, agent perceives a breeze – In squares containing gold, agent perceives a glitter • Initial knowledge base contains: – When agent walks into a wall, it perceives a bump – Agent knows it is in [1,1] – When wumpus is killed, it emits a woeful scream that is – Agent knows it is a safe square perceived anywhere 17 18 3

  4. The Wumpus World Environment Wumpus World Example Properties • Fully or Partially observable? • Deterministic or stochastic? • Episodic or sequential? • Static or dynamic? • Discrete or continuous? • Single agent or multiagent? 19 20 Wumpus World Example Wumpus World Example 1 st percept is: 2 nd percept is: [None, None, None, None, None] [None, Breeze, None, None, None] (Corresponding to [Stench, Breeze, Glitter, Must be a pit at [2,2] or [3,1] or both. We Bump, Scream]) mark this with a P?. Agent concludes squares [1,2], [2,1] are Only one square that is OK, so the agent safe. We mark them with OK. A cautious goes back to [1,1] and then to [1,2] agent will move only to a square that it knows is OK. Agent now moves to [2,1] 21 22 Wumpus World Example Wumpus World Example 3 rd percept is: Note the difficulty of this inference: • Combines knowledge gained at different [Stench, None, None, None, None] times and at different places. Wumpus must be nearby. Can’t be in [1,1] • Relies on the lack of a percept to make (by rules of the game) or [2,2] (otherwise agent would have detected a stench at one crucial step [2,1]) Therefore, Wumpus must be in [1,3]. At this point, the agent moves to [2,2]. Indicate this by W!. Lack of breeze in [1,2] means no pit in [2,2], so pit must be in [3,1]. 23 24 4

  5. Wumpus World Example Logic We’ll skip the agent’s state of knowledge Logic must define: at [2,2] and assume it goes to [2,3]. 1. Syntax of the representation language Agent detects a glitter in [2,3] so it grabs • Symbols, rules, legal configurations the gold and ends the game 2. Semantics of the representation language • Loosely speaking, this is the “meaning” of the Note: In each case where the agent draws a conclusion from the sentence available information, that conclusion • Defines the truth of each sentence with is guaranteed to be correct if the respect to each possible world available information is correct • Everything is either true or false, no in between 25 26 Models Entailment • We will use the word model instead of “possible α |= β means α entails β i.e. β follows world” logically from α , where α and β are • “m is a model of α” means that sentence α is true sentences in model m • Models are mathematical abstractions which fix the truth or falsehood of every relevant sentence Mathematically, α |= β if and only if in every • Think of it as the possible assignments of values model in which α is true, β is also true. to the variables – E.g. the possible models for x + y = 4 are all possible assignments of numbers to x and y such that they add Another way: if α is true, then β must also be up to 4 true. 27 28 Entailment Applied to the Wumpus Entailment Applied to the Wumpus World World 2 3 = 8 possible models • Suppose the agent moves to [2,1] because [1,2], [2,2] and • Agent knows there is nothing in [3,1] can take each take values true or false that [1,1] and a breeze in [2,1] there is a pit there • These percepts, along with the agent’s knowledge of the rules of the wumpus world constitute the KB • Given this KB, agent is interested if the adjacent squares [1,2], [2,2] The 3 models inside the line marked KB are and [3,1] contain pits. those in which the KB is true 29 30 5

  6. Entailment Applied to the Wumpus Entailment applied to the Wumpus World World Now let us consider the Let us consider the models that models that support the support the conclusion α 1 = conclusion α 2 = “There “There is no pit in [1,2].” We is no pit in [2,2].” We draw a line marked with α 1 draw a line marked around these models with α 2 around these models In every model in which KB is true, α 1 is also true. In some models in Therefore KB |= α 1 which KB is true, α 2 is false. Therefore KB |≠ α 2 and the agent cannot conclude that there is no pit in [2,2] 31 32 Logical inference Modified Wumpus World • Entailment can be applied to derive conclusions • Breeze occurs in squares directly or (we call this carrying out logical inference) diagonally adjacent to a pit • Model checking: enumerates all possible models to check that α is true in all models in which KB is true • If an inference algorithm i can derive α from the KB, we write KB |- i α • The above is pronounced “α is derived from KB by i ” or “ i derives α from KB” 33 34 Modified Wumpus Exercise Soundness • KB includes modified rules plus: • An inference algorithm that derives only entailed sentences is called sound or truth- 2,1 2,2 2,3 S preserving V • Soundness is a good thing! OK • If an inference algorithm is unsound, you 1,1 1,2 1,3 B,S V can make things up as it goes along and V OK OK derive basically anything it wants to This (unsoundness) • Want to reason about squares [2,2], [2,3], [1,3] is most illogical 35 36 6

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend