Download presentation
Presentation is loading. Please wait.
1
Logical Agents Prof. Dr. Widodo Budiharto 2018
Course : Artificial Intelligence Logical Agents Prof. Dr. Widodo Budiharto 2018
2
Outline Knowledge-Based Agents The Wumpus World Logic
Propositional Logic
3
Knowledge-Based Agents
The central component of knowledge-based agent is knowledge base (KB) Knowledge base is set of “sentences” Each “sentence” expressed in a language called a knowledge representation language and represent about the world Axiom: sentence is taken as given without being derived from other sentences TELL and ASK: standard name for add new sentences to the KB and a way to query what is known
4
Knowledge-Based Agents
TELL and ASK may involve inference Inference: deriving new sentence from old sentences Obey the requirement when one ASK a question of KB Answer should follow from what has been told (TELLED) to the KB previously
5
Knowledge-Based Agents
Knowledge-based agent takes a percept as input and return an action 3 steps when an agent program is called: TELLs the knowledge base what is perceives ASKs the knowledge base what action it should perform TELLs the knowledge base which action was chosen and the agent executes the action Agents can be viewed at the knowledge level i.e., what they know, regardless of how it implemented
6
Knowledge-Based Agents
A simple knowledge-based agent
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: Encodes desired behaviors directly as program code
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 Environment
gold +1000, death -1000 -1 per step, -10 for using the arrow Environment A 4 x 4 grid rooms Agent always starts in [1,1] facing to the right The location of gold Wumpus are chosen randomly Uniform distribution Each square can be a pit with a probability 0.2
12
The Wumpus World Actuators: Sensors: (Perceive it)
Turn Left by 90˚, Turn Right by 90˚, Forward, Grab, Climb, Shoot Sensors: (Perceive it) Stench: when the agent in the adjacent squares of Wumpus Breeze: when the agent in the adjacent squares of Pit Glitter: when the agent in the square of Gold Bump: When the agent walks into a wall Scream: When the Wumpus is killed
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 formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language Semantics define the "meaning" of sentences
18
Logic Example of KRL: the language in arithmetic Syntax:
x + y = 4 is a valid sentence; x4y+=is not a valid sentence Semantics: x + y = 4 is true in a world where x is 2 and y is 2 x + y = 4 is false in a world where x is 1 and y is 1
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 After [1, 1] OK, [2,1] Breeze:
Entrapment model in [1, 2], [2, 2], [3, 1]: 3 choices of Boolean 8 possible models
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 Consequences of KB are a haystack; α is a needle. Entailment = needle in haystack; inference = finding it Soundness: i is sound if whenever KB ├i α, it is also true that KB╞ α Completeness: i is complete if whenever KB╞ α, it is also true that KB ├i α
29
Propositional Logic Propositional logic is the simplest logic
The syntax of propositional logic defines the allowable sentences The atomic sentences consists of a single proposition symbol Complex sentences are constructed from simpler sentences, using parentheses and logical connectives
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) (or). If S1 and S2 are sentences, S1 S2 is a sentence (disjunction) (implies). If S1 and S2 are sentences, S1 S2 is a sentence (implication) (if and only if). If S1 and S2 are sentences, S1 S2 is a sentence (biconditional)
31
Propositional Logic The semantic defines the rules for determining the truth of a sentence with respect to a particular model In propositional logic, a model simply fixes the truth value for every proposition symbol, I.e. P1,2 = true For complex sentences, there are five rules for any sub sentences in any model m : S1 true iff S1 false S1 S2 true and S2 true S1 S2 true or S1 S2 true unless S1 S2 S1 and S2
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. Simple recursive process evaluates an arbitrary sentence, e.g., P1,2 (P2,2 P3,1) = true (true false) = true true = true
33
Wumpus World Sentences
Let Pi,j be true if there is a pit in [i, j]. Let Bi,j be true if there is a breeze in [i, j]. P1,1 B1,1 B2,1 “Pits cause breezes in adjacent squares” B1,1 (P1,2 P2,1 ) B2,1 (P1,1 P2,2 P3,1 ) “A square is breezy if and only if there is an adjacent pit”
34
Wumpus World Sentences
35
References Widodo Budiharto. (2015). Artificial Intelligence, Andi Offset Publisher. Stuart Russell, Peter Norvig Artificial Intelligence : A Modern Approach. Pearson Education. New Jersey. ISBN:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.