0% found this document useful (0 votes)
62 views27 pages

Artificial Intelligence (CSE) Unit-Ii: 2.1.1 Logical Agents

The document discusses knowledge-based agents and logical agents. It provides details on: 1. Knowledge-based agents have an explicit knowledge base that can be reasoned with using inference systems. The knowledge base contains representations of facts, and the agent operates by incorporating new perceptions, updating its internal representations, and deducing appropriate actions. 2. Logical agents use logics and formal languages to represent information such that conclusions can be drawn. Propositional logic uses atomic and compound propositions combined with logical connectives, and semantics define the truth of sentences in different models or worlds. 3. The Wumpus world is given as an example environment, where the goal of the agent is to find gold and escape without being

Uploaded by

str
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views27 pages

Artificial Intelligence (CSE) Unit-Ii: 2.1.1 Logical Agents

The document discusses knowledge-based agents and logical agents. It provides details on: 1. Knowledge-based agents have an explicit knowledge base that can be reasoned with using inference systems. The knowledge base contains representations of facts, and the agent operates by incorporating new perceptions, updating its internal representations, and deducing appropriate actions. 2. Logical agents use logics and formal languages to represent information such that conclusions can be drawn. Propositional logic uses atomic and compound propositions combined with logical connectives, and semantics define the truth of sentences in different models or worlds. 3. The Wumpus world is given as an example environment, where the goal of the agent is to find gold and escape without being

Uploaded by

str
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Artificial Intelligence (CSE)

UNIT-II
2.1.1 Logical Agents:
Knowledge-based agents – agents that have an explicit representation of knowledge that can be
reasoned with.
These agents can manipulate this knowledge to infer new things at the “knowledge level”

A Knowledge Based Agent


 A knowledge-based agent includes a knowledge base and an inference system.
 A knowledge base is a set of representations of facts of the world.
 Each individual representation is called a sentence.
 The sentences are expressed in a knowledge representation language.
 The agent operates as follows:
1. It TELLs the knowledge base what it perceives.
2. It ASKs the knowledge base what action it should perform.
3. It performs the chosen action.

Architecture of Knowledge based agent:


Knowledge Level.
 The most abstract level: describe agent by saying what it knows.
 Example: A taxi agent might know that the Golden Gate Bridge connects San Francisco
with the Marin County.
Logical Level.
 The level at which the knowledge is encoded into sentences.
 Example: Links(GoldenGateBridge, SanFrancisco, MarinCounty).
Implementation Level.
 The physical representation of the sentences in the logical level.
 Example: ‘(links goldengatebridge sanfrancisco marincounty)

Knowledge Bases:

 Knowledge base = set of sentences in a formal language


 Declarative approach to building an agent (or other system):
Tell it what it needs to know
 Then it can Ask itself what to do - answers should follow from the KB
 Agents can be viewed at the knowledge level - i.e., what they know, regardless of how
implemented
 Or at the implementation level
i.e., data structures in KB and algorithms that manipulate them

A Simple Knowledge Based Agent

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

The Wumpus world environment


 The Wumpus computer game
 The agent explores a cave consisting of rooms connected by passageways.
 Lurking somewhere in the cave is the Wumpus, a beast that eats any agent that enters its
room.
 Some rooms contain bottomless pits that trap any agent that wanders into the room.
 Occasionally, there is a heap of gold in a room.
 The goal is to collect the gold and exit the world without being eaten

A Wumpus World
A Wumpus World PEAS description
Performance measure:
 gold +1000, death -1000
 -1 per step, -10 for using the arrow

Environment: 4 x 4 grid of rooms


 Squares adjacent to wumpus are smelly
 Squares adjacent to pit are breezy
 Glitter iff gold is in the same square
 Shooting kills wumpus if you are facing it
 Shooting uses up the only arrow
 Grabbing picks up gold if in same square
 Releasing drops the gold in same square

Actuators: Left turn, Right turn, Forward, Grab, Release, Shoot

Sensors: Stench, Breeze, Glitter, Bump, Scream (shot Wumpus)

Agents in a Wumpus World: Percepts


The agent perceives
 a stench in the square containing the wumpus and in the adjacent squares (not diagonally)
 a breeze in the squares adjacent to a pit
 a glitter in the square where the gold is
 a bump, if it walks into a wall
 a woeful scream everywhere in the cave, if the wumpus is killed
The percepts are given as a five-symbol list. If there is a stench and a breeze, but no glitter, no
bump, and no scream, the percept is [Stench, Breeze, None, None, None]

Percepts given to the agent


 Stench
 Breeze
 Glitter
 Bumb (ran into a wall)
 Scream (wumpus has been hit by arrow)

Principle Difficulty: Agent is initially ignorant of the configuration of the environment – going
to have to reason to figure out where the gold is without getting killed!

Wumpus World Actions


 go forward
 turn right
 turn left
 grab: Pick up an object that is in the same square as the agent
 shoot: Fire an arrow in a straight line in the direction the agent is facing. The arrow
continues until it either hits and kills the wumpus or hits the outer wall. The agent has
only one arrow, so only the first Shoot action has any effect
 climb is used to leave the cave. This action is only effective in the start square
 die: This action automatically and irretrievably happens if the agent enters a square with
a pit or a live wumpus

Wumpus goal:
The agent’s goal is to find the gold and bring it back to the start square as quickly as possible,
without getting killed
 1000 points reward for climbing out of the cave with the gold
 1 point deducted for every action taken
 10000 points penalty for getting killed

Note that in each case for which the agent draws a conclusion from the available information,
that conclusion is guaranteed to be correct if the available information is correct. This is a
fundamental property of logical reasoning.
The Wumpus Agent First Step

Later

Let’s Play
Wumpus World Characterization:
 Fully Observable: No – only local perception
 Deterministic: Yes – outcomes exactly specified
 Episodic: No – sequential at the level of actions
 Static : Yes – Wumpus and Pits do not move
 Discrete: Yes
 Single-agent: Yes – Wumpus is essentially a natural feature

2.1.2 Logic in general:


 Logics are formal languages for representing information such that conclusions can be
drawn
 Syntax defines how symbols can be put together to form the sentences in the language
 Semantics define the "meaning" of sentences;
o i.e., define truth of a sentence in a world (given an interpretation)
o E.g., the language of arithmetic
o x+2 ≥ y is a sentence; x2+y > {} is not a sentence
o x+2 ≥ y is true iff the number x+2 is no less than the number y
o x+2 ≥ y is true in a world where x = 7, y = 1
o x+2 ≥ y is false in a world where x = 0, y = 6

Propositional Logic:
Propositional logic (PL) is the simplest form of logic where all the statements are made by
propositions. A proposition is a declarative statement which is either true or false. It is a
technique of knowledge representation in logical and mathematical form. Propositions can be
either true or false, but it cannot be both. Propositional logic is also called Boolean logic as it
works on 0 and 1.
Examples:
Today is Tuesday.
The Sun rises from West (False proposition)
2+2= 5(False proposition)
2+3= 5

Syntax of Propositional Logic:


The syntax of propositional logic defines the allowable sentences. The atomic sentences consist
of a single proposition symbol. Each such symbol stands for a proposition that can be true or
false. We use symbols that start with an uppercase letter and may contain other letters or
subscripts.
Example: P, Q, R, W1, 3 and North.
The names are arbitrary but are often chosen to have some mnemonic value—we use W1,3 to
stand for the proposition that the wumpus is in [1,3]. There are two proposition symbols with
fixed meanings:
True is the always-true proposition and
False is the always-false proposition.
Complex sentences are constructed from simpler sentences, using parentheses and logical
connectives.

In propositional logic there are two types of propositions. They are:


1. Atomic Propositions
2. Compound Propositions
Atomic Proposition: Atomic propositions are the simple propositions. It consists of a single
proposition symbol. These are the sentences which must be either true or false.
Ex: The sun rises from west . (False Atomic Propositions)
The sun rises from east (True Atomic Propositions)
Compound proposition: Compound propositions are constructed by combining simpler or
atomic propositions, using parenthesis and logical connectives.
Ex: Arsalan is an engineer and arsalan lives in dubai.
Arsalan is an engineer or arsalan is a doctor.

Propositional logic is the simplest logic – illustrates basic ideas


The proposition symbols P1, P2 etc are (atomic) sentences
 If S is a sentence, (S) is a sentence (negation)
 If S1 and S2 are sentences, (S1  S2) is a sentence (conjunction)
 If S1 and S2 are sentences, (S1  S2) is a sentence (disjunction)
 If S1 and S2 are sentences, (S1  S2) is a sentence (implication)
 If S1 and S2 are sentences, (S1  S2) is a sentence (biconditional)

Truth Table for connectives

Examples of Connectives:
(P ∧ Q) Arsalan likes football and Arsalan likes baseball.
(P ∨ Q) Arsalan is a doctor or Arsalan is an engineer.
(P ⇒ Q) If it is raining, then the street is wet.
(P ⇔ Q) I am breathing if and only if I am alive

Precedence of Connectives:
To eliminate the ambiguity we define a precedence for each operator. The “not” operator (¬)
has the highest precedence, followed by ∧ (conjunction), ∨(disjunction),⇒(implication),⇔
(biconditional).
Example:¬A ∧ B the ¬ binds most tightly, giving us the equivalent of (¬A)∧B rather than ¬
(A∧B)

Semantics of Propositional Logic:


Each model specifies true/false for each proposition symbol
E.g. A B C
false true false
With these symbols, 8 possible models, can be enumerated automatically.
Rules for evaluating truth with respect to a model m:
S is true iff S is false
S1  S2 is true iff S1 is true and S2 is true
S1  S2 is true iff S1is true or S2 is true
S1  S2 is true iff S1 is false or S2 is true
i.e., is false iff S1 is true and S2 is false
S1  S2 is true iff S1S2 is true andS2S1 is true
Simple recursive process evaluates an arbitrary sentence,
e.g., A (B  C ) = true  (true  false) = true  true = true

Limitations of Propositional Logic:


We cannot represent relations like All, some, or none with propositional logic.
Examples:
All boys are smart.
All girls are hardworking.
Some mangoes are sweet.
Propositional logic has limited expressive power and in propositional logic, we cannot describe
statements in terms of their properties or logical relationships.

2.1.3 First Order Logic (FOL):


Propositional logic assumes the world contains facts whereas first-order logic (like natural
language) assumes the world contains
 Objects: people, houses, numbers, colors, baseball games, wars, …
 Relations: red, round, prime, brother of, bigger than, part of, comes between, …
 Functions: father of, best friend, one more than, plus, …

Syntax of FOL:
 Constants KingJohn, 2,...
 Predicates Brother, >,...
 Functions Sqrt, ...
 Variables x, y, a, b,...
 Connectives , , , , 
 Equality =
 Quantifiers , 

Logics in general:
Ontological Commitment:
 What exists in the world — TRUTH
 PL : facts hold or do not hold.
 FOL : objects with relations between them that hold or do not hold

 Constant Symbols:
▪ Stand for objects
▪ e.g., KingJohn, 2,...
 Predicate Symbols
▪ Stand for relations
▪ e.g., Brother(Richard, John), greater_than(3,2)...
 Function Symbols
▪ Stand for functions
▪ e.g., Sqrt(3) ...
Relations:
 Some relations are properties: they state
 some fact about a single object:
Round(ball), Prime(7).
 n-ary relations state facts about two or more objects:
Married(John,Mary), LargerThan(3,2).
 Some relations are functions: their value is another object: Plus(2,3), Father(Dan).

Terms:
 Term = logical expression that refers to an object.
 There are 2 kinds of terms:
o constant symbols: Table, Computer
o function symbols: Sqrt(3), Plus(2,3) etc
 Functions can be nested:
o Pat_Grandfather(x) = father(father(x))
 Terms can contain variables.
 No variables = ground term.

Atomic Sentence:
Atomic sentences are the most basic sentences of first-order logic. These sentences are formed
from a predicate symbol followed by a parenthesis with a sequence of terms.
Atomic sentence = predicate (term1,...,termn)
Atomic sentences state facts using terms and predicate symbols P(x,y) interpreted as “x is P of y”
Examples: LargerThan(2,3) is false.
Married(Father(Richard), Mother(John)) could be true or false

Complex Sentence:
Complex sentences are made from atomic sentences using connectives
S, S1  S2, S1  S2, S1  S2, S1  S2,

E.g. Sibling(KingJohn,Richard)  Sibling(Richard,KingJohn)


Complex sentences are made by combining atomic sentences using connectives.We make
complex sentences with connectives (just like in propositional logic).

Some more examples:


1. Brother(Richard, John)  Brother(John, Richard)
2. King(Richard)  King(John)
3. King(John) =>  King(Richard)

Note: Semantics are the same as in propositional logic

Variables:
 Person(John) is true or false because we give it a single argument ‘John’
 We can be much more flexible if we allow variables which can take on values in a
domain. e.g., all persons x, all integers i, etc.
o E.g., can state rules like Person(x) => HasHead(x)
o or Integer(i) => Integer(plus(i,1)

Quantifiers in First Order Logic:


A quantifier is a language element which generates quantification, and quantification specifies
the quantity of specimen in the universe of discourse. These are the symbols that permit to
determine or identify the range and scope of the variable in the logical expression. There are two
types of quantifier:
1. Universal Quantifier, (for all, everyone, everything)
2. Existential quantifier, (for some, at least one).
Universal Quantifier:
Universal quantifier is a symbol of logical representation, which specifies that the statement
within its range is true for everything or every instance of a particular thing. The Universal
quantifier is represented by a symbol ∀, which resembles an inverted A.
If x is a variable, then ∀x is read as:
 For all x
 For each x
 For every x.

Example:
All man drink coffee.
∀x man(x) → drink (x, coffee).
It will be read as: There are all x where x is a man who drink coffee.

Note: In universal quantifier we use implication "→".

Existential Quantifier:
Existential quantifiers are the type of quantifiers, which express that the statement within its
scope is true for at least one instance of something.It is denoted by the logical operator ∃, which
resembles as inverted E. When it is used with a predicate variable then it is called as an
existential quantifier.
If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:
 There exists a 'x.'
 For some 'x.'
 For at least one 'x.'
Example:
Some boys are intelligent.
∃x: boys(x) ∧ intelligent(x)
It will be read as: There are some x where x is a boy who is intelligent.

Note:
 In Existential quantifier we always use AND or Conjunction symbol (∧).
 The main connective for universal quantifier ∀ is implication →.
 The main connective for existential quantifier ∃ is and ∧.

Properties of Quantifiers:
 In universal quantifier, ∀x∀y is similar to ∀y∀x.
 In Existential quantifier, ∃x∃y is similar to ∃y∃x.
 ∃x∀y is not similar to ∀y∃x
Some Examples of FOL using quantifier:
1. All birds fly.
In this question the predicate is "fly(bird)." Since there are all birds who fly so it will be
represented as follows. ∀x bird(x) →fly(x)
.
2. Every man respects his parent.
In this question, the predicate is "respect(x, y)," where x=man, and y= parent. Since there is
every man so will use ∀, and it will be represented as follows: ∀x man(x) → respects (x, parent).

3. Some boys play cricket.


In this question, the predicate is "play(x, y)," where x= boys, and y= game. Since there are
some boys so we will use ∃, and it will be represented as: ∃x boys(x) → play(x, cricket).

4. Not all students like both Mathematics and Science.


In this question, the predicate is "like(x, y)," where x= student, and y= subject. Since there
are not all students, so we will use ∀ with negation, so following representation for this:
¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)].

5. Only one student failed in Mathematics


In this question, the predicate is "failed(x, y)," where x= student, and y= subject. Since there
is only one student who failed in Mathematics, so we will use following representation for this:
∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧ student(y) → ¬failed (x,
Mathematics)].

2.1.4 Inference Techniques in Logical Agents


Inference: In artificial intelligence, we need intelligent computers which can create new logic
from old logic or by evidence, so generating the conclusions from evidence and facts is termed
as Inference.
Techniques:
 Forward Chaining
 Backward Chaining
 Resolution

Forward chaining: Forward chaining is the process where it matches the set of conditions and
infer results from these conditions. It is data driven approach using which it reaches (infers) to
the goal condition.
Example: Given A (is true)
B->C
A->B
C->D
Prove D is also true.
Solution: Starting from A, A is true then B is true (A->B)
B is true then C is true (B->C)
C is true then D is true Proved (C->D)

Backward chaining: Backward chaining is the process where it performs backward search from
goal to the conditions used to get the goal. It is goal driven approach using which it reaches to
the initial condition.
Example: Given A (is true)
B->C
A->B
C->D
Prove D is also true.
Solution: Starting from D,
Let D is true then C is true (C->D)
C is true then B is true (B->C)
B is true then A is true Proved (A->B)
2.1.5 Resolution in FOL:
Resolution is a theorem proving technique that proceeds by building refutation proofs, i.e.,
proofs by contradictions. It was invented by a Mathematician John Alan Robinson in the year
1965.Resolution is used, if there are various statements are given, and we need to prove a
conclusion of those statements. Unification is a key concept in proofs by resolutions. Resolution
is a single inference rule which can efficiently operate on the conjunctive normal form or clausal
form.
 Clause: Disjunction of literals (an atomic sentence) is called a clause. It is also known as
a unit clause.
 Conjunctive Normal Form: A sentence represented as a conjunction of clauses is said
to be conjunctive normal form or CNF.

Steps in Resolution:
 Conversion of facts into first-order logic.
 Negate the statement which needs to prove (proof by contradiction)
 Convert FOL statements into CNF
 Draw resolution graph (unification).

To better understand all the above steps, we will take an example in which we will apply
resolution.
Example:
Facts:
All peoples who are graduating are happy
All happy people smile
Some one is graduating
Prove that “Is someone smiling?” using resolution

1. Conversion of Facts into first order logic:


 All peoples who are graduating are happy
∀x(Graduating(x) ⇒ happy(x))
 All happy people smile
∀x(happy(x) ⇒ smile(x))
 Some one is graduating
∃x graduating(x)
 “Is someone smiling”
∃x smile(x)

2. Negate the statement which needs to prove (proof by contradiction)


 We need to proof “Is someone smiling”.
 So negate the statement (proof by contradiction)
¬ ∃x smile(x)
3. Convert FOL statements into CNF
Steps to convert FOL to CNF
 Eliminate Implication
 Standardize variable
 Move Negation inwards
 Skolemization
 Drop Universal Quantifier

Eliminate Implication
α⇒β≡¬α∨β
α ⇔ β ≡ (α ⇒ β) ∧ (β ⇒ α )
Example:
Eliminate Implication: α⇒β≡¬α∨β
 ∀x(¬ Graduating(x) ∨ happy(x))
 ∀x(¬happy(x) ∨ smile(x))
 ∃x graduating(x)
 ¬∃x smile(x)

Standardize variable
∀x regular(x) ∀x regular(x)
∃x busy(x) ∃y busy(y)
∃x attentive(x) ∃z attentive(z)

Example:
 ∀x(¬ Graduating(x) ∨ happy(x))
 ∀y(¬happy(y) ∨ smile(y))
 ∃z graduating(z)
 ¬ ∃w smile(w)

Move Negation inwards


 ¬ (∀x P(x)) ≡ ∃x ¬P(x)
 ¬ (∃ x P(x)) ≡ ∀x ¬P(x)
 ¬ (α ∨ β) ≡ ¬ α ∧ ¬ β
 ¬ (α ∧ β) ≡ ¬ α ∨ ¬ β
 ¬ (¬ α) ≡ α

Example:
 ∀x(¬ Graduating(x) ∨ happy(x))
 ∀y(¬happy(y) ∨ smile(y))
 ∃z graduating(z)
 ∀w ¬ smile(w)

Skolemization: Removing of Existential Quantifier and replacing it by Skolem Constants


∃(y) busy(y)
∃(x) attentive(x)
After Skolemization it changes into:
busy(A)
attentive(B)

Example:
∀x(¬ Graduating(x) ∨ happy(x))
∀y(¬happy(y) ∨ smile(y))

After Skolemization it changes into:


graduating(A)
∀w ¬ smile(w)

Drop Universal Quantifier:


∀(y) busy(y)
∀(x) attentive(x)
After dropping it changes into:
busy(y)
attentive(x)
Example:
 ¬ Graduating(x) ∨ happy(x)
 ¬happy(y) ∨ smile(y)
 graduating(A)
 ¬ smile(w)
Now the sentences are in CNF

4. Resolution Graph
 If fact F is to be proved then it start with ¬F
 It contradicts all other rules in KB
 The process stop when it returns Null clause

Example:
 ¬ Graduating(x) ∨ happy(x)
 ¬happy(y) ∨ smile(y)
 graduating(A)
 ¬ smile(w)

Resolution Graph:
2.2.1 Semantic Network:
Semantic nets were originally proposed in the early 1960 by M. Ross Quillian to represent the
meaning of English words. Semantic networks are alternative of predicate logic for knowledge
representation. In Semantic networks, we can represent our knowledge in the form of graphical
networks. This network consists of nodes representing objects and arcs which describe the
relationship between those objects. Semantic networks can categorize the object in different
forms and can also link those objects. Semantic networks are easy to understand and can be
easily extended.
Representation:
Semantic network representation consists of mainly two types of relations:
1. IS-A relation (Inheritance)
2. Kind-of-relation
Example 1: Following are some statements which we need to represent in the form of nodes and
arcs.

Example 2:
Statements
 Jerry is a cat.
 Jerry is a mammal
 Jerry is owned by Priya.
 Jerry is white colored.
 All Mammals are animal.

Advantages of Semantic Networks:


 Semantic networks are a natural representation of knowledge.
 Semantic networks convey meaning in a transparent manner because it is easy to
visualize and understand
 These networks are simple and easily understandable.
 The knowledge engineer can arbitrarily defined the relationships.
 Related knowledge is easily categorised.
 Efficient in space requirements.
 Node objects represented only once.

Limitations of Semantic Networks:


 The limitations of conventional semantic networks were studied extensively by a number
of workers in AI.
 Semantic networks take more computational time at runtime as we need to traverse the
complete network tree to answer some questions.
 It might be possible in the worst case scenario that after traversing the entire tree, we find
that the solution does not exist in this network.
 Semantic networks try to model human-like memory (Which has 1015 neurons and links)
to store the information, but in practice, it is not possible to build such a vast semantic
network.
 These types of representations are inadequate as they do not have any equivalent
quantifier, e.g., for all, for some, none, etc.
 Many believe that the basic notion is a powerful one and has to be complemented by, for
example, logic to improve the notion’s expressive power and robustness.
 Others believe that the notion of semantic networks can be improved by incorporating
reasoning used to describe events.
 Binary relations are usually easy to represent, but sometimes is difficult.
E.g. try to represent the sentence:
"Jack caused trouble to the party".

 Other problematic statements. . .


o negation "John does not go fishing";
o disjunction "John eats pizza or fish and chips";
o …
 Quantified statements are very hard for semantic nets. E.g.:
o "Every dog has bitten a delivery boy"
o "Every dog has bitten every delivery boy"

Solution: Partitioned semantic networks can represent quantified statements.

Partitioned Semantic Networks:


Hendrix developed the so-called partitioned semantic network to represent the difference
between the description of an individual object or process and the description of a set of objects.
The set description involves quantification. Hendrix partitioned a semantic network whereby a
semantic network, loosely speaking, can be divided into one or more networks for the description
of an individual.
The central idea of partitioning is to allow groups, nodes and arcs to be bundled together into
units called spaces – fundamental entities in partitioned networks, on the same level as nodes and
arcs. Every node and every arc of a network belongs to (or lies in/on) one or more spaces.Some
spaces are used to encode 'background information' or generic relations; others are used to deal
with specifics called 'scratch' space.
Suppose that we wish to make a specific statement about a dog, Danny, who has bitten a delivery
boy, Peter:
"Danny the dog bit Jack the delivery boy"
Hendrix’s Partitioned network would express this statement as an ordinary semantic network:

Suppose that we now want to look at the statement:


"Every dog has bitten a delivery boy"

Hendrix partitioned semantic network now comprises two partitions SA and S1. Node G is an
instance of the special class of general statements about the world comprising link statement,
form, and one universal quantifier

Suppose that we now want to look at the statement:


"Every dog has bitten every delivery boy"
Suppose that we now want to look at the statement:
"Every dog in town has bitten the delivery boy"

Note: 'ako' = 'A Kind Of'

The partitioning of a semantic network renders them more logically adequate, in that one can
distinguish between individuals and sets of individuals and indirectly more heuristically adequate
by way of controlling the search space by delineating semantic networks.

Hendrix's partitioned semantic networks-oriented formalism has been used in building natural
language front-ends for data bases and for programs to deduct information from databases.

2.2.2 Frames:
A frame is a record like structure which consists of a collection of attributes and its values to
describe an entity in the world. A frame is analogous to a record structure, corresponding to the
fields and values of a record are the slots and slot fillers of a frame

Frames are the AI data structure which divides knowledge into substructures by representing
stereotypes situations. It consists of a collection of slots and slot values. These slots may be of
any type and sizes. Slots have names and values which are called facets.

Facets: The various aspects of a slot is known as Facets. Facets are features of frames which
enable us to put constraints on the frames.
Example: IF-NEEDED facts are called when data of any particular slot is needed.

A frame may consist of any number of slots, and a slot may include any number of facets and
facets may have any number of values. A frame is also known as slot-filter knowledge
representation in artificial intelligence.
Frames are derived from semantic networks and later evolved into our modern-day classes and
objects. A single frame is not much useful. Frames system consist of a collection of frames
which are connected. In the frame, knowledge about an object or event can be stored together in
the knowledge base. The frame is a type of technology which is widely used in various
applications including Natural language processing and machine visions.

Graphs Representation of Hotel Room:

Frame Description of Hotel Room:

Advantages of Frame representation:


 The frame knowledge representation makes the programming easier by grouping the
related data.
 The frame representation is comparably flexible and used by many applications in AI.
 It is very easy to add slots for new attribute and relations.
 It is easy to include default data and to search for missing values.
 Frame representation is easy to understand and visualize.

Limitations of Frame representation:


 In frame system inference mechanism is not be easily processed.
 Inference mechanism cannot be smoothly proceeded by frame representation.
 Frame representation has a much generalized approach.

2.3.1 Planning Agent:


 An agent interacts with the world via perception and actions
 Perception involves sensing the world and assessing the situation and creating some
internal representation of the world
 Actions are what the agent does in the domain. Planning involves reasoning about actions
that the agent intends to carry out
 Planning is the reasoning side of acting
 This reasoning involves the representation of the world that the agent has, as also the
representation of its actions.
 Hard constraints where the objectives have to be achieved completely for success
 The objectives could also be soft constraints, or preferences, to be achieved as much as
possible
Planning:
Planning is arranging a sequence of actions to achieve a goal
o or
Planning is the task of coming up with a sequence of actions that will achieve the goal
Planning Problem;
 Find a sequence of actions that achieves a given goal when executed from a given initial
world state
 That is, given
o a set of operator descriptions defining the possible primitive actions by the agent,
o an initial state description, and
o a goal state description or predicate,
o compute a plan, which is
o a sequence of operator instances which after executing them in the initial state
changes the world to a goal state
 Goals are usually specified as a conjunction of goals to be achieved

2.3.2: Planning Vs Problem Solving:


 Planning and problem solving methods can often solve the same sorts of problems
 Planning is more powerful and efficient because of the representations and methods used
 States, goals, and actions are decomposed into sets of sentences (usually in first-order
logic)
 Search often proceeds through plan space rather than state space (though there are also
state-space planners)
 Sub goals can be planned independently, reducing the complexity of the planning
problem
Example: Block World problem
Block world problem assumptions
 Square blocks of same size
 Blocks can be stacked one upon another.
 Flat surface (table) on which blocks can be placed.
 Robot arm that can manipulate the blocks. It can hold only one block at a time.
In block world problem, the state is described by a set of predicates representing the facts that
were true in that state. One must describe for every action, each of the changes it makes to the
state description. In addition, some statements that everything else remains unchanged is also
necessary.

2.3.3 STRIPS Mechanism:


One such mechanism was used in early robot problem solving system named STRIPS
(developed by Fikes, 1971).
In this approach, each operation is described by three lists.
 Pre_Cond list contains predicates which have to be true before operation.
 ADD list contains those predicates which will be true after operation
 DELETE list contain those predicates which are no longer true after operation

Predicates not included on either of these lists are assumed to be unaffected by the operation.
Frame axioms are specified implicitly in STRIPS which greatly reduces amount of information
stored.

Rules:
• R1 : pickup(x)
Precondition & Deletion List: hand empty, on(x,table), clear(x)
Add List: holding(x)
• R2 : putdown(x)
Precondition & Deletion List: holding(x)
Add List: hand empty, on(x,table), clear(x)

• R3 : stack(x,y)
Precondition & Deletion List: holding(x), clear(y)
Add List: on(x,y), clear(x), hand empty

• R4 : unstack(x,y)
Precondition & Deletion List: on(x,y), clear(x), hand empty
Add List: holding(x), clear(y)

Plan for the block world problem:


For the given problem, Start → Goal can be achieved by the following sequence :
1. Unstack(C,A)
2. Putdown(C)
3. Pickup(B)
4. Stack(B,C)
5. Pickup(A)
6. Stack(A,B)
Execution of a plan: achieved through a data structure called Triangular Table.

 For n operations in the plan, there are :


o (n+1) rows : 1 → n+1
o (n+1) columns : 0 → n
 At the end of the ith row, place the ith component of the plan.
 The row entries for the ith step contain the pre-conditions for the ith operation.
 The column entries for the jth column contain the add list for the rule on the top.
 The <i,j> th cell (where 1 ≤ i ≤ n+1 and 0≤ j ≤ n) contain the pre-conditions for the ith
operation that are added by the jth operation.
 The first column indicates the starting state and the last row indicates the goal state.

Goal Stack Planning:


Goal Stack planning (in short GSP) is one of the most important and simplest planning
algorithms, which is specifically used by STRIPS. The stack is used in an algorithm to hold the
action and satisfy the goal.
A knowledge base is used to hold the current state, actions. This approach uses a Stack for plan
generation. The stack can contain Sub-goal and actions described using predicates. The Sub-
goals can be solved one by one in any order. Goal stack is similar to a node in a search tree,
where the branches are created if there is a choice of an action.

Goal Stack planning algorithm:


i. Start by pushing the original goal on the stack. Repeat this until the stack becomes
empty. If stack top is a compound goal, then push its unsatisfied sub goals on the stack.
ii. If stack top is a single unsatisfied goal then, replace it by an action and push the action’s
precondition on the stack to satisfy the condition.
iii. If stack top is an action, pop it from the stack, execute it and change the knowledge base
by the effects of the action.
iv. If stack top is a satisfied goal, pop it from the stack.

Rules Precondition Action

1 pickup(A) hand empty, on(A,table), Holding(A)


clear(A)
2 putdown(A) Holding(A) hand empty, on(A,table),
clear(A)
3 Stack(A,B) holding(A), clear(B) on(A,B), clear(A), hand
empty
4 Unstack(A,B) on(A,B), clear(A), hand holding(A), clear(B)
empty

2.3.4 Total Order planning:


 Forward / backward state-space searches are forms of totally ordered plan search.
 Explore only strictly linear sequences of actions, directly connected to the start or goal
state.
 Cannot take advantages of problem decomposition

Partial Order planning:


 A linear planner builds a plan as a totally ordered sequence of plan steps
 A non-linear planner (aka partial-order planner) builds up a plan as a set of steps
with some temporal constraints
o constraints like S1<S2 if step S1 must come before S2.
 One refines a partially ordered plan (POP) by either:
o adding a new plan step, or
o adding a new constraint to the steps already in the plan.

 Works on several sub goals independently


 Solves them with sub plans
 Combine the sub plans
 Flexibility in ordering the sub plans
 Least commitment strategy:
delaying a choice during search

POP Example- putting on a pair of shoes


 Goal( RightShoeOn, LeftShoeOn)
 Init()
 Actions: RightShoe
o PRECOND: RightSockOn
o EFFECT: RightShoeOn
 Actions: RightSock
o PRECOND: None
o EFFECT: RightSockOn
 Actions: LeftShoe
o PRECOND: LeftSockOn
o EFFECT: LeftShoeOn
 Actions: LeftSock
o PRECOND: None
o EFFECT: LeftSockOn

A simple graphical notation:


Partial Order Plan vs. Total Order Plan:

The space of POPs is smaller than TOPs and hence involve less search because in TOP it
requires six corresponding linearization.

How to define Partial order planning:


 A set of actions, that make up the steps of the plan.
 A set of ordering constraints A< B
A before B
p

 A set of casual links A B


RightSockOn

 A achieves P for B RightSock RightShoe


 A set of open preconditions:
A precondition is open, if it is not achieved by some action in the plan

The Initial Plan:


 Initial Plan contains:
 Start:
PRECOND: None
EFFECT: Add all propositions that are initially true.
 Finish:
PRECOND: Goal State
EFFECT: None
 Ordering constraints Start < Finish
 Casual Links: {}
 Open preconditions:
{preconditions of finish}
 Successor Function: Arbitrarily picks one open precondition p on an action B and
generates a successor plan, for every possible consistent way of choosing an action A,
that achieves p.
 Consistency:
p

Casual Link A B and the ordering constraints are added () ( A<B Start
< A A< Finish)
 Resolve Conflict : add B<C or C<A
 Goal Test:
There are no open preconditions

2.3.5 Hierarchical (HTN) Planning:


In order to solve hard problems, a problem solver may have to generate long plans, it is
important to be able to eliminate some of the details of the problem until a solution that
addresses the main aspect is found. Then an attempt can be made to fill the appropriate details.
Early attempts to do this involved the use of macro operators.
But in this approach, no details were eliminated from actual descriptions of the operators.
 As an example, suppose you want to visit a friend in London but you have a limited
amount of cash to spend. First preference will be to find the airfares, since finding an
affordable flight will be the most difficult part of the task. You should not worry about of
about your drive way, planning a route to the airport etc, until you are sure you have a
flight.

Structure of Hierarchical (HTN) Planning :


Hierarchical Task Networks (from here on abbreviated as HTN) is a hierarchical planning
technique where actions are divided into different levels, or hierarchies. There are different types
of actions residing within these hierarchies, one of them being High Level Actions (from here on
abbreviated as HLA). These HLAs could be any action that you can divide into smaller actions
called refinements. These refinements may be sequences of actions or even other HLAs.
Refinements in turn are broken down into implementations (also called primitive actions) which
refers to any action that has no further refinements or implementations.
Advantages of Hierarchical (HTN) Planning:
 The main advantage of HTN planners is their ability to reason on a higher level of
abstraction compared to classical planning.
 As aforementioned, in a standard scenario, HTN planners using angelic search have the
ability to invent a plan using HLAs alone without considering the implementations of the
plan on beforehand which is very effective when considering the computational aspect.
 Hierarchical plans are generally easy for humans to understand. - A possible explanation
for this is that humans are believed to plan on a higher level of abstraction, much like
HTN planners do.

Disadvantages of Hierarchical (HTN) Planning:


 The general main disadvantage of HTN planners is that many of them require a
deterministic environment and are unable to handle uncertain outcomes of actions.
 Replanning or repairing features are however sub optimal when viewed from a
computational aspect, even if a planner is able to repair a plan during execution, it may
hold up production or construction while replanning occurs.
 Furthermore, it is sometimes hard to compute exact reachable sets, leading to wiggly sets,
which complicate the planning process.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy