Artificial Intelligence - PowerPoint PPT Presentation

artificial intelligence n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Artificial Intelligence PowerPoint Presentation
Download Presentation
Artificial Intelligence

play fullscreen
1 / 77
Artificial Intelligence
131 Views
Download Presentation
vienna
Download Presentation

Artificial Intelligence

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Artificial Intelligence Logical agents Chapter 7, AIMA This presentation owes some to V. Pavlovic @ Rutgers and D. Byron @ OSU

  2. Motivation for knowledge representation • The search programs so far have been ”special purpose” – we have to code everything into them. • We need something more general, where it suffices to tell the rules of the game.

  3. The Wumpus World 4 3 2 1 2 3 4 1

  4. The Wumpus World 4 3 2 1 2 3 4 1 Start position = (1,1)Always safe

  5. The Wumpus World 4 3 2 1 2 3 4 1 Goal: Get the gold

  6. The Wumpus World 4 3 2 1 2 3 4 1 Problem 1: Big, hairy, smelly, dangerous Wumpus. Will eat you if you run into it, but you can smell it a block away. You have one (1) arrow for shooting it.

  7. The Wumpus World 4 3 2 1 2 3 4 1 Problem 2: Big, bottomless pits where you fall down. You can feel the breeze when you are near them.

  8. 4 3 2 1 2 3 4 1 The Wumpus World PEAS description Performance measure:+1000 for gold-1000 for being eaten or falling down pit-1 for each action-10 for using the arrow Environment:44 grid of ”rooms”, each ”room” can be empty, with gold, occupied by Wumpus, or with a pit. Actuators:Move forward, turn left 90, turn right 90Grab, shoot Sensors:Olfactory – stench from WumpusTouch – breeze (pits) & hardness (wall)Vision – see goldAuditory – hear Wumpus scream when killed

  9. 4 3 2 1 2 3 4 1 The Wumpus World PEAS description Performance measure:+1000 for gold-1000 for being eaten or falling down pit-1 for each action-10 for using the arrow Environment:44 grid of ”rooms”, each ”room” can be empty, with gold, occupied by Wumpus, or with a pit. Acuators:Move forward, turn left 90, turn right 90Grab, shoot Sensors:Olfactory – stench from WumpusTouch – breeze (pits) & hardness (wall)Vision – see goldAuditory – hear Wumpus scream when killed

  10. ok ok ok Exploring the Wumpus world Agent senses nothing (no breeze, no smell,..) A Slide adapted from V. Pavlovic

  11. P? ok P? ok ok Exploring the Wumpus world B Agent feels a breeze A A Slide adapted from V. Pavlovic

  12. P? ok P? W? ok W? ok Exploring the Wumpus world S Agent feels a foul smell A B Slide adapted from V. Pavlovic

  13. P? ok P? W? ok W? ok Exploring the Wumpus world Wumpus can’t be heresince there was nosmell there... Pit can’t be theresince there was nobreeze here... S ok A B Slide adapted from V. Pavlovic

  14. P? ok ok P P W W ok W? ok ok Exploring the Wumpus world Agent senses nothing (no breeze, no smell,..) S ok A A B Slide adapted from V. Pavlovic

  15. P? ok ok P W ok W? ok ok Exploring the Wumpus world Agent senses breeze,smell, and sees gold! B S G A S ok A B Slide adapted from V. Pavlovic

  16. P? ok ok P W ok W? ok ok Exploring the Wumpus world B S G A S ok B Grab the gold andget out! A Slide adapted from V. Pavlovic

  17. P? ok P? W? ok W? ok Exploring the Wumpus world Wumpus can’t be heresince there was nosmell there... Pit can’t be theresince there was nobreeze here... S A B How do we automate this kind of reasoning?(How can we make these inferences automatically?) Slide adapted from V. Pavlovic

  18. Logic Logic is a formal language for representing information such that conclusions can be drawn A logic has • Syntax that specifies symbols in the language and how they can be combined to form sentences • Semantics that specifies what facts in the world a semantics refers to.Assigns truth values to sentences based on their meaning in the world. • Inference procedure, a mechanical method for computing (deriving) new (true) sentences from existing sentences

  19. Entailment The sentence A entails the sentence B • If A is true, then B must also be true • B is a ”logical consequence” of A Let’s explore this concept a bit... A ⊨B

  20. 4 3 2 1 2 3 4 1 Example: Wumpus entailment Agent’s knowledge base (KB) after having visited (1,1) and (1,2): • The rules of the game (PEAS) • Nothing in (1,1) • Breeze in (1,2) Which models (states of the world) match these observations?

  21. 4 3 2 1 2 3 4 1 Example: Wumpus entailment We only care about neighboring rooms, i.e. {(2,1),(2,2),(1,3)}. We can’t know anything about the other rooms. We care about pits, because we have detected a breeze. We don’t want to fall down a pit. There are 23=8 possible arrangements of {pit, no pit} in the three neighboring rooms. Possible conclusions: a1 : There is no pit in (2,1) a2 : There is no pit in (2,2) a3 : There is no pit in (1,3)

  22. If KB is true, thena1 is also true. KB entails a1. KB ⊨a1 a1 : There is no pit in (2,1) KB = The set of models that agrees with the knowledge base (the observed facts) [The KB is true in these models] a1 = The set of models that agrees with conclusion a1[conclusion a1 is true in these models]

  23. If KB is true, thena2 is not also true. KB does not entail a2. KB ⊭a2 a2 : There is no pit in (2,2) KB = The set of models that agrees with the knowledge base (the observed facts) [The KB is true in these models] a2 = The set of models that agrees with conclusion a2[conclusion a2 is true in these models]

  24. ? a3 a3 : There is no pit in (1,3) KB = The set of models that agrees with the knowledge base (the observed facts) [The KB is true in these models] a3 = The set of models that agrees with conclusion a3[conclusion a3 is true in these models]

  25. If KB is true, thena3 is not also true. KB does not entail a3. KB ⊭a3 a3 a3 : There is no pit in (1,3) KB = The set of models that agrees with the knowledge base (the observed facts) [The KB is true in these models] a3 = The set of models that agrees with conclusion a3[conclusion a3 is true in these models]

  26. Inference engine ”A is derived from KB by inference engine i” • Truth-preserving:i only derives entailed sentences • Complete:i derives all entailed sentences KB ⊢i A We want inference engines that are both truth-preserving and complete

  27. Wumpus in room (3,1) Pit in room (1,3) Propositional (boolean) logic Syntax Atomic sentence = a single propositional symbole.g. P, Q, P13, W31, G32, T, F Complex sentence = combination of simple sentences using connectives¬ (not) negation∧ (and) conjunction∨ (or) disjunction⇒ (implies) implication⇔ (iff = if and only if) biconditional P13∧ W31 W31∨¬W31 W31⇒ S32 Precedence: ¬,∧,∨,⇒,⇔

  28. Atomicsentences Propositional (boolean) logic Semantics Semantics: The rules for whether a sentence is true or false • T (true) is true in every model • F (false) is false in every model • The truth values for other proposition symbols are specified in the model. • Truth values for complex sentences are specified in a truth table

  29. Boolean truth table

  30. Boolean truth table Not P is the opposite of P

  31. Boolean truth table P ∧ Q is true only when both P and Q are true

  32. Boolean truth table P ∨ Q is true when either P or Q is true

  33. Boolean truth table P ⇒ Q : If P is true then we claim thatQ is true, otherwise we make no claim

  34. Boolean truth table P ⇔ Q is true when the truth values for P and Q are identical

  35. Boolean truth table The exlusive or (XOR) is differentfrom the OR

  36. (1,1) = [P is true, Q is true] 1 1 1 1 1 1 Q Q Q Q Q Q 0 0 0 0 0 0 P P P P P P 0 0 0 0 0 0 1 1 1 1 1 1 P ∧ Q P ∨ Q (1,0) = [P is true, Q is false] P ⇒ Q P ⇔ Q P ⊕ Q ≡ ¬(P ⇔ Q) Graphical illustration of truth table Black means true, white means false

  37. 4 3 2 1 2 3 4 1 Example: Wumpus KB Interesting sentences [tell us what is in neighbor squares] Knowledge base • Nothing in (1,1) • Breeze in (1,2) Plus the rules of the game KB = R1∧ R2∧ R3∧ R4∧ R5∧ R6∧ R7∧ R8∧ R9∧ R10

  38. 4 We infer this from the rules of the game 3 2 1 2 3 4 1 Example: Wumpus KB Knowledge base • Nothing in (1,1) • Breeze in (1,2) Plus the rules of the game KB = R1∧ R2∧ R3∧ R4∧ R5∧ R6∧ R7∧ R8∧ R9∧ R10

  39. KBtrue KB (interesting sentences) Inference by enumerating models What is in squares (1,3), (2,1), and (2,2)? We have 6 interesting sentences: W21, W22, W13, P21, P22, P13 : 26 = 64 comb.

  40. KBtrue Inference by enumerating models What is in squares (1,3), (2,1), and (2,2)? KB ⊨¬(W21∧ W22∧ W13∧ P21)

  41. Inference by enumerating models • Implement as a depth-first search on a constraint graph (backtracking) • Time complexity ~ O(2n)where n is the number of relevant sentences • Space complexity ~ O(n) Not very efficient...

  42. Inference methods • Model checking (enumerating)- Just seen that • Using rules of inference- Coming next

  43. Some definitions Equivalence: A ≡ B iff A ⊨ B and B ⊨ A Validity: A valid sentence is true in all models (a tautology) A ⊨ B iff (A ⇒ B) is valid Satisfiability: A sentence is satisfiable if it is true in some model A ⊨ B iff (A ∧¬B) is unsatisfiable Let’s explore satisfiability first...

  44. If KB is true, thena1 is also true. KB entails a1. KB ⊨a1 KB ⊆a1 ¬a1 KB ^ ¬a1 never true KB = The set of models that agrees with the knowledge base (the observed facts) [The KB is true in these models] a1 = The set of models that agrees with conclusion a1[conclusion a1 is true in these models]

  45. Some definitions Equivalence: A ≡ B iff A ⊨ B and B ⊨ A Validity: A valid sentence is true in all models (a tautology) A ⊨ B iff (A ⇒ B) is valid Satisfiability: A sentence is satisfiable if it is true in some model A ⊨ B iff (A ∧¬B) is unsatisfiable

  46. B A A B Some definitions Equivalence: A ≡ B iff A ⊨ B and B ⊨ A Validity: A valid sentence is true in all models (a tautology) A ⊨ B iff (A ⇒ B) is valid Satisfiability: A sentence is satisfiable if it is true in some model A ⊨ B iff (A ∧¬B) is unsatisfiable A ⊨ B means that the set of modelswhere A is true is a subset of the modelswhere B is true: A ⊆ B B ⊨ A means that the set of modelswhere B is true is a subset of the modelswhere A is true: B ⊆ A Therefore, the set of models where A is true must be equal to the set of models where B is true: A ≡ B A≡B

  47. Some definitions Equivalence: A ≡ B iff A ⊨ B and B ⊨ A Validity: A valid sentence is true in all models (a tautology) A ⊨ B iff (A ⇒ B) is valid Satisfiability: A sentence is satisfiable if it is true in some model A ⊨ B iff (A ∧¬B) is unsatisfiable KB ⊨a1

  48. Logical equivalences

  49. Logical equivalences Work out these on paper for yourself, before we move on...

  50. Inference rules • Inference rules are written as If the KB contains the antecedent, you can add the consequent (the KB entails the consequent) Slide adapted from D. Byron