Professional Documents
Culture Documents
Chapter One
Introduction
• Chapter Objectives
– Define intelligence
– Define AI
– Describe what an agent is
– State what rational agent is
– Identifying areas and achievements of AI
– Explain AI history and trends
• Knowledge
• It is the appropriate collection of information, such that it's intent is to
be useful.
• Knowledge is a deterministic process.
• Most of the applications we use (modeling, simulation, etc.) exercise
some type of stored knowledge.
Understanding
• is a true cognitive and analytical ability
• Understanding is an interpolative and probabilistic process
• Synthesize new knowledge from the previously held knowledge
• The systems that are built act optimally given the limited information
and computational resources available. .
If yes, can the human brain machinery solve problems that are
inherently intractable for computers?
In a human being, where is the interface between “intelligence”
and the rest of “human nature”, e.g.:
• How does intelligence relate to emotions felt?
• What does it mean for a human to “feel” that he/she
understands something?
Is this interface critical to intelligence? Can there exist a general
theory of intelligence independent of human beings? What is the
role of the human body?
In
If the
Inyes, movie
thecan
movie I,I, Robot,
the human brainthe
Robot, the most
most impressive
machinery impressive feature
feature
solve problems that are
inherently
of
of the intractable
the robots
robots for computers?
isis not
not their
their ability
ability to
to solve
solve complex
complex
problems,
problems, but
but how
how they
they blend
blend human-like
human-like
In a human being, where is the interface between “intelligence”
reasoning
the rest ofwith
reasoning
and with other
other
“human key aspects
aspects of
keye.g.:
nature”, of human
human beings
beings
(especially, self-consciousness,
How does intelligence
(especially, fear
relate to emotions
self-consciousness, felt? of
fear of dying,
dying,
What doesbetween
distinction it meanright
for and
aand
human
wrong)to “feel” that he/she
distinction between
understands something? right wrong)
Is this interface critical to intelligence? Can there exist a general
theory of intelligence independent of human beings? What is the
role of the human body?
Knowledge representation
(including formal logic)
Search, especially heuristic Agent Perception
search (puzzles, games) Robotics
Planning
Reasoning under Reasoning
uncertainty, including Search
probabilistic reasoning Learning
Learning
Agent architectures Knowledge Constraint
Planning rep. satisfaction
Robotics and perception
Natural language processing
Natural
Expert
language
Systems
...
Autonomy
◦ An agent is autonomous if its behavior is determined by its own experience
(with ability to learn and adapt)
◦ Agent that lacks autonomous, if its actions are based completely on built-in
knowledge
◦ Example: student grade decider agent:
Knowledge base given: rules for converting numeric grade to letter grade
Case 1: agent always follows the rule (lacks autonomous)
Case 2: agent that modify the rules by learning exceptions from the
knowledge base as well as grade distribution.
12/04/2021 AI/CSE 3206 49
What is…..contd
Agent programs
Skeleton of the Agent
Table-lookup agent
• Table look up agent store all the percept sequences –action pair into the
table
• For each percept, this type of agent will search for the percept entry and
return the corresponding actions.
• Table look up couldn’t be the right option to implement successful agent
• Why?
• Drawbacks:
– Huge table
– Take a long time to build the table
– No autonomy
– Even with learning, need a long time to learn the table entries
12/04/2021 AI/CSE 3206 55
What is…..contd
Agent types
• Based on memory of the agent, and they way the agent takes action we can
divide agents into five basic types:
• These are (according to their increasing order of generality) :
1. Simple reflex agents
2. Model-based reflex agents
3. Goal-based agents
4. Utility-based agents
5. Learning agent
Notation of model:
• Rectangles: used to represent the current internal state of the agent decision
process
• Ovals: used to represent the background information used in the process
12/04/2021 AI/CSE 3206 56
What is…..contd
stateINTERPRET-INPUT(percept)
ruleRULE-MATCH(state, rules)
ActionRULE-ACTION[rule]
Return action
– They live in the present only and do not think about the future.
Remark:
• Utility can be represented as a function that maps states into real numbers. The larger the
number the higher the utility of the state.
• A complete specification of the utility function allows rational decisions in two kinds of
cases where goals have trouble.
• First, when there are conflicting goals, only some of which can be achieved (e.g.,
speed vs. safety), the utility function specifies the appropriate trade-off.
• Second, when there are several goals that the agent can aim for, none of which can be
achieved with certainty, utility provides a way in which the likelihood of success can
be weighed up against the importance of the goals.
Learning Agents
• In many areas of AI, this is now the preferred method for
creating state-of-the-art systems
• A learning agent can be divided into four conceptual
components
• Learning Element
– Suggesting improvements to any part of the performance
element.
– The input to the learning element comes from the Critic.(on
how the agent is doing and determines how the
performance element should be modified to do better in the
future)
12/04/2021 AI/CSE 3206 69
What is…..contd
• Learning Agent
• Performance element
– Responsible for selecting external actions(it takes in percepts
and decides on actions)
• Critic
– Analyses incoming precepts and decides if the actions of the
agent have been good or not.
– To decide this, it will use an external performance standard.
• Problem Generator
– Responsible for suggesting actions that will result in new
knowledge about the world being acquired.
• Types of Environment
• Based on the number of agents involved
– Single agent A single agent operating by itself in an environment.
– Multi-agent: multiple agents are involved in the
environment(Chess(Competitive) versus Taxi(Cooperative or
partially competitive)
• Based on the state, action and percept space pattern
– Discrete: A limited number of distinct, clearly defined state,
percepts and actions.
– Continuous: state, percept and action are consciously changing
variables
– Note: one or more of them can be discrete or continuous
Remark:
• The environment type largely determines the agent design
• The real world is (of course) partially observable, stochastic,
sequential, dynamic, continuous, multi-agent
• As one might expect, the hardest case is partially observable,
stochastic, sequential, dynamic, continuous, and multi agent.
• It also turns out that most real situations are so complex that
whether they are really deterministic is a moot point.
• For practical purposes, they must be treated as stochastic. Taxi
driving is hard in all these senses.
Chapter Three:
(Problem Solving: Uninformed Search)
States
Actions
Start Solution
Goal
• Problem formulation
– For vacuum world problem, the problem formulation involve:
• States: The agent is in one of two locations, each of which
might or might not contain dirt. Thus there are 2 x 2^2 = 8
possible world states.
• Initial state: Any state can be designated as the initial state.
• Successor function: This generates the legal states that result
from trying the three actions (Left, Right, and Suck).
• Goal test: This checks whether all the squares are clean.
• Path cost: Each step costs 1, so the path cost is the number of
steps in the path.
Agent Program
200
Mekele
80
180
Lalibela
110 250
150
Bahr dar
Dessie
170
400
330
Jima Addis Ababa
100
430 Adama 370
Awasa
12/04/2021 AI/CSE 3206 95
Problem…contd
3. Contingency problem
– The environment is nondeterministic and/or partially observable
– It is not possible to know the effect of the agent action
– percepts provide new information about current state
4. Exploration problem
– The environment is partially observable
– It is also called unknown state space
Single-state
– Starting state us known
say in #5.
– What is the Solution?
Sensorless
• Solution
• Right goes to {2,4,6,8}
Solution?
• [Right,Suck,Left,Suck]
• Contingency Solution
[Right, if dirt then Suck] Move right
suck
• States??
• Initial state??
• Actions??
• Goal test??
• Path cost??
Example: 8-puzzle
• States??
• Initial state??
• Actions??
• Goal test??
• Path cost??
Example: 8-puzzle
Example: 8-puzzle
8 2 1 2 3
3 4 7 4 5 6
5 1 6 7 8
8 2 7
3 4
8 2 5 1 6
3 4 7
5 1 6 8 2 8 2
3 4 7 3 4 7
5 1 6 5 1 6
Example: 8-puzzle
0.18 sec
24-puzzle .5 x 1025
6 days
12 billion years
10 million states/sec
Example: 8-queens
Place 8 queens in a chessboard so that no two queens
are in the same row, column, or diagonal.
Example: 8-queens
Formulation #1:
• States: any arrangement of 0 to 8 queens on
the board
• Initial state: 0 queens on the board
• Actions: add a queen in any square
• Goal test: 8 queens on the board, none
attacked
• Path cost: none
Example: 8-queens
Formulation #2:
• States: any arrangement of k = 0 to 8
queens in the k leftmost columns with
none attacked
• Initial state: 0 queens on the board
• Successor function: add a queen to any
square in the leftmost empty column such
that it is not attacked by any other
queen
• Goal test: 8 queens on the bord
2,067 states
12/04/2021 AI/CSE 3206 117
Problem…contd
• States??
• Initial state??
• Actions??
• Goal test??
• Path cost??
• The Successor-Fn generate all the successors state and the action that
leads moves the current state into the successor state
• The Expand function creates new nodes, filling in the various fields
of the node using the information given by the Successor-Fn and the
input parameters
12/04/2021 AI/CSE 3206 122
Problem…contd
Gambela
Dire Nekemt Debre Awasa
Gambela AA Adama Jima
Dawa Markos
Dessie
Awasa
BahrDar AA
Lalibela AA Gondar
Gondar Debre M.
L R
S
Searching
Strategies in AI
Un-informed Informed
(Blind Search) (Heuristic Search)
Depth-
Limited A* Search
(DLS)
A very large number of AI problems are formulated as
Iterative search problems.
Deepening
m
b
G
A D • Move
downwards,
B D A E level by
level, until
C E E B B F goal is
reached.
D F B F C E A C G
G C G F
G
12/04/2021 AI/CSE 3206 137
Breadth-First Strategy
2 3 FRINGE = (1)
4 5 6 7
2 3 FRINGE = (2, 3)
4 5 6 7
2 3 FRINGE = (3, 4, 5)
4 5 6 7
2 3 FRINGE = (4, 5, 6, 7)
4 5 6 7
3. IF goal reached
THEN success;
ELSE failure;
S
• Select a child
A • convention: left-to-right or may
D be alphabetical order
B
• Repeatedly go to next child, as long
E as possible.
C
• Return to left-over alternatives
D F (higher-up) only when needed.
2 3
FRINGE = (1)
4 5
2 3
FRINGE = (2, 3)
4 5
2 3
FRINGE = (4, 5, 3)
4 5
2 3
4 5
2 3
4 5
2 3
4 5
2 3
4 5
2 3
4 5
2 3
4 5
2 3
4 5
2 3
4 5
DFS Evaluation:
• DFS is a method of choice when there is a known (and
reasonable) depth bound, and finding any solution is sufficient
1.Depth-first search:
IF the search space contains very deep branches without solution,
THEN Depth-first may waste much time in them.
2. Breadth-first search:
Is VERY demanding on memory !
Solutions ??
Iterative deepening
The order of expansion of states is similar to BFS, except that
some states are expanded multiple times
12/04/2021 AI/CSE 3206 163
Iterative Deepening Search l = 0
• Limit = 0
• Limit = 1
• Limit = 2
• Limit = 3
•As can be seen, from the three iterations, the order of expansion
of states is similar to BFS, except that some states are expanded
multiple
12/04/2021 times AI/CSE 3206 167
Iterative Deepening Search l = 1 to l=4
1. DEPTH <-- 1
• Completeness
– It is complete
– It finds a solution if exists
• Optimality
– It is optimal
– Finds the shortest path (like breadth first)
• Guarantee shortest path
• Guarantee for goal node of minimal depth
A, 1 B, 5 C, 15
A
1 10 S
5 B 5
S G
A, 1 B, 5 C, 15
15 C 5
G, 11
S
A, 1 B, 5 C, 15
G, 11 G, 10
B D A E
C E E B B F
11
D F B F C E A C G
14 17 15 15 13
G C G F
19 19 17 G 25
12/04/2021 AI/CSE 3206 173
Bidirectional…contd
Bi-directional Search
* Completeness: yes
* Optimality: yes d/2
* Time complexity: O(bd/2)
* Space complexity: O(bd/2) d
O(bd) vs. O(bd/2) ? with b=10 and d=6 results in 1,111,111 vs. 2,222.
• Section Objectives
– Define Informed search algorithms(strategies)
– Differentiate between Blind and Informed search
– Identify types of Informed Search
– Best-first search
– Memory Bound Best First search
– Iterative improvement algorithm (Local search
algorithms)
• Understand the use of an evaluation function f(n)
– Understanding Admissible heuristics
Best-first search
Idea: use an evaluation function f(n) for each node
Estimate of "desirability“ using heuristic and path cost
Expand most desirable unexpanded node(Expand the node n
with smallest f(n))
The information gives a clue about which node to be expanded
first
This will be done during queuing
The best node according to the evaluation function may not be
best
Implementation:
Order the nodes in fringe in decreasing order of desirability
(increasing order of cost evaluation function)
1 8
Expanded Node OPEN list
5
(S:8)
A B C
S not goal (C:3,B:4,A:8) h=4
h=8 h=3
9 4
3
7 5
D G
E
h= h=0
h=
1 8
Expanded Node OPEN list
5
(S:8)
A B C
h=8 h=4 h=3
S (C:3,B:4,A:8)
9 4
C not goal (G:0,B:4,A:8) 3
7 5
D G
E
h= h=0
h=
f(n)= h(n)
# of nodes tested 3, expanded 2 S
h=8
1 8
Expanded Node OPEN list 5
(S:8) A B C
h=8 h=4 h=3
S (C:3,B:4,A:8)
9 4
3
C (G:0,B:4,A:8) 7 5
D G
G goal (B:4.A:8) E
h= h=0
no expansion h=
1 8
Expanded Node OPEN list
5
(S:8)
A B C
S (C:3,B:4,A:8) h=8 h=4 h=3
9 4
C (G:0,B:4,A:8) 3
7 5
G goal (B:4.A:8) D G
E
h= h=0
h=
I G3 J
A* search
• Idea: avoid expanding paths that are already expensive
• Evaluation function f(n) = g(n) + h(n) where
• g(n) = cost so far to reach n
• h(n) = estimated cost from n to goal
• f(n) = estimated total cost of path through n to goal
• It tries to minimizes the total path cost to reach into the goal at
every node N.
Excercise
• By using map of Ethiopia in previous slid , Indicate the flow of
search to move from Awasa to Gondar using A*
Exercise
Heuristic
R G -------------- 100
A G -------------- 60
• Given the following tree structure,
B G -------------- 80
show the content of the open list and
closed list generated by A* best first C G -------------- 70
D E F G1 H G2 J G ---------------- 8
15 20 5 G1,G2,G3 G ------------ 0
I G3 J
A* Search
Admissible heuristics
A heuristic h(n) is admissible if for every node n, h(n) ≤ h*(n), where
h*(n) is the true cost to reach the goal state from n.
An admissible heuristic never overestimates the cost to reach the goal,
i.e., it is optimistic
Example: hSLD(n) (never overestimates the actual road distance)
G 10/9/13 0 10/9/1 0 D G
E
3 h= h=0
h=
Example: n-queens
•Put n queens on an n × n board with no two queens on the same row, column, or
diagonal
Hill-climbing search
• Tries to make changes that improve the current state cost
• The algorithm is given bellow
• It continually move in the direction of increasing value
• The node data structure maintain only records of state and
evaluation cost
Problem:
1. Depending on initial state, can get
stuck in local maxima
2. Plateaux (after some progress the
algorithm will make a random
walk)
3. Ridges (a place where two sloppy
sides meet). In this case the search
may oscillate from side to side
• h = number of pairs of
queens that are attacking each
other, either directly or
indirectly
• h = 17 for the above state
h=0 h=0
A
S A 1
2 10
S B 3
2
S C 5
S G 9 5 5
A B 1 S B G
A C 3
A G 3 2
10
B C 2 5
B G 4
C
C G 4
Representation in Logic
• The oldest form of knowledge representation
• It is the scientific study of the process of reasoning and the system of
rules and procedures that aid in the reasoning process
• Logic is considered to be subdivision of philosophy
• The development and refinement of its processes are generally
credited to the ancient Greeks
• The general form of logical process is:
– Information is given
Premises
– Statements are made or observations are made
• The premises are used by the logical process to create the output
which consists of conclusions called inferences
• With this process, facts that are known to be true can be used to derive
new facts that also must be true
12/04/2021 AI/CSE 3206 225
Knowledge …..contd
• For a computer to perform reasoning using logic, some method must be
used to convert statements and the reasoning process into a form
suitable for manipulation by a computer
• The result is what is known as symbolic, or mathematical logic
• It is a system of rules and procedures that permit the drawing of
inferences from various premises using a variety of logical techniques
• The two basic forms of computational logic are
– Propositional logic
– Predicate logic(predicate calculus);-a system for computing
Input Output
Logical Inferences
Premises
Or facts
Process or
Conclusions
12/04/2021 AI/CSE 3206 226
Knowledge …..contd
What is logic?
• Logic is concerned with reasoning and the validity of arguments.
• In general, in logic, we are not concerned with the truth of
statements, but rather with their validity.
• That is to say, although the following argument is clearly logical,
it is not something that we would consider to be true:
– All lemons are blue
– Mary is a lemon
– Therefore, Mary is blue
• This set of statements is considered to be valid because the
conclusion (Mary is blue) follows logically from the other two
statements, which we often call the premises.
12/04/2021 AI/CSE 3206 227
Knowledge …..contd
What is logic?
• The reason that validity and truth can be separated in this
way is simple: a piece of a reasoning is considered to be
valid if its conclusion is true in cases where its premises are
also true.
• Hence, a valid set of statements such as the ones above can
give a false conclusion, provided one or more of the
premises are also false.
• We can say: a piece of reasoning is valid if it leads to a true
conclusion in every situation where the premises are true.
Connectives Symbol
AND ^ , Π, &
OR V, U, +
NOT ~, -, ¬
IMPLIES , Ɔ
BI-IMPLICATION
EQUIVALENT ≡
12/04/2021 AI/CSE 3206 230
Knowledge …..contd
p Q OR AND Implication
F F F F T
F T T F T
T F T F F NOT A or B
T T T T T
A AND NOT B
Predicate Calculus
• Although propositional logic is a knowledge representation alternative, it
is not very useful in artificial intelligence.
• Since propositional logic deals primarily with complete statements and
whether they are true or false, its ability to represent real-world
knowledge is limited
• It cannot make assertions about the individual elements that make up
statements
• Consequently, AI uses predicate logic instead
12/04/2021 AI/CSE 3206 231
Knowledge Representation
• A predicate is a generalization of a propositional variable
• “Predicate,” or “first-order,” logic is a generalization of propositional
logic
• Predicates are functions of zero or more variables that return Boolean
values.
• Thus predicates can be true sometimes and false sometimes,
depending on the values of their arguments.
• For example, we shall find in predicate logic atomic operands such as
x(C, S,G).
• Here, x is the predicate name, and C, S, and G are arguments. We can
think of this expression as a representation in logic of the database
relation Course-Student-Grade
• It returns the value TRUE whenever the values of C, S, and G are
such that student S got grade G in course C, and it returns FALSE
otherwise
12/04/2021 AI/CSE 3206 232
Knowledge Representation
• What is true for Joe is also true for Mary, and Sue, and Bill, and for any other
persons
• Thus, we might think of the proposition u as uJoe, while w is the proposition
wJoe. If we do, we have the hypotheses r → uJoe, uJoe → - wJoe, and -r →
-wJoe
• If we define the proposition uMary to mean that Mary takes her umbrella, and
wMary to mean that Mary gets wet, then we have the similar set of hypotheses:
r → uMary, uMary → -wMary, and -r → -wMary
• We could go on like this, inventing propositions to talk about every individual X
we know of and stating the hypotheses that relate the proposition r to the new
propositions uX and wX, namely, r → uX, uX → -wX, and -r → -wX
• We have now arrived at the notion of a predicate.
• Instead of an infinite collection of propositions uX and wX, we can define
symbol u to be a predicate that takesAI/CSE
12/04/2021
an argument
3206
X 234
Knowledge Representation
• The expression u(X) can be interpreted as saying “X takes his or her
umbrella.”
• Possibly, for some values of X, u(X) is true, and for other values of X, u(X)
is false. Similarly, w can be a predicate; informally w(X) says “X gets wet.”
• The propositional variable r can also be treated as a predicate with zero
arguments.
• That is, whether it is raining does not depend on the individual X the way u
and w do.
• We can now write our hypotheses in terms of the predicates as follows:
r → u(X). (For any individual X, if it is raining, then X takes his or her umbrella.)
u(X) → NOT w(X). (No matter who you are, if you take your umbrella, then you
won’t get wet.)
NOT r → NOT w(X). (If it doesn’t rain, then nobody gets wet.)
12/04/2021 AI/CSE 3206 235
Knowledge Base Agent
• Knowledge base agent is an agent that perform action using the knowledge it has
and reason about their action using its inference procedure.
• Knowledge base is a set of representation of facts and their relation ships called
rules about the world.
• Each fact/rule is called a sentence which is represented using a language called
knowledge representation language.
• Declarative approach to building an agent (or other system):
– Tell it what it needs to know(TELL)
• Facts and rules (Knowledge base)
– Ask what it knows(ASK)
• Answers should follow from the KB
• In addition to TELLININHG the agent what it needs to know, we can provide a
knowledge-based agent with mechanisms that allow it to learn for itself.
12/04/2021 AI/CSE 3206 236
Knowledge Bases Agent
Logic includes…
1. Formal system of defining the world
• Syntax
• Semantics
2. A proof theory:
– It is Rules for determining all entailments (given the hidden
property of the world)
– A set of rules for deducing the entailment of a set of
sentences.
Syntax
• Recursive definition of well-formed formulas
– An atom is a formula
– If S is a formula, :S is a formula(negation)
– If S1 and S2 are formulas, S1 ^ S2 is a formula (conjunction)
– If S1 and S2 are formulas, S1 _ S2 is a formula(disjunction)
– All well-formed formulas are generated by applying above
rules
• Shortcuts:
– S1 S2 can be written as : -S1 U S2
– S1 S2 can be written as (S1 S2) n (S2S1)
Syntax
Examples of well-formed
formulas Examples of formulas that are not
a. p well-formed
b. ¬¬p a. pqr
d. ¬(p ∨ q) b. (p
c. p¬
e. (¬(p ∨ q) ∧ p)
d. ∨q
f. ¬((p ∨ q) ∧ p) e. (¬p ↔ r ∨ s)
g. ¬(p ↔ (r ∨ s)) f. → ∨ ∧
h. (p ↔ ¬(r ∨ s)) g. pq →
i. ((p ∧ q) ∨ (s ∧ r)) i. (p) ∧ p
j. ((((p → q) → ¬r) ↔ s) ∨ (t ∧ j. →∧pq ∨pq
u))
12/04/2021 AI/CSE 3206 241
Logic as …
Semantics
– Valid (tautology)
• A sentence is valid iff it is true under any interpretations in all possible world
• A sentence is valid iff it is true in every interpretation (every interpretation is
a model).
• A sentence s is a valid consequence of a set S of sentences, if (S => s) is
valid.
– Proof methods: Truth -Tables and Inference Rules
• Validity is connected to inference via the Deduction Theorem:
KB ╞ α if and only if (KB α)
– Example: x>4 or x<=4;
– Water boils at 100 degree centigrade
– Human has two legs (may not be valid)
– Books have page number (may not be valid)
P Q PQ Remark
1 T T T Q, PQ, & P are true
2 T F F Premises did not satisfy
3 F T T Premises satisfied but not the conclusion
4 F F T Premises did not satisfy
3. And Elimination
4. And introduction
5. Or introduction
6. Double negation elimination
7. Unit resolution(
8. Resolution
12/04/2021 AI/CSE 3206 250
Logic as …
Some of the most useful inference rules for propositional logic are as
follows. In these rules, A, B, and C stand for any logical expressions.
This rule is usually known as modus ponens and is one of the most
commonly used rules in logical deduction.
It is expressed as follows:
• Two sentences are logically equivalent iff they have the same truth value in all possible
world
• equivalently α ≡ ß iff α╞ β and β╞ α
• The inference procedure that we have seen before are all sound
• If KB is represented in CNF, the generalized resolution inference
procedure is complete
• If KB is represented in Horn form, the generalized modes ponens
algorithm is complete
• It can be proved that every sentence of human language can be
represented using logic as CNF. However, it is not possible in Horn form.
• Therefore, CNF is a more powerful representation technique for
knowledge
• But, Horn form representation of knowledge is easily understandable
and convenient. It also require polynomial time inference procedure
• Given any two clauses A and B, if there are any literal P 1 in A which has a
complementary literal P2 in B, delete P1 and P2 from A and B and construct
a disjunction of the remaining clauses.
• The clause constructed is called the resolvent of A and B.
– For example, consider the following clauses
A: P Q R
B: ~P Q M
C: ~Q S
From clause A and B, if we remove P and ~P, it resolves into clause D : Q
R Q M Q R M .
If Q of clause D and ~Q of clause C resolved, we get
clause E: R M S
Note: in order to apply resolution for proving a theory, make sure first all
the knowledge is in its clausal form
12/04/2021 AI/CSE 3206 259
Example: Resolution
• Prove that r follows from:
(p q) (r s) - (1)
p~s - (2)
p q - (3)
• Solution:
Clause (1) in Clausal form
~ (p q) (r s)
{~ p ~ q r s} - (1)
Clause (2) in Clausal form
{~ p ~ s} - (2)
Clause (3) in Clausal form
{p} - (3)
{q} - (4)
Assume not r which {~ r} in Clausal form - (5)
12/04/2021 AI/CSE 3206 260
Example: Resolution
Using inference rules: from unit resolution rule of (1) and (5)
{~p ~ q s} - (6) (resolve r with ~r and get resolvent)
from unit resolution of (3) and (6)
{~ q s} - (7) (resolve p with ~p and get resolvent)
from (4) and (7)
{s} - (8) (resolve q with ~q and get resolvent)
from (2) and (8)
{~ p} - (9) (resolve p with ~p and get resolvent)
from (3) and (9)
{} - (10)
Therefore r follows from the original clauses
• Environment
– Squares adjacent to wumpus are smelly(stench)
– Squares adjacent to pit are breezy
– Glitter iff gold is in the same square
– Shooting kills wumpus if agent is facing to it
– Shooting uses up the only arrow
– Grabbing picks up gold if in same square
– Releasing drops the gold in same square
12/04/2021 AI/CSE 3206 265
Practical Example (The Wompus world)
• Performance measure
– Grab gold has score of 1000,
– death by pits or wompus score -1000
– using the arrow (shooting) score -10 and
– the rest ation score -1
• Sensors: Stench, Breeze, Glitter, Bump, Scream
• Actuators: turn left 90o, turn right 90o, Forward, Grab, Release,
Shoot
Let Sij, Bij, Gij,Wij,Pij be there is a stench, breeze, Glitter, wompus, pits
at ith row and jth column respectively
Let Bu be true if agent is facing towards the wall being at the border
Let Sc be true if wompus is killed
Percept sequence if agent is at row i and column j can be
[Sij, Bij, Gij, Bu, Sc ]
Actions: turn right 900, turn left 900, Grab, Shoot and go forward