Download presentation
Presentation is loading. Please wait.
Published byGavin Wright Modified over 8 years ago
1
Ch. 7 – Logical Agents Supplemental slides for CSE 327 Prof. Jeff Heflin
2
Goal-Based Agent sensors actuators Agent Environment What the world is like now What action I should do now Goals State How the world evolves What my actions do What it will be like if I do action A From Fig. 2.13, p. 52
3
Knowledge-Based Agent function KB-AGENT(percept) returns an action persistent: 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 From Figure 7.1, p. 236
4
Grammar for Propositional Logic Sentence AtomicSentence | ComplexSentence AtomicSentence True | False | Symbol Symbol P | Q | R | … ComplexSentence Sentence | (Sentence Sentence) | (Sentence Sentence) | (Sentence Sentence) | (Sentence Sentence) From Figure 7.7, p. 244
5
Checking Entailment PQR 1:PQ1:PQ 2:Q2:Q 3:QR3:QR KB: 1 2 3 PP R PRPR FFFTTTTTFT FFTTTTTTTT FTFTFFFTFT FTTTFTFTTT TFFFTTFFFF TFTFTTFFTT TTFTFFFFFF TTTTFTFFTT Assume KB={P Q, Q, Q R} Entailed! Not Entailed!
6
Inference via Model Checking function TT-ENTAILS?(KB, ) returns true or false symbols a list of the proposition symbols in KB and return TT-CHECK-ALL(KB, , symbols, {}) function TT-CHECK-ALL(KB, , symbols, model) returns true or false if EMPTY?(symbols) then if PL-TRUE?(KB, model) then return PL-TRUE?( , model) else return true else do P FIRST(symbols); rest REST(symbols) return TT-CHECK-ALL(KB, , rest, model {P=true} and TT-CHECK-ALL(KB, , rest, model {P=false}) From Figure 7.10, p. 248
7
Wumpus World Agent function HYBRID-WUMPUS-AGENT(percept) returns an action inputs: percept, a list [stench, breeze, glitter] persistent: KB, a knowledge base, containins “rules” of the Wumpus world x, y, orientation, the agent’s position visited, array of squares visited by agent, initially empty action, most recent action, initially null plan, an action sequence, initially empty update x, y, orientation, visited based on action if stench then TELL(KB, S x,y ) else TELL(KB, S x,y ) if breeze then TELL(KB, B x,y ) else TELL(KB, B x,y ) if glitter then action grab else if plan is nonempty then action POP(plan) else if for some frontier square [i,j], ASK(KB, ( P i,j W i,j )) is true or for some frontier square [i,j], ASK(KB, (P i,j W i,j )) is false then do plan A*-GRAPH-SEARCH(ROUTE-PROBLEM([x,y], orientation, [i,j], visited)) action POP(plan) else action a randomly chosen move return action Simplified version of agent described Figure 7.20, p. 270
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.