CHAPTER 7. LOGICAL AGENT
-
Upload
joelle-harmon -
Category
Documents
-
view
23 -
download
0
description
Transcript of CHAPTER 7. LOGICAL AGENT
![Page 1: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/1.jpg)
Inha University
Intelligent E-Commerce Systems Lab
CHAPTER 7.
LOGICAL AGENT
석사 1 차 지 애 띠
![Page 2: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/2.jpg)
Intelligent E-Commerce Systems Lab
OUTLINE
KNOWLEDGE-BASED AGENTS
THE WUMPUS WORLD
LOGIC
PROPOSITIONAL LOGIC
AGENT BASED ON PROPOSITIONAL LOGIC
![Page 3: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/3.jpg)
Intelligent E-Commerce Systems Lab
KNOWLEDGE-BASED AGENTS
Knowledge Base - a set of representations of facts about the
world - a set of sentences that is expressed in a knowledge representation language
Knowledge-Based Agent deriving new
sentence from old one
Knowledge base
Inference engine
![Page 4: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/4.jpg)
Intelligent E-Commerce Systems Lab
KNOWLEDGE-BASED AGENTS Outline of a knowledge-Based Agent
First, it TELLs the KB what it perceives (a way to add new sentences to the KB) Second, it ASKs the KB what action it should perform (a way to query what is known)
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
![Page 5: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/5.jpg)
Intelligent E-Commerce Systems Lab
THE WUMPUS WORLD Performance measure Environment Actuators – turn left, turn right, die, forward, grab, shoot Sensors
the agent will perceive a stench in the square containing the wumpus and the directly adjacent squares
the agent will perceive a breeze in the squares directly adjacent to a pit
the agent will perceive a glitter in the square where the gold is
the agent will perceive a bump when it walks into a wall the agent will perceive a scream anywhere in the cave when t
he wumpus is killed.
![Page 6: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/6.jpg)
Intelligent E-Commerce Systems Lab
THE WUMPUS WORLD
B = Breeze
G = Glitter, Gold
OK = Safe square
P = Pit
S = Stench
V = Visited
W = Wumpus
A = Agent
![Page 7: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/7.jpg)
Intelligent E-Commerce Systems Lab
THE WUMPUS WORLD
1, 4
1, 3
1, 2
1, 1
2, 4
2, 3
2, 2
2, 1
3, 4
3, 3
3, 2
3, 1
4, 4
4, 3
4, 2
4, 1
B = Breeze
G = Glitter, Gold
OK = Safe square
P = Pit
S = Stench
V = Visited
W = Wumpus
A = Agent
AOK OK
OK
V B
P?
P?P!
OKS
W!
V
S G V
V
P?
P?
V
![Page 8: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/8.jpg)
Intelligent E-Commerce Systems Lab
LOGIC
Logic
formal language for provided the syntax and semantics are defined precisely
Syntax - the sentences in the language ex) x y
Semantics - the “meaning” of sentences ex) x y is false when y is bigger than x,
and true otherwise Model – possible world
![Page 9: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/9.jpg)
Intelligent E-Commerce Systems Lab
LOGIC
KB : “KB entails ”KB entails sentence if and only if is true in all worlds
where KB is true
KB : “ is derived from KB by i” or “i derives from KB”
Soundness i is sound if whenever KB , it is also true that KB
Completeness i is complete if whenever KB , it is also true that KB
i
i
i
![Page 10: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/10.jpg)
Intelligent E-Commerce Systems Lab
PROPOSITIONAL LOGIC : Syntax
Logical constant : True or False Logical connective → ∧ | ∨ | ⇒ | ⇔| ㄱ
BNF(Bacus-Naur Form) Sentence AtomicSentence | ComplexSentence AtomicSentence True | False | Symbol Symbol P | Q | R | …
ComplexSentence ㄱ Sentence | Sentence ∧ Sentence | Sentence ∨ Sentence | Sentence ⇒ Sentence
| Sentence ⇔ Sentence
![Page 11: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/11.jpg)
Intelligent E-Commerce Systems Lab
PROPOSITIONAL LOGIC : Semantics Truth Table
Equivalence, Validity, & Satisfiability Two sentences are equivalence if they are true in the s
ame set of models A sentence is valid if it it true in all models A sentence is satisfiable if it is true in some model A sentence is unsatisfiable if it is true in no models
P QFalse False
TrueFalseFalseTrue
True True
ㄱ P P Q∧ P Q∨ P Q⇒ P⇔Q
FalseFalse
FalseFalseFalse
False
False FalseFalse
TrueTrue
True
TrueTrueTrue True True
TrueTrueTrue
![Page 12: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/12.jpg)
Intelligent E-Commerce Systems Lab
PROPOSITIONAL LOGIC : Inference Modus Ponens (=Implication-Elimination)
And-Elimination
Double-Negation Elimination
Unit Resolution
Resolution
α β, α ⇒β
α1 α2 α3 ... αn ∧ ∧ ∧ ∧αi
ㄱㄱ α α
α β, ∨ ㄱ β α
α β, ∨ ㄱ β∨γ α γ∨
ㄱ α β, β γ ⇒ ⇒ㄱ α γ⇒=
![Page 13: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/13.jpg)
Intelligent E-Commerce Systems Lab
AGENT BASED ON PROPOSITIONAL LOGIC Current state
ㄱ S1,1 ㄱ S2,1 S1,2
ㄱ B1,1 B2,1 ㄱ B1,2
Rules R1 ㄱ S1,1⇒ ㄱ W1,1∧ ㄱ W1,2∧ ㄱ W2,1
R2 ㄱ S2,1⇒ ㄱ W1,1∧ ㄱ W2,1∧ ㄱ W2,2∧ ㄱ W3,1
R3 S1,2⇒ W1,3∨W1,2∨W2,2∨W1,1
2,1 B V OK
1,1 V OK
1,2 A S OK
1,3 W!
1,4
2,2 OK
2,3
2,4
3,1 P!
3,2
3,3
3,4
4,1
4,2
4,3
4,4
![Page 14: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/14.jpg)
Intelligent E-Commerce Systems Lab
AGENT BASED ON PROPOSITIONAL LOGIC 1. Modus Ponens & And-Elimination : ㄱ S1,1 & R1 ㄱ W1,1 ㄱ W1,2 ㄱ W2,1 2. Modus Ponens & And-Elimination : ㄱ S2,1 & R2 ㄱ W2,2 ㄱ W2,1 ㄱ W3,1 3. Modus Ponens : S1,2 & R4 W1,3∨W1,2∨W2,2∨W1,1 4. Unit Resolution α : W1,3∨W1,2∨W2,2 β : W1,1 ( ㄱ W1,1 from 1) W1,3∨W1,2∨W2,2 5. Unit Resolution α : W1,3∨W1,2∨W2,2 β : W2,2 ( ㄱ W2,2 from 2) W1,3∨W1,2 6. nit Resolution α : W1,3∨W1,2 β : W1,2 ( ㄱ W1,2 from 2) W1,3
![Page 15: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/15.jpg)
Intelligent E-Commerce Systems Lab
AGENT BASED ON PROPOSITIONAL LOGIC Finding pits and wumpuses using logical inference
A knowledge base that states the “physics” of the wumpus world : ㄱ P1,1 and ㄱ W1,1
Bx,y ⇔ (Px,y+1 ∨ Px,y-1 ∨ Px+1,y ∨ Px-1,y) Sx,y ⇔ (Wx,y+1 ∨ Wx,y-1 ∨ Wx+1,y ∨ Wx-1,y) W1,1 ∨ W1,2 ∨ … ∨ W4,3 ∨ W4,4 - at least one To say that there in at most one wumpus, we needs a total of
155 sentences containing 64 distinct symbols
Keeping track of location and orientation Lx,y ∧ FacingRightt ∧ Forwardt ⇒ Lt+1
x+1,y Propositions need to depend on time If a agent moves 100 steps, it needs 6400 rules
![Page 16: CHAPTER 7. LOGICAL AGENT](https://reader036.fdocument.pub/reader036/viewer/2022072016/568131f7550346895d985447/html5/thumbnails/16.jpg)
Intelligent E-Commerce Systems Lab
SUMMARY
Propositional Logic Syntax : formal structure of sentences Semantics : truth of sentences Validity & Inference
Problems of propositional logic In First-order logic, 6400 propositional rules
1