princess nora university faculty of computer & information...
TRANSCRIPT
![Page 1: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/1.jpg)
ARTIFICIAL INTELLIGENCE (CS 370D)
Princess Nora University Faculty of Computer & Information Systems
![Page 2: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/2.jpg)
(CHAPTER-7)
LOGICAL AGENTS
![Page 3: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/3.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Some General Representations
1. Logical Representations
2. Production Rules
3. Semantic Networks
• Conceptual graphs, frames, scripts
4. Description Logics (not covered in this course )
3
![Page 4: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/4.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Non-Logical Representations?
4
![Page 5: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/5.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Non-Logical Representations?
1. Production rules
2. Semantic networks
Conceptual graphs
Frames
Scripts
5
![Page 6: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/6.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Production Rules
6
![Page 7: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/7.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Production Rules
Rule set of <condition,action> pairs
“if condition then action”
Match-resolve-act cycle
Match: Agent checks if each rule’s condition holds
Resolve:
Multiple production rules may fire at once (conflict set)
Agent must choose rule from set (conflict resolution)
Act: If so, rule “fires” and the action is carried out
7
![Page 8: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/8.jpg)
Dr. Abeer Mahmoud
(course coordinator) 8
8
Rules
If Animal has hair
And Animal produces milk
Then animal is a mammal
IF animal has feather,
THEN animal is bird.
IF animal flies,
AND animal lays eggs,
THEN animal is bird. .
![Page 9: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/9.jpg)
Dr. Abeer Mahmoud
(course coordinator) 9
IF the interest-rate out look is down,
THEN do not buy money-market funds..
• An apple a day keeps the doctor away .
• A stitch in time saves nine .
Rules-of-Thumb
9
![Page 10: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/10.jpg)
Dr. Abeer Mahmoud
(course coordinator) 10
IF you’re old,
THEN you have owned several homes .
Fuzzy Rules
IF you have owned several homes THEN you have had numerous headaches .
IF the interest-rate out look is up and the risk you can accept is low,
THEN buy a conservative money-market fund .
10
![Page 11: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/11.jpg)
Dr. Abeer Mahmoud
(course coordinator) 11
IF the interest-rate out look is up and the risk you can accept is high,
THEN buy aggressive money-market fund .
IF the patient is sneezing,
AND has a runny nose,
AND has watery eyes,
THEN the patient has cold, CF=0.5 .
Rules with certainty factors
11
![Page 12: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/12.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Production Rules Example
IF (at bus stop AND bus arrives)
THEN action(get on the bus)
IF (on bus AND not paid AND have oyster card) THEN action(pay with oyster) AND add(paid)
IF (on bus AND paid AND empty seat)
THEN sit down
12
![Page 13: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/13.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Inference Engine
The inference engine is a generic control mechanism for navigating
through and manipulating knowledge and deduce results in an
organized manner
It applies a specific task take data and drive conclusions
The inference engine is the part of the system that chooses which facts
and rules to apply when trying to solve the user’s query
![Page 14: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/14.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Inference Engine
The forward chaining , backward chaining and tree search are
some of the techniques used for drawing inferences from the
knowledge base
Inferences from rules
1. Goal driven = backward chaining
2. Data driven= forward chaining
![Page 15: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/15.jpg)
Dr. Abeer Mahmoud
(course coordinator) 15
15
Goal driven or backward chaining
An inference technique which uses IF-THEN rules to repetitively break a
goal into smaller sub-goals which are easier to prove
![Page 16: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/16.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Example : KB contains Rule set :
Rule 1: if A and C then F
Rule 2: if A and E then G
Rule 3: if B then E
Rule 4: if G then D
![Page 17: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/17.jpg)
Dr. Abeer Mahmoud
(course coordinator)
![Page 18: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/18.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Data driven or Forward chaining
An inference technique which uses IF-THEN rules to deduce a problem
solution from initial data
![Page 19: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/19.jpg)
Dr. Abeer Mahmoud
(course coordinator)
![Page 20: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/20.jpg)
Dr. Abeer Mahmoud
(course coordinator) 20
![Page 21: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/21.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Advantages of Rules
Rules are easy to understand
Inference and explanation are easy to derive
Modifications and maintenance are relatively easy
Uncertainty is easily combined with rules
Each rule is usually independent of all others
21
![Page 22: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/22.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Graphical Representation
22
![Page 23: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/23.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Graphical Representation
Graphs easy to store in a computer
To be of any use must impose a formalism
Jason is 15, Bryan is 40, Arthur is 70, Jim is 74
How old is Julia?
23
![Page 24: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/24.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Semantic Networks
Because the syntax is the same
We can guess that Julia’s age is similar to Bryan’s
Formalism imposes restricted syntax
24
![Page 25: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/25.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Semantic Networks
Graphical representation (a graph)
Links indicate subset, member, relation, ...
Equivalent to logical statements (usually FOL)
Easier to understand than FOL?
Example: natural language understanding
Sentences with same meaning have same graphs
e.g. Conceptual Dependency Theory (Schank)
25
![Page 26: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/26.jpg)
Dr. Abeer Mahmoud
(course coordinator) 26
26
Semantic Networks
In this scheme , knowledge is represented in terms of objects and
relationships between objects
The objects are denoted as nodes of a graph. The relationship
between two objects are denoted as a link between the
corresponding two nodes
The most common form of semantic network uses the link between
nodes to represent IS-A and HAS relationships between objects
![Page 27: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/27.jpg)
Dr. Abeer Mahmoud
(course coordinator) 27
Example of semantic network
27
![Page 28: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/28.jpg)
Dr. Abeer Mahmoud
(course coordinator) 28
ANIMAL
MAMMAL BIRD
A Semantic network for animal kingdom
CARNIVORE
HAIR MILK
PRODUCTION
FORWARD
EYES
FORWARD
TEETH
EATS
MEAT CLAWS
FEATHERS
FLYS
LAYS
EGGS
28
![Page 29: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/29.jpg)
Dr. Abeer Mahmoud
(course coordinator) 29
Frames
o In this technique, knowledge is decomposed into highly modular
pieces called frames, which are generalized record structures
o Knowledge consist of concepts, situation, attributes of concepts
, relationships between concepts , and procedure to handle
relationships
Each concept may be represented as a separate frame
The attributes, the relationships between concepts and the procedures are
allotted to slots in a frame
The contents of a slot may be of any data type –numbers, strings,
functions or procedures and so on
The frames may be linked to other frames, providing the same kind of
inheritance as that provided by a semantic network
29
![Page 30: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/30.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Frame Representations
Semantic networks where nodes have structure
Frame with a number of slots (age, height, ...)
Each slot stores specific item of information
When agent faces a new situation
Slots can be filled in (value may be another frame)
Filling in may trigger actions
May trigger retrieval of other frames
Inheritance of properties between frames
Very similar to objects in OOP
30
![Page 31: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/31.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Frames
Basic frame design
Frame Name:
Class:
Properties:
Object1
Object2
*** ***
*** ***
Value2 Property2
Value1 Property1
![Page 32: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/32.jpg)
Dr. Abeer Mahmoud
(course coordinator) 32
Frame Representation of the “cow”
32
Frame Name:
Class:
Properties:
Cow
Mammal
*** ***
Long tail tail
Produce Milk Activity
Hair SKIN Cover
![Page 33: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/33.jpg)
Dr. Abeer Mahmoud
(course coordinator) 33
33
Chair frame
![Page 34: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/34.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Flexibility in Frames
Slots in a frame can contain
Information for choosing a frame in a situation
Relationships between this and other frames
Procedures to carry out after various slots filled
Default information to use where input is missing
Blank slots: left blank unless required for a task
Other frames, which gives a hierarchy
34
![Page 35: Princess Nora University Faculty of Computer & Information ...pnu-cs-ai.yolasite.com/resources/ch7- CS370 -logical agents part2.pdf · Jason is 15, Bryan is 40, ... Dr. Abeer Mahmoud](https://reader038.vdocuments.net/reader038/viewer/2022110111/5a9ed9677f8b9a7f178bf0ef/html5/thumbnails/35.jpg)
Dr. Abeer Mahmoud
(course coordinator)
Thank you
End of
Chapter 7- part2
35