Professional Documents
Culture Documents
Logical Agents
Session 05
1
Learning Outcomes
At the end of this session, students will be able to:
• LO 3: Explain various intelligent search algorithms to solve
the problems
• LO 4: Explain how to use knowledge representation in
reasoning purpose
2
Outline
1. Knowledge-Based Agents
2. The Wumpus World
3. Logic
4. Propositional Logic
3
Knowledge-Based Agents
• The central component of knowledge-based agent is
knowledge base (KB)
• Knowledge base is set of “sentences”
5
Knowledge-Based Agents
• Knowledge-based agent takes a percept as input and return
an action
• 3 steps when an agent program is called:
7
Knowledge-Based Agents
• 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
8
Knowledge-Based Agents
Building a Knowledge-Based Agent
• Declarative approach:
– TELLing it what it need to know, starting with an empty
knowledge base then the agent designer can TELL
sentences one by one until agent knows how to operate
in its environment
• Procedural approach:
9
Knowledge-Based Agents
• A successful agent often combines both declarative and
procedural elements in its design
• The declarative knowledge can often be compiled into
more efficient procedural code
10
The Wumpus World
11
The Wumpus World
• Performance measure
– gold +1000, death -1000
• Environment
– A 4 x 4 grid rooms
12
The Wumpus World
• Actuators:
– Turn Left by 90˚, Turn Right by 90˚, Forward, Grab, Climb,
Shoot
13
The Wumpus World
• A = Agent
• B = Breeze
• G = Glitter, Gold
• OK = Safe square
• P = Pit
• S = Stench
• V = Visited
• W = Wumpus
14
The Wumpus World
• A = Agent
• B = Breeze
• G = Glitter, Gold
• OK = Safe square
• P = Pit
• S = Stench
• V = Visited
• W = Wumpus
15
The Wumpus World
• A = Agent
• B = Breeze
• G = Glitter, Gold
• OK = Safe square
• P = Pit
• S = Stench
• V = Visited
• W = Wumpus
16
The Wumpus World
• A = Agent
• B = Breeze
• G = Glitter, Gold
• OK = Safe square
• P = Pit
• S = Stench
• V = Visited
• W = Wumpus
17
Logic
• In standard logics, every sentence must be either true or
false in each possible world—there is no “in between.”
• Logics
• Semantics
19
Logic
• Possible world = model
– Informally, we may think of a possible world as, for example,
having x men and y women sitting at a table playing bridge, and
the sentence x + y = 4 is true when
• There are four people in total
– Formally, the possible models are just all possible
assignments of real numbers to the variables are x and y
• If a sentence A is true in model m, we say that m satisfies A or
sometimes m is a model of A
• We use the notation of M(A) to mean the set of all models of A
20
Logic
• Entailment means that one thing follows from
another (a fact can be drawn from (collection) other
fact
• KB ╞ α : Knowledge base KB entails sentence α if and
only if α is true in all worlds where KB is true
• KB ╞ α iff M(KB) M(α)
21
Logic
• Example:
– KB containing sentences “the Giants won” and “the
Reds won” entails “Either the Giants won or the
Reds won”
– x+y = 4 entails 4 = x+y
• Entailment is a relationship between sentences
(syntax) that is based on semantics
22
Logic
• Entailment in Wumpus World
23
Logic
• Entailment in Wumpus World
24
Logic
• Entailment in Wumpus World
25
Logic
• Entailment in Wumpus World
26
Logic
• Entailment in Wumpus World
27
Logic
• Entailment in Wumpus World
28
Inference in Logic
• KB ├i α = sentence α can be derived from KB by procedure i
29
Propositional Logic
• Propositional logic is the simplest logic
30
Propositional Logic
• There are five connectives in common use
– (not). If S is a sentence, S is a sentence (negation)
– (and). If S1 and S2 are sentences, S1 S2 is a sentence
(conjunction)
• For complex sentences, there are five rules for any sub
sentences in any model m :
S1 true iff S1 false
S1 S2 true iff S1 true and S2 true
S1 S2 true iff S1 true or S2 true
S1 S2 true S1 true and S2 false
unless 32
Propositional Logic
• The rules can also be expressed with truth tables that
specify the truth value of a complex sentence for each
possible assignment of truth values to its components.
33
Wumpus World Sentences
• Let Pi,j be true if there is a pit in [i, j].
– P1,1
– B1,1
– B2,1
35
References
• Stuart Russell, Peter Norvig. 2010. Artificial Intelligence :
A Modern Approach. Pearson Education. New Jersey.
ISBN:9780132071482
36