Download presentation
Presentation is loading. Please wait.
Published byTheresa Bryan Modified over 9 years ago
1
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start Breeze
2
2 The Wumpus Game Stench in the square containing the wumpus and in the directly adjacent squares Breeze in the squares directly adjacent to a pit Glitter in the square where the gold is Bump when an agent walks into a wall Scream when the wumpus is killed
3
3 The Wumpus Game Agent’s percept: [Stench, Breeze, Glitter, Bump, Scream] Agent’s actions: –Go forward, turn right 90 o, turn left 90 o –Grab to pick up an object in the same square –Fire 1 arrow in a straight line in the faced direction –Climb to leave the cave Death if entering a square of a pit or a live wumpus Agent’s goal: find and bring the gold back to the start
4
4 The Wumpus Game StenchBreeze Stench Gold Breeze Stench OK Breeze Start A Breeze OK Breeze A = Agent B = Breeze G = Glitter/Gold OK = Safe square P = Pit S = Stench V = Visited W = Wumpus
5
5 The Wumpus Game StenchBreeze Stench Gold Breeze Stench OKP?P? Breeze Start V Breeze AP? Breeze A = Agent B = Breeze G = Glitter/Gold OK = Safe square P = Pit S = Stench V = Visited W = Wumpus
6
6 The Wumpus Game StenchBreeze Stench Gold Breeze Stench AOK Breeze Start V Breeze V Breeze A = Agent B = Breeze G = Glitter/Gold OK = Safe square P = Pit S = Stench V = Visited W = Wumpus
7
7 The Wumpus Game StenchBreeze Stench Gold Breeze Stench VA Breeze Start V Breeze V Breeze A = Agent B = Breeze G = Glitter/Gold OK = Safe square P = Pit S = Stench V = Visited W = Wumpus
8
8 The Wumpus Game StenchBreeze Stench Gold A Breeze Stench VV Breeze Start V Breeze V Breeze A = Agent B = Breeze G = Glitter/Gold OK = Safe square P = Pit S = Stench V = Visited W = Wumpus
9
9 Propositional Logic Syntax Logical constants: true, false Propositional symbols: P, Q, … Logical connectives: , , , , Sentences (formulas): –Logical constants –Proposition symbols –If is a sentence, then so are and ( ) –If and are sentences, then so are , and
10
10 Propositional Logic Semantics Interpretation: propositional symbol true/false The truth value of a sentence is defined by the truth table PQ PPP QP QP QP Q false truefalse true falsetrue falsetrue false truefalse truefalse true falsetrue
11
11 Propositional Logic Semantics Satisfiable: true under an interpretation Valid: true under all interpretations PQ P P(P Q) Q((P Q) Q) P false true falsetruefalse true false true false true satisfiable unsatisfiable valid
12
12 Propositional Logic Semantics Model: an interpretation under which the sentence is true Q P Q PQ P Q P Q P Q PQ P Q P
13
13 Propositional Logic Semantics Entailment: KB iff every model of KB is a model of is a logical consequence of KB PQ P QP Q, P false truefalse true false truefalse true {P Q, P} Q
14
14 Propositional Logic Semantics Equivalence: iff and PQ P Q P Q false true falsetrue false true P Q P Q
15
15 Propositional Logic Semantics Theorems: – iff is valid KB can be proved by validity KB – iff is unsatisfiable KB can be proved by refutation of KB
16
16 Inference Rules Rule R: Premises: 1, 2, , n Conclusion: Soundness: R is sound iff { 1, 2, , n }
17
17 Inference Rules Modus Ponens: , -Elimination: 1 2 n i
18
18 Inference Rules -Introduction: 1, 2, …, n 1 2 … n -Introduction: i 1 2 … n
19
19 Inference Rules Double-negation elimination:
20
20 Resolution Unit resolution: P 1 … P i … P n, Q P i Q (all P i and Q are literals) P 1 … P i-1 P i+1 … P n Full resolution: P 1 … P i … P n, Q 1 … Q j … Q m P i Q j P 1 … P i-1 P i+1 … P n Q 1 … Q j-1 Q j+1 … Q m
21
21 Resolution Conjunctive normal form (CNF): conjunction of disjunctions of literals (L 11 … L 1k ) … (L n1 … L nm ) clause k-CNF: each clause contains at most k literals Every sentence can be written in CNF
22
22 Inference Algorithms To derive/assert a sentence given a knowledge base as a set of sentences Inference rules + a searching algorithm
23
23 Inference Algorithms Algorithm PL-Resolution(KB, ) input: KB and are PL sentences output: true (to assert KB ) or false (otherwise) Clauses = set of clauses in the CNF representation of KB New = {} loop for each C i, C j in Clauses do Resolvents = PL-Resolve(C i, C j ) if Resolvents contains an empty clause then return true New = New Resolvents if New Clauses then return false Clauses = Clauses New
24
24 Inference Algorithms Soundness: every deduced answer is correct if PL-Resolution returns true then KB Completeness: every correct answer is deducible if KB then PL-Resolution returns true
25
25 Inference Algorithms PL-Resolution is sound and complete Modus Ponens with any searching algorithm is not complete KB = {P Q, Q R}, = P R
26
26 Inference Algorithms Horn clause: disjunction of literals of which at most one is positive P 1 P 2 … P n Q or P 1 P 2 … P n Q Forward or backward chaining can be used for inference on Horn clauses
27
27 Satisfiability Problem SAT problem: to determine if a sentence is satisfiable (to determine if the symbols in the sentence can be assigned true/false as to make it evaluate to true) ( D B C) (B A C) ( C B E) (E D B) (B E C)
28
28 Satisfiability Problem SAT problem in propositional logic is NP-complete This does not mean all instances of PL inference has the exponential complexity Polynomial-time inference procedures for Horn clauses Many combinatorial problems in computer science can be reduced to SAT
29
29 Satisfiability Problem Backtracking algorithms Davis and Putnam (1960) Davis, Logemann, Loveland (1962)
30
30 Satisfiability Problem DPLL algorithm: –Recursive, depth-first enumeration of possible models –Early termination: a clause is true if any literal is true (A B) (A C) is true if A is true regardless of B and C –Pure symbol: has the same sign in all clauses (A B) ( B C) (C A) A model would have the literals of pure symbols assigned true Satisfied clause removal makes new pure symbols –Unit clause: has just one literal Unit clause satisfaction makes new unit clauses (unit propagation)
31
31 Satisfiability Problem Local search algorithms Evaluation function counts the number of unsatisfied clauses Randomness to escape local minima Flipping the truth value of one symbol at a time
32
32 Statisfiability Problem Algorithm WalkSAT(Clauses, p, max_flips) input: p is flipping probability, max_flips is number of flips allowed output: a model or failure Model = a random assignment of truth values to the symbols for i = 1 to max_flips do if Model satisfies Clauses then return Model C = a randomly selected clause from Clauses that is false in Model with probability p flip the value in Model of a symbol from C else flip whichever symbol in C to maximizes no. of satisfied clauses return failure
33
33 Satisfiability Problem Complexity depends on the clause/symbol ratio Hard when the ratio is from than 4.3 WalkSAT is much faster than DPLL
34
34 Inference Monotonicity Monotonicity: the set of entailed sentences can only increase when information is added to the KB if KB 1 then (KB 1 KB 2 ) Propositional logic is monotone
35
35 An Agent for the Wumpus Game Knowledge Base: X ij = column i, row j S 11 B 11 R 1 : S 11 W 11 W 12 W 21 S 21 B 21 R 2 : S 21 W 11 W 21 W 22 W 31 S 12 B 12 R 3 : S 12 W 11 W 12 W 22 W 13 R 4 : S 12 W 13 W 12 W 22 W 11
36
36 Agent for the Wumpus Game Finding the wumpus: –Modus Ponens ( S 11 + R 1 ): W 11 W 12 W 21 – -Elimination: W 11 W 12 W 21 –Modus Ponens ( S 21 + R 2 ): W 11 W 21 W 22 W 31 – -Elimination: W 11 W 21 W 22 W 31 –Modus Ponens (S 12 + R 4 ): W 13 W 12 W 22 W 11 –Unit resolution ( W 11 + W 13 W 12 W 22 W 11 ): W 13 W 12 W 22 –Unit resolution ( W 22 + W 13 W 12 W 22 ): W 13 W 12 –Unit resolution ( W 12 + W 13 W 12 ): W 13
37
37 Agent for the Wumpus Game Translating knowledge into action: A 11 East A W 21 Forward
38
38 Agent for the Wumpus Game Problems with the propositional agent: –Too many propositions to handle: "Don’t go forward if the wumpus is in front of you!" requires 16 x 4 = 64 propositions. –Hard to deal with time and change –Not expressive enough to represent or answer a question like "What action should the agent take?", …
39
39 Homework In Russell & Norvig’s AIMA (2 nd ed.): Exercises of Chapter 7.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.