logical agents
play

Logical Agents Marco Chiarandini Department of Mathematics & - PowerPoint PPT Presentation

Lecture 20 Logical Agents Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Slides by Stuart Russell and Peter Norvig Knowledge-based Agents Course Overview Logic in General Introduction


  1. Lecture 20 Logical Agents Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Slides by Stuart Russell and Peter Norvig

  2. Knowledge-based Agents Course Overview Logic in General ✔ Introduction ✔ Learning ✔ Artificial Intelligence ✔ Supervised ✔ Intelligent Agents Decision Trees, Neural Networks ✔ Search Learning Bayesian Networks ✔ Uninformed Search ✔ Unsupervised ✔ Heuristic Search EM Algorithm ✔ Uncertain knowledge and ✔ Reinforcement Learning Reasoning ✔ Games and Adversarial Search ✔ Probability and Bayesian ✔ Minimax search and approach Alpha-beta pruning ✔ Bayesian Networks ✔ Multiagent search ✔ Hidden Markov Chains ✔ Kalman Filters ◮ Knowledge representation and Reasoning ◮ Propositional logic ◮ First order logic ◮ Inference ◮ Plannning 2

  3. Knowledge-based Agents Outline Logic in General 1. Knowledge-based Agents Wumpus Example 2. Logic in General 3

  4. Knowledge-based Agents Knowledge bases Logic in General Knowledge base = set of sentences in a formal language Inference engine domain−independent algorithms Knowledge base domain−specific content Declarative approach to building an agent (or other system): Tell it what it needs to know Then it can Ask itself what to do—answers should follow from the KB Agents can be viewed at the knowledge level i.e., what they know , regardless of how implemented Or at the implementation level i.e., data structures in KB and algorithms that manipulate them 4

  5. Knowledge-based Agents A simple knowledge-based agent Logic in General function 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 )) action ← Ask( KB , Make-Action-Query( t )) Tell( KB , Make-Action-Sentence( action , t )) t ← t + 1 return action The agent must be able to: Represent states, actions, etc. Incorporate new percepts Update internal representations of the world Deduce hidden properties of the world Deduce appropriate actions 5

  6. Knowledge-based Agents Wumpus World PEAS description Logic in General Performance measure gold +1000, death -1000 -1 per step, -10 for using the arrow Breeze 4 Stench PIT Environment Breeze Squares adjacent to wumpus are smelly Breeze 3 PIT Stench Squares adjacent to pit are breezy Gold Glitter iff gold is in the same square Breeze Stench 2 Shooting kills wumpus if you are facing it Shooting uses up the only arrow Breeze Breeze 1 PIT Grabbing picks up gold if in same square START Releasing drops the gold in same square 1 2 3 4 Actuators LeftTurn , RightTurn , Forward , Grab , Release , Shoot Sensors Breeze , Glitter , Smell 7

  7. Knowledge-based Agents Wumpus world – Properties Logic in General Fully vs Partially observable?? Breeze Stench 4 No—only local perception PIT Deterministic vs Stochastic?? Breeze Breeze Deterministic—outcomes exactly specified 3 PIT Stench Episodic vs Sequential?? Gold sequential at the level of actions Breeze Stench 2 Static vs Dynamic?? Static—Wumpus and Pits do not move Breeze Breeze 1 Discrete vs Continous?? PIT START Discrete 1 2 3 4 Single-agent vs Multi-Agent?? Single—Wumpus is essentially a natural feature 8

  8. Knowledge-based Agents Exploring a wumpus world Logic in General P? OK P B OK P? BGS OK OK A A A OK S OK W A A 9

  9. Knowledge-based Agents Outline Logic in General 1. Knowledge-based Agents Wumpus Example 2. Logic in General 11

  10. Knowledge-based Agents Logic in general 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; x 2 + 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 12

  11. Knowledge-based Agents Entailment Logic in General Entailment means that one thing follows from another: KB | = α Knowledge base KB entails sentence α if and only if α is true in all worlds where KB is true E.g., the KB containing “OB Won” and “KBH won” entails “Either OB or KBH won” Entailment is a relationship between sentences (i.e., syntax ) that is based on semantics 13

  12. Knowledge-based Agents Models Logic in General Logicians typically think in terms of models, which are formally structured worlds with respect to which truth can be evaluated We say m is a model of a sentence α if α is true in m M ( α ) is the set of all models of α Then KB | = α if and only if M ( KB ) ⊆ M ( α ) E.g. KB = OB won and FCK won x x x x α = OB won x x x x x M( ) xx x x x x x x x x x x x x x x x x x x xx x x x x x x x x x x M(KB) x x x x x x 14

  13. Knowledge-based Agents Entailment in the wumpus world Logic in General Situation after detecting nothing in [1,1], ? ? moving right, breeze in [2,1] B ? Consider possible models for ?s A A assuming only pits 3 Boolean choices = ⇒ 8 possible models 15

  14. Knowledge-based Agents Inference Logic in General KB ⊢ i α = sentence α can be derived from KB by procedure i Soundness: i is sound if whenever KB ⊢ i α , it is also true that KB | = α Completeness: i is complete if whenever KB | = α , it is also true that KB ⊢ i α Preview: we will define a logic (first-order logic) which is expressive enough to say almost anything of interest, and for which there exists a sound and complete inference procedure. That is, the procedure will answer any question whose answer follows from what is known by the KB . 21

  15. Propositional Logic Inference in PL Part I 22

  16. Propositional Logic Outline Inference in PL 3. Propositional Logic Introduction Equivalence and Validity 4. Inference in PL Proof by Resolution Proof by Model Checking 23

  17. Propositional Logic Outline Inference in PL 3. Propositional Logic Introduction Equivalence and Validity 4. Inference in PL Proof by Resolution Proof by Model Checking 24

  18. Propositional Logic Propositional logic: Syntax Inference in PL Propositional logic is the simplest logic—illustrates basic ideas The proposition symbols P 1 , P 2 etc are sentences If S is a sentence, ¬ S is a sentence (negation) If S 1 and S 2 are sentences, S 1 ∧ S 2 is a sentence (conjunction) If S 1 and S 2 are sentences, S 1 ∨ S 2 is a sentence (disjunction) If S 1 and S 2 are sentences, S 1 = ⇒ S 2 is a sentence (implication) If S 1 and S 2 are sentences, S 1 ⇔ S 2 is a sentence (biconditional) 26

  19. Propositional Logic Propositional logic: Semantics Inference in PL Each model specifies true/false for each proposition symbol E.g. P 1 , 2 P 2 , 2 P 3 , 1 true 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 S 1 ∧ S 2 is true iff S 1 is true and S 2 is true S 1 ∨ S 2 is true iff S 1 is true or S 2 is true S 1 = ⇒ S 2 is true iff S 1 is false or S 2 is true i.e., is false iff S 1 is true and S 2 is false S 1 ⇔ S 2 is true iff S 1 = ⇒ S 2 is true and S 2 = ⇒ S 1 is true Simple recursive process evaluates an arbitrary sentence, e.g., ¬ P 1 , 2 ∧ ( P 2 , 2 ∨ P 3 , 1 ) = true ∧ ( false ∨ true ) = true ∧ true = true 27

  20. Propositional Logic Truth tables for connectives Inference in PL P Q ¬ P P ∧ Q P ∨ Q P ⇒ Q P ⇔ Q false false true false false true true false true true false true true false true false false false true false false true true false true true true true 28

  21. Propositional Logic Wumpus world sentences Inference in PL Let P i , j be true if there is a pit in [ i , j ] . Let B i , j be true if there is a breeze in [ i , j ] . R 1 : ¬ P 1 , 1 R 2 : ¬ B 1 , 1 R 3 : B 2 , 1 “Pits cause breezes in adjacent squares” “A square is breezy if and only if there is an adjacent pit” R 4 : B 1 , 1 ⇔ ( P 1 , 2 ∨ P 2 , 1 ) R 5 : B 2 , 1 ⇔ ( P 1 , 1 ∨ P 2 , 2 ∨ P 3 , 1 ) 29

  22. Propositional Logic Truth tables for inference Inference in PL KB ⊢ α B 1 , 1 B 2 , 1 P 1 , 1 P 1 , 2 P 2 , 1 P 2 , 2 P 3 , 1 R 1 R 2 R 3 R 4 R 5 KB false false false false false false false true true true true false false false false false false false false true true true false true false false . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . false true false false false false false true true false true true false false true false false false false true true true true true true true false true false false false true false true true true true true true false true false false false true true true true true true true true false true false false true false false true false false true true false . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . true true true true true true true false true true false true false Enumerate rows (different assignments to symbols), if KB is true in row, check that α is too 30

Recommend


More recommend