A knowledge-based agent

Slides:



Advertisements
Similar presentations
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
Advertisements

Logic.
Artificial Intelligence Knowledge-based Agents Russell and Norvig, Ch. 6, 7.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
1 Knowledge-Based Agents Chapter CMSC 471 Adapted from slides by Tim Finin and Marie desJardins. Some material adopted from notes by Andreas Geyer-Schulz.
Knowledge Representation & Reasoning.  Introduction How can we formalize our knowledge about the world so that:  We can reason about it?  We can do.
Class Project Due at end of finals week Essentially anything you want, so long as its AI related and I approve Any programming language you want In pairs.
1 Problem Solving CS 331 Dr M M Awais Representational Methods Formal Methods Propositional Logic Predicate Logic.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 6 Dr Souham Meshoul CAP492.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Knowledge in intelligent systems So far, we’ve used relatively specialized, naïve agents. How can we build agents that incorporate knowledge and a memory?
Logical Agents Chapter 7.
INTRODUÇÃO AOS SISTEMAS INTELIGENTES Prof. Dr. Celso A.A. Kaestner PPGEE-CP / UTFPR Agosto de 2011.
LOGICAL AGENTS Yılmaz KILIÇASLAN. Definitions Logical agents are those that can:  form representations of the world,  use a process of inference to.
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
Propositional Logic: Logical Agents (Part I) This lecture topic: Propositional Logic (two lectures) Chapter (this lecture, Part I) Chapter 7.5.
Logical Agents Chapter 7 (based on slides from Stuart Russell and Hwee Tou Ng)
Logical Agents. Knowledge bases Knowledge base = set of sentences in a formal language Declarative approach to building an agent (or other system): 
Artificial Intelligence Lecture No. 9 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Knowledge-Based Agents Chapter Some material adopted from notes by Andreas Geyer-Schulz and Chuck Dyer.
Logical Agents (NUS) Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Propositional Logic: Logical Agents (Part I) This lecture topic: Propositional Logic (two lectures) Chapter (this lecture, Part I) Chapter 7.5.
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part A Knowledge Representation and Reasoning.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Class Project Due at end of finals week Essentially anything you want, so long as its AI related and I approve Any programming language you want In pairs.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
1 CMSC 671 Fall 2001 Class #9 – Tuesday, October 2.
1 CMSC 471 Fall 2002 Class #9– Monday, Sept Knowledge Representation Chapter Some material adopted from notes by Andreas Geyer-Schulz and.
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Jan 17, 2012.
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
1 Logical Agents Chapter 7. 2 A simple knowledge-based agent The agent must be able to: –Represent states, actions, etc. –Incorporate new percepts –Update.
Knowledge Representation Lecture # 17, 18 & 19. Motivation (1) Up to now, we concentrated on search methods in worlds that can be relatively easily represented.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
1 Knowledge-Based Agents Chapter Some material adopted from notes by Andreas Geyer-Schulz and Chuck Dyer.
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Knowledge-Based Agents Chapter Some material adopted from notes by Andreas Geyer-Schulz and Chuck Dyer.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Logical Agents Russell & Norvig Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean)
1 UNIT-3 KNOWLEDGE REPRESENTATION. 2 Agents that reason logically(Logical agents) A Knowledge based Agent The Wumpus world environment Representation,
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7 Part I. 2 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic.
1 Knowledge Representation Logic and Inference Propositional Logic Vumpus World Knowledge Representation Logic and Inference Propositional Logic Vumpus.
Knowledge-Based Agents Chapter Some material adopted from notes by Andreas Geyer-Schulz and Chuck Dyer.
Artificial Intelligence Logical Agents Chapter 7.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents. Inference : Example 1 How many variables? 3 variables A,B,C How many models? 2 3 = 8 models.
CS666 AI P. T. Chung Logic Logical Agents Chapter 7.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Propositional Logic: Logical Agents (Part I)
Class #10– Wednesday, October 1
EA C461 – Artificial Intelligence Logical Agent
Learning and Knowledge Acquisition
Logical Agents Chapter 7 Selected and slightly modified slides from
Logical Agents Reading: Russell’s Chapter 7
Logical Agents Chapter 7.
Artificial Intelligence
Class #9– Thursday, September 29
Logical Agents Chapter 7.
Knowledge Representation I (Propositional Logic)
CMSC 471 Fall 2011 Class #10 Tuesday, October 4 Knowledge-Based Agents
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

A knowledge-based agent A knowledge-based agent includes a knowledge base and an inference system. A knowledge base is a set of representations of facts of the world. Each individual representation is called a sentence. The sentences are expressed in a knowledge representation language. The agent operates as follows: 1. It TELLs the knowledge base what it perceives. 2. It ASKs the knowledge base what action it should perform. 3. It performs the chosen action.

Knowledge-Based Agent Function TELL: adds a sentence to the KB ASK: queries the KB

Architecture of a knowledge-based agent Knowledge Level. The most abstract level: describe agent by saying what it knows. Example: A taxi agent might know that the Golden Gate Bridge connects San Francisco with the Marin County. Logical Level. The level at which the knowledge is encoded into sentences. Example: Links(GoldenGateBridge, SanFrancisco, MarinCounty). Implementation Level. The physical representation of the sentences in the logical level. Example: ‘(links goldengatebridge sanfrancisco marincounty)

The Wumpus World environment The Wumpus computer game The agent explores a cave consisting of rooms connected by passageways. Lurking somewhere in the cave is the Wumpus, a beast that eats any agent that enters its room. Some rooms contain bottomless pits that trap any agent that wanders into the room. Occasionally, there is a heap of gold in a room. The goal is to collect the gold and exit the world without being eaten

Jargon file on “Hunt the Wumpus” WUMPUS /wuhm'p*s/ n. The central monster (and, in many versions, the name) of a famous family of very early computer games called “Hunt The Wumpus,” dating back at least to 1972 (several years before ADVENT) on the Dartmouth Time-Sharing System. The wumpus lived somewhere in a cave with the topology of a dodecahedron's edge/vertex graph (later versions supported other topologies, including an icosahedron and Mobius strip). The player started somewhere at random in the cave with five “crooked arrows”; these could be shot through up to three connected rooms, and would kill the wumpus on a hit (later versions introduced the wounded wumpus, which got very angry). Unfortunately for players, the movement necessary to map the maze was made hazardous not merely by the wumpus (which would eat you if you stepped on him) but also by bottomless pits and colonies of super bats that would pick you up and drop you at a random location (later versions added “anaerobic termites” that ate arrows, bat migrations, and earthquakes that randomly changed pit locations). This game appears to have been the first to use a non-random graph-structured map (as opposed to a rectangular grid like the even older Star Trek games). In this respect, as in the dungeon-like setting and its terse, amusing messages, it prefigured ADVENT and Zork and was directly ancestral to both. (Zork acknowledged this heritage by including a super-bat colony.) Today, a port is distributed with SunOS and as freeware for the Mac. A C emulation of the original Basic game is in circulation as freeware on the net.

A typical Wumpus world The agent always starts in the field [1,1]. The task of the agent is to find the gold, return to the field [1,1] and climb out of the cave.

Agent in a Wumpus world: Percepts The agent perceives a stench in the square containing the wumpus and in the adjacent squares (not diagonally) a breeze in the squares adjacent to a pit a glitter in the square where the gold is a bump, if it walks into a wall a woeful scream everywhere in the cave, if the wumpus is killed The percepts will be given as a five-symbol list: If there is a stench, and a breeze, but no glitter, no bump, and no scream, the percept is [Stench, Breeze, None, None, None] The agent can not perceive its own location.

Wumpus actions go forward turn right 90 degrees turn left 90 degrees grab means pick up an object that is in the same square as the agent shoot means fire an arrow in a straight line in the direction the agent is looking. The arrow continues until it either hits and kills the wumpus or hits the wall. The agent has only one arrow. Only the first shot has any effect. climb is used to leave the cave. Only effective in start field. die, if the agent enters a square with a pit or a live wumpus. (No take-backs!)

Wumpus goal The agent’s goal is to find the gold and bring it back to the start as quickly as possible, without getting killed. 1000 points reward for climbing out of the cave with the gold 1 point deducted for every action taken 10000 points penalty for getting killed

The Wumpus agent’s first step

Later

Representation, reasoning, and logic The object of knowledge representation is to express knowledge in a computer-tractable form, so that agents can perform well. A knowledge representation language is defined by: its syntax, which defines all possible sequences of symbols that constitute sentences of the language. Examples: Sentences in a book, bit patterns in computer memory. its semantics, which determines the facts in the world to which the sentences refer. Each sentence makes a claim about the world. An agent is said to believe a sentence about the world.

Logic as a KR language Higher Order First Order Propositional Logic Modal Fuzzy Logic Multi-valued Probabilistic Temporal Non-monotonic

Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language Semantics define the "meaning" of sentences; i.e., define truth of a sentence in a world E.g., the language of arithmetic x+2 ≥ y is a sentence; x2+y > {} is not a sentence x+2 ≥ y is true iff the number x+2 is no less than the number y x+2 ≥ y is true in a world where x = 7, y = 1 x+2 ≥ y is false in a world where x = 0, y = 6

Propositional logic: Syntax Propositional logic is the simplest logic – illustrates basic ideas The proposition symbols P1, P2 etc are sentences If S is a sentence, S is a sentence (negation) If S1 and S2 are sentences, S1  S2 is a sentence (conjunction) If S1 and S2 are sentences, S1  S2 is a sentence (disjunction) If S1 and S2 are sentences, S1  S2 is a sentence (implication) If S1 and S2 are sentences, S1  S2 is a sentence (biconditional)

Propositional logic: Semantics Each model specifies true/false for each proposition symbol E.g. P1,2 P2,2 P3,1 false true false With these symbols, 8 possible models, can be enumerated automatically. Rules for evaluating truth with respect to a model m: S is true iff S is false S1  S2 is true iff S1 is true and S2 is true S1  S2 is true iff S1is true or S2 is true S1  S2 is true iff S1 is false or S2 is true i.e., is false iff S1 is true and S2 is false S1  S2 is true iff S1S2 is true andS2S1 is true Simple recursive process evaluates an arbitrary sentence, e.g., P1,2  (P2,2  P3,1) = true  (true  false) = true  true = true

The connection between sentences and facts Semantics maps sentences in logic to facts in the world. The property of one fact following from another is mirrored by the property of one sentence being entailed by another.

Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules Legitimate (sound) generation of new sentences from old Proof = a sequence of inference rule applications Can use inference rules as operators in a standard search algorithm Typically require transformation of sentences into a normal form Model checking truth table enumeration (always exponential in n) improved backtracking, e.g., Davis--Putnam-Logemann-Loveland (DPLL) heuristic search in model space (sound but incomplete) e.g., min-conflicts-like hill-climbing algorithms

Inference Inference is the process of checking correctness by procedures that preserve truth KB ├i α means sentence α can be derived from KB by procedure i Soundness: i is sound means whenever KB ├i α, it is also true that KB╞ α Completeness: i is complete means whenever KB╞ α, it is also true that KB ├i α

Inference: the cheat sheet We will define a logic expressive enough to say many things of interest Known as first-order logic For which there is an inference method which is Sound Complete That is, the method will answer any question whose answer follows from what is known by the KB Sounds too good to be true? The fly in the soup: The method might go on forever That is, it can’t tell us for sure if the question has a false answer In fact, it’s possible to prove that no such method could exist But first, we define a weaker logic Propositional Logic

Validity A sentence is valid means it is true in all models, True, A A, A  A, (A  (A  B))  B Validity is connected with inference in a very useful way: KB ╞ α if and only if (KB  α) is valid The Deduction Theorem

Satisfiability A sentence is satisfiable means it is true in some model A B, C A sentence is unsatisfiable means it is true in no models AA Satisfiability is also connected to inference : KB ╞ α if and only if (KB α) is unsatisfiable

Propositional logic: Syntax Propositional logic is the simplest logic The proposition symbols P1, P2 etc are sentences If S is a sentence, (S) is also (negation) If S1 and S2 are sentences, (S1  S)) is also (conjunction) If S1 and S2 are sentences, (S1  S2) is also (disjunction) If S1 and S2 are sentences, S1  S2) is also (implication) If S1 and S2 are sentences, S1  S2) is also (biconditional) Since it often doesn’t matter, in many cases we will leave out the brackets In digital logic, you might have seen ~ for , . for , + for 

Propositional logic: Semantics A model specifies true/false for each proposition symbol E.g. P1,2 P2,2 P3,1 false true false With these symbols, 8 possible models, can be enumerated automatically. Rules for evaluating truth with respect to a model m: S is true iff S is false S1  S2 is true iff S1 is true and S2 is true S1  S2 is true iff S1is true or S2 is true S1  S2 is true iff S1 is false or S2 is true i.e., is false iff S1 is true and S2 is false S1  S2 is true iff S1S2 is true andS2S1 is true A simple recursive process evaluates any sentence, e.g. P1,2  (P2,2  P3,1) = true  (true  false) = true  true = true

Ontology and epistemology Ontology is the study of what there is, an inventory of what exists. An ontological commitment is a commitment to an existence claim. Epistemology is major branch of philosophy that concerns the forms, nature, and preconditions of knowledge.

Truth tables for connectives

Example P H P v H (P v H)^H’ ((P v H)^H’) => p F T T F

No independent access to the world The reasoning agent often gets its knowledge about the facts of the world as a sequence of logical sentences and must draw conclusions only from them without independent access to the world. Thus it is very important that the agent’s reasoning is sound!

Models

Inference Rules Inference rules allow us to deduce new true sentences from previous ones. There are many possible sets, the set below are taken under fair dealing use from http://en.wikipedia.org/wiki/Propositional_logic Double negative elimination From the sentence ¬ ¬ φ, we may infer φ Conjunction introduction From any sentences φ and ψ, we may infer ( φ ∧ ψ ). Conjunction elimination From any sentence ( φ ∧ ψ ), we may infer φ and ψ Disjunction introduction From any sentence φ, we may infer (φ ∨ ψ) and (ψ ∨ φ), where ψ is any sentence.

Inference Rules Disjunction elimination Biconditional introduction From sentences ( φ ∨ ψ ), ( φ  χ ), and ( ψ  χ ), we may infer χ. Biconditional introduction From sentences ( φ  ψ ) and ( ψ  φ ), we may infer ( φ  ψ ). Biconditional elimination From the sentence ( φ  ψ ), we may infer ( φ  ψ ) and ( ψ  φ ). Modus ponens From sentences φ and ( φ  ψ ), we may infer ψ. Conditional proof If ψ can be derived by assuming φ, we can infer ( φ  ψ ). Reductio ad absurdum If we can derive both ψ and ¬ ψ by assuming φ, we may infer ¬ φ.

a b r a v b ~b v r a v r F T

Properties of our Inference Rules Good Sound We can’t derive invalid sentences Complete We will always be able to derive valid sentences Readily used by people People can readily use these rules to derive proofs People are good at choosing the right rules to use Not so good Not so effective for automated use It’s not easy to get machines to choose the right rules to make a proof

SAT is NP-complete (1) SAT is an NP algorithm. (2) SAT is NP-hard: Every NP algorithm can be transformed in polynomial time to SAT [Horowitz 1998] such that SAT is satisfiable if and only if the answer for the original NP problem is “YES”. That is, every NP problem  SAT . By (1) and (2), SAT is NP-complete.

Proof of NP-Completeness To show that A is NP-complete (I) Prove that A is an NP problem. (II) Prove that  B  NPC, B  A.  A  NPC Why ?

Models and Entailment in the Wumpus World Situation after detecting nothing in [1,1], moving right, breeze in [2,1] Consider possible models for KB assuming only pits 3 Boolean choices  8 possible models

Propositional Logic (PL) PL: logic that consists of proposition symbols and connectives Each symbol is either true or false Syntax: describes how the symbols and connectives form sentences Semantics: describes rules for determining the truth of a sentence wrt to a model

Function propositional-kb-agent(percept)returns an action Static: KB ,a knowledge base t, a counter , initially 0 , indicating time Tell(kb, make-percept-sentence(percept,t)) For each action in the list of possible actions do if ask(KB.make-agent-query(t,action)) then tt +1 Return action end