You are on page 1of 47

RULE-BASED EXPERT SYSTEM ITS662

2
Introduction - Knowledge
Introduction - Knowledge
Rules -knowledge representation technique
IF antecedent
THEN consequent

A rule can have multiple antecedents joined by the


keywords AND (conjunction), OR (disjunction) or
a combination of both.

IF antecedent 1 IF antecedent 1
AND antecedent
.. 2 .. OR antecedent 2
. .
AND antecedent n OR antecedent n
THEN consequent THEN consequent
The antecedent of a rule incorporates two parts: an
object (linguistic object) and its value. The object and
its value are linked by an operator.
The operator identifies the object and assigns the value.
Operators such as is, are, is not, are not are used to
assign a symbolic value to a linguistic object.
Expert systems can also use mathematical operators to
define an object as numerical and assign it to the
numerical value.

IF ‘age of the customer’ < 18


AND ‘cash withdrawal’ > 1000
THEN ‘signature of the parent’ is required
Rules can represent relations, recommendations,
directives, strategies and heuristics:
Relation
IF the ‘fuel tank’ is empty
THEN the car is dead
Recommendation
IF the season is autumn
AND the sky is cloudy
AND the forecast is drizzle
THEN the advice is ‘take an umbrella’
Directive
IF the car is dead
AND the ‘fuel tank’ is empty
THEN the action is ‘refuel the car’
Strategy
IF the car is dead
THEN the action is ‘check the fuel tank’;
step1 is complete
IF step1 is complete
AND the ‘fuel tank’ is full
THEN the action is ‘check the battery’;
step2 is complete
Heuristic
IF the spill is liquid
AND the ‘spill pH’ < 6
AND the ‘spill smell’ is vinegar
THEN the ‘spill material’ is ‘acetic acid’
The main players in the
development team
The main players in the development team

Expert System
Development Team
Project Manager

Domain Expert Knowledge Engineer Programmer

Expert System

End-user
Domain Expert
Knowledge Engineer
Programmer
Structure of a rule-based expert system
Production system model
Long-term Memory Short-term Memory

Production Rule Fact

REASONING

Conclusion
Basic structure of a rule-based expert
system
Knowledge Base Database

Rule: IF-THEN Fact

Inference Engine

Explanation Facilities

User Interface

User
Complete structure of a rule-based expert
system External
Database External Program

Expert System
Knowledge Base Database

Rule: IF-THEN Fact

Inference Engine

Explanation Facilities

Developer
User Interface
Interface

User
Knowledge Engineer

Expert
Characteristics of an expert system
Characteristics of an expert system
Can expert systems make mistakes?
Comparison of expert systems with
conventional systems and human experts
Human Experts Expert Systems Conventional Programs
Process knowledge
Use knowledge in the Process data and use
expressed in the form of
form of rules of thumb or algorithms, a series of
rules and use symbolic
heuristics to solve well-defined operations,
reasoning to solve
problems in a narrow to solve general numerical
problems in a narrow
domain. problems.
domain.
Do not separate
In a human brain, Provide a clear
knowledge from the
knowledge exists in a separation of knowledge
control structure to
compiled form. from its processing.
process this knowledge.
Capable of explaining a Trace the rules fired
Do not explain how a
line of reasoning and during a problem-solving
particular result was
providing the details. session and explain how a
obtained and why input
particular conclusion was
data was needed.
reached and why specific
data was needed.
Comparison of expert systems with
conventional systems and human experts
(Continued)
Human Experts Expert Systems Conventional Programs
Use inexact reasoning Permit inexact reasoning
Work only on problems
and can deal with and can deal with
where data is complete
incomplete, uncertain and incomplete, uncertain and
and exact.
fuzzy information. fuzzy data.
Can make mistakes when Can make mistakes when Provide no solution at
information is incomplete data is incomplete or all, or a wrong one, when
or fuzzy. fuzzy. data is incomplete or
fuzzy.
Enhance the quality of Enhance the quality of Enhance the quality of
problem solving via years problem solving by problem solving by
of learning and practical adding new rules or changing the program
training. This process is adjusting old ones in the code, which affects both
slow, inefficient and knowledge base. When the knowledge and its
expensive. new knowledge is processing, making
acquired, changes are changes difficult.
easy to accomplish.
Forward chaining and backward chaining
Inference engine cycles via a match-fire
procedure
Database

Fact: A is x
Fact: B is y

Match Fire

Knowledge Base

Rule: IF A is x THEN B is y
An example of an inference chain
Rule 1: IF Y is true
AND D is true
THEN Z is true
A X
Rule 2: IF X is true
AND B is true
B Y
AND E is true
Z
THEN Y is true
E D
Rule 3: IF A is true
THEN X is true
Forward chaining
Forward chaining

Database Database Database Database

A B C D E A B C D E A B C D E A B C D E

X X L X L Y X L Y Z

Match Fire Match Fire Match Fire Match Fire


Knowledge Base Knowledge Base Knowledge Base Knowledge Base
Y&D Z Y&D Z Y&D Z Y&D Z
X&B&E Y X&B&E Y X&B&E Y X&B&E Y
A X A X A X A X
C L C L C L C L
L&M N L&M N L&M N L&M N

Cycle 1 Cycle 2 Cycle 3


Forward chaining
Backward chaining
Backward chaining
Backward chaining
Pass 1 Pass 2 Pass 3
Database Database Database

A B C D E A B C D E A B C D E

? ?

Z Y X
Knowledge Base Knowledge Base Knowledge Base
Y&D Z Y&D Z Y&D Z
X&B&E Y X&B&E Y X&B&E Y
A X A X A X
C L C L C L
L&M N L&M N L&M N
Goal: Z Sub-Goal: Y Sub-Goal: X

Pass 4 Pass 5 Pass 6


Database Database Database

A B C D E A B C D E A B C D E

X X Y X Y Z

Match Fire Match Fire Match Fire


Knowledge Base Knowledge Base Knowledge Base
Y&D Z Y&D Z Y&D Z
X&B&E Y X&B&E Y X&B&E Y
A X A X A X
C L C L C L
L&M N L&M N L&M N
Sub-Goal: X Sub-Goal: Y Goal: Z
How do we choose between forward
and backward chaining?
Conflict resolution
Earlier we considered two simple rules for
crossing a road. Let us now add third rule:
Rule 1:
IF the ‘traffic light’ is green
THEN the action is go
Rule 2:
IF the ‘traffic light’ is red
THEN the action is stop
Rule 3:
IF the ‘traffic light’ is red
THEN the action is go
Conflict resolution
Conflict resolution
Methods used for conflict resolution
Methods used for conflict resolution
Metaknowledge
Metarules
Metarule 1:
Rules supplied by experts have higher
priorities than rules supplied by novices.

Metarule 2:
Rules governing the rescue of human lives
have higher priorities than rules concerned
with clearing overloads on power system
equipment.
Advantages of rule-based expert systems
Advantages of rule-based expert systems
Disadvantages of rule-based expert systems
Disadvantages of rule-based expert systems

You might also like