INTELLIGENT SYSTEMS Rule based systems 1. Aims of session To understand  Basic principles  Forward chaining  Problems with rule-based systems  Backward.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

1 Knowledge Based Systems (CM0377) Lecture 11 (Last modified 26th March 2001)
Inference Rules Universal Instantiation Existential Generalization
CHAPTER 13 Inference Techniques. Reasoning in Artificial Intelligence n Knowledge must be processed (reasoned with) n Computer program accesses knowledge.
1 Rule Based Systems Introduction to Production System Architecture.
Justification-based TMSs (JTMS) JTMS utilizes 3 types of nodes, where each node is associated with an assertion: 1.Premises. Their justifications (provided.
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Rules, page 1 CSI 4106, Winter 2005 Representing knowledge with rules Points Definitions Production systems Conflict resolution strategies Examples A financial.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic.
CS 484 – Artificial Intelligence1 Announcements Choose Research Topic by today Project 1 is due Thursday, October 11 Midterm is Thursday, October 18 Book.
Inferences The Reasoning Power of Expert Systems.
Formal Logic Mathematical Structures for Computer Science Chapter 1 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFormal Logic.
B. Ross Cosc 4f79 1 Forward chaining backward chaining systems: take high-level goal, and prove it by reducing it to a null goal - to reduce it to null,
Reasoning System.  Reasoning with rules  Forward chaining  Backward chaining  Rule examples  Fuzzy rule systems  Planning.
Knowledge Engineering.  Process of acquiring knowledge from experts and building knowledge base  Narrow perspective  Knowledge acquisition, representation,
Rule Based Systems Michael J. Watts
Artificial Intelligence Lecture No. 16
Chapter 12: Expert Systems Design Examples
Expert System Human expert level performance Limited application area Large component of task specific knowledge Knowledge based system Task specific knowledge.
1 5.0 Expert Systems Outline 5.1 Introduction 5.2 Rules for Knowledge Representation 5.3 Types of rules 5.4 Rule-based systems 5.5 Reasoning approaches.
Lecture 04 Rule Representation
Artificial Intelligence CAP492
1 Pertemuan 6 RULE-BASED SYSTEMS Matakuliah: H0383/Sistem Berbasis Pengetahuan Tahun: 2005 Versi: 1/0.
1 Chapter 9 Rules and Expert Systems. 2 Chapter 9 Contents (1) l Rules for Knowledge Representation l Rule Based Production Systems l Forward Chaining.
ARTIFICIAL INTELLIGENCE TECHNIQUES Knowledge Processing 1.
Rules and Expert Systems
© C. Kemke1Reasoning - Introduction COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.
Methods of Proof Chapter 7, second half.
Production Rules Rule-Based Systems. 2 Production Rules Specify what you should do or what you could conclude in different situations. Specify what you.
Knoweldge Representation & Reasoning
EXPERT SYSTEMS Part I.
Let remember from the previous lesson what is Knowledge representation
CPSC 433 Artificial Intelligence CPSC 433 : Artificial Intelligence Tutorials T01 & T02 Andrew “M” Kuipers note: please include.
Artificial Intelligence CSC 361
17.5 Rule Learning Given the importance of rule-based systems and the human effort that is required to elicit good rules from experts, it is natural to.
Artificial Intelligence Lecture No. 15 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Inference is a process of building a proof of a sentence, or put it differently inference is an implementation of the entailment relation between sentences.
Production Systems A production system is –a set of rules (if-then or condition-action statements) –working memory the current state of the problem solving,
Aims of session  Last week  Deterministic  Propositional logic  Predicate logic  This week (Basis of this section Johnson and Picton 1995)  Non-monotonic.
Chapter 9: Rules and Expert Systems Lora Streeter.
 Architecture and Description Of Module Architecture and Description Of Module  KNOWLEDGE BASE KNOWLEDGE BASE  PRODUCTION RULES PRODUCTION RULES 
1 CHAPTER 13 Decision Support Systems and Intelligent Systems, Efraim Turban and Jay E. Aronson 6th ed, Copyright 2001, Prentice Hall, Upper Saddle River,
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
Rule Based Systems  If then  Rules to solve problems  What is forward chaining?  What is backward chaining?  Expert systems.
Expert System Note: Some slides and/or pictures are adapted from Lecture slides / Books of Dr Zafar Alvi. Text Book - Aritificial Intelligence Illuminated.
COM362 Knowledge Engineering Inferencing 1 Inferencing: Forward and Backward Chaining John MacIntyre
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Knowledge Processing 1. Aims of session  Introduce types of reasoning  Deterministic  Propositional logic  Predicate logic.
Types of logic. Propositional logic: syntax Limitations of Propositional Logic 1. It is too weak, i.e., has very limited expressiveness: Each rule has.
Chapter 4: Inference Techniques
Chapter 9. Rules and Expert Systems Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
1 UNIT-3 KNOWLEDGE REPRESENTATION. 2 Agents that reason logically(Logical agents) A Knowledge based Agent The Wumpus world environment Representation,
Forward and Backward Chaining
Review: What is a logic? A formal language –Syntax – what expressions are legal –Semantics – what legal expressions mean –Proof system – a way of manipulating.
Expert System Seyed Hashem Davarpanah University of Science and Culture.
1 Ch 17: Alternative Decision-Support Systems. 2 What is an expert system? ‘The modeling, within a computer, of expert knowledge in a given domain, such.
Artificial Intelligence: Applications
By Muhammad Safdar MCS [E-Section].  There are times in life when you are faced with challenging decisions to make. You have rules to follow and general.
Intelligent Systems Rule based systems 1. Aims of session To understand Basic principles Forward chaining Problems with rule-based systems Backward chaining.
Lecture 20. Recap The main components of an ES are –Knowledge Base (LTM) –Working Memory (STM) –Inference Engine (Reasoning)
Advanced AI Session 2 Rule Based Expert System
Chapter 9. Rules and Expert Systems
EA C461 – Artificial Intelligence Logical Agent
CS62S: Expert Systems Based on:
Forward Chaining DFS can supply compatible bindings for forward chaining.
Chapter 9. Rules and Expert Systems
Presentation transcript:

INTELLIGENT SYSTEMS Rule based systems 1

Aims of session To understand  Basic principles  Forward chaining  Problems with rule-based systems  Backward chaining  Expert systems in a bit more detail  Notes: Based around Johnson and Picton (1995)

During construction  Taken from Johnson and Picton (1995)

 Knowledge-base: Contains facts and rules  Inference engine: input information is combined with rules and facts to make decisions and construct new information.

 Usually come humans  Process of getting the knowledge in suitable form is knowledge elicitation.  Often trying capture human expertise  Not always explicit

During Use  Taken from Johnson and Picton (1995)

Difference  Knowledge is kept separate from control structures of programs  Advantage of knowledge can be add or removed relatively easily  Should have methods to explain conclusions or reasoning.

Drawbacks  Tend to be used in narrowly defined applications.  Need to updated regularly to maintain the validity of the knowledge used.  Ability to add knowledge as you go along means inconsistencies can arises as can complex sets of rules slowing system down.

Knowledge base  Facts and rules – domain of a problem  Proposition or Predicates(if variables included) can be used.  The part of predicate asserted to be true is the clause.

Deep and Surface Knowledge  Deep Knowledge  Basic key principles that are assumed not to change.  Surface Knowledge  known to work from experience but are possibly going to change.

Production rules  If-Then  If T(Cold) Then T(Heating ON)  What is the problem with this?

 Cold needs to be more precisely defined  T(Cold)= TRUE if sensor <10 0 C  T(Cold)=FALSE if sensor>=10 0 C  T(Heating ON)=TRUE if heating is switched ON  T(Heating ON)-FALSE if heating is switched OFF

 If T(Cold) Then T(Heating ON)  The LHS of the rule that contains the condition is the ANTECEDENT.  The RHS of the rule that contains what happens if the antecedent is TRUE is the CONSEQUENCE.  This is called modus ponens  From previous lecture rules of inference  If (A  B) is TRUE AND A is TRUE then B is TRUE.

Triggered rules 1  A rule is triggered if antecedent is TRUE.  If a triggered rule goes on to be used it is FIRED.  If a triggered rule does not fire it FAILS, due to antecedent being FALSE/UNKNOWN or rule not being selected to fire.

Triggered rules 1  Often more than one rule is triggered at the same time.  Need a strategy for selecting a rule to fire.  Inference engine is in charge of this. Two basic approaches  Forward chaining  Backward chaining

Forward chaining 1  In this approach the inference engine works in cycles,  updating information:  Inputted  Deduced since last cycle  Next all rule whose antecedents are satisfied are triggered  Conflict set – needs to be resolved.

Security Example(Johnson and Picton 1995, pp )  Rule Database  1.IF T(image contains a face)AND T(face recognised) THEN T(open door) AND ¬T(face recognised) AND ¬T(image contains a face)  2.IF T(image contains a face) AND ¬T(face recognised) THEN T(alert security guard) AND ¬T(image contains face)  3.IF ¬T(image contains a face) THEN ¬T(open door) AND ¬T(alert security guard)

 Fact Database  ¬T(image contains a face)  ¬T(face recognised)  ¬T(open door)  ¬T(alert security guard)

 Initially  Starting at rule 1 inference engine finds it is not triggered and then moves on 2 which is also not triggered.  Rule 3 is triggered, so it fires Rules 3 setting ¬T(open door) and T(alert security guard) These were already set.  Then goes back to rule 1.

 The system has software that can the truth value of T(face recognised) automatically.  True if the face is matched in an image database.  The system can also detected if a face is in an image, setting T(image contains a face)

Scenario 1  Visitor comes to the door T(image contains a face) is set to TRUE, but face is not recognised ¬T(face recognised).  In forward chaining, start with rule 1, first antecedent is true but second is false. Does not trigger.  Rule 2 both antecedents true is triggered.  Rule 3 antecedent false does not trigger  Only rule 2 is triggered, so it fires  ¬T(alert security guard) becomes T(alert security guard)  T(image contains face) becomes ¬T(image contains face)

 System beginnings again at rule 1.  If person is still visible T(image contains face) and Rule 2 fires again.  When person is dealt with ¬T(image contains a face) in the fact database, Rules 1 and 2 will not be triggered, but rule 3 is triggered causing the alarm to the security guard to be turned off and the door will be locked.

 If a face is recognised then T(image contains a face) and T(face is recognised) in the Fact Database  Now forward chaining is the only rule triggered and will fire change the predicates ¬T(open door) to T(open door) and predicates ¬T(image contains a face) and ¬T(face is recognised) are updated.

Conflict resolution strategies  First-come, first served  Priority – as above but the rules order as the more important a rule the earlier it is in the list.  Prioritise data-fact are prioritised, rule so that antecedent fires-problem?  Recency-least recently used rule fires or rule that uses most recently updated facts  Generality – the more antecedents that are satisfied the more likely it is to be selected.

 Context- split rules in groups and only one group at time is used.  Buggins’ turn – first rule in the conflict set fires, then rules are examined, but this time starting with the one after the one that has just fired- new conflict set formed. Continues until there are no rules left in the conflict set or the only rule left is the one that just fired.

Example 2 (Johnson and Picton, 1995, pp )  Rule Database  1.IF (T(room temp<20) AND T(timer ON)) THEN T(Boiler ON)  2.IF (T(water temp<40) AND T(timer ON)) THEN T(Boiler ON)  3.IF T(Boiler ON) THEN T(Pump ON)  4.IF (T(Pump ON) AND T(room temp<20)) THEN T(valve 1 OPEN)  5.IF (T(Pump ON) AND T(water temp<40)) THEN T(valve 2 OPEN)

 6. IF ¬T(Timer ON) THEN ¬T(Boiler ON)  7. IF ¬T(room temp< 20) THEN ¬T(valve 1 OPEN)  8. IF ¬T(water temp< 40) THEN ¬T(valve 2 OPEN)  9. IF ¬T(Boiler ON) THEN ¬T(pump ON)  10. IF (¬T(water temp< 40) AND (¬T(room temp< 20)) THEN ¬T(Boiler ON)

 Facts Database  Room temp<20  Water temp<40  Timer ON  Valve 1 OPEN  Value 2 OPEN  Boiler ON  Pump ON

Scenario 2  T(Room temp<20)  ¬T(Water temp<40)  T(Timer ON)  ¬ T(Valve 1 OPEN)  ¬ T(Valve 2 OPEN)  ¬ T(Boiler ON)  ¬ T(Pump ON)

 Rules 1,8,9 are triggered if we use first-come, first served then  T(Room temp<20)  ¬T(Water temp<40)  T(Timer ON)  ¬ T(Valve 1 OPEN)  ¬ T(Valve 2 OPEN)  T(Boiler ON)  ¬ T(Pump ON)

 Assuming the external condition remain constant. Then if we used first-come, first served rules 1,3,8 trigger,  rule 1 fires again we stuck with this.

 If instead we use Buggin’s Turn, and take the first one of the new list of possibles (3,8) we take rule 3  T(Room temp<20)  ¬T(Water temp<40)  T(Timer ON)  ¬ T(Valve 1 OPEN)  ¬ T(Valve 2 OPEN)  T(Boiler ON)  T(Pump ON)

Backward Chaining  Goes the other way around to forward starting with the consequent and following the antecedents.  Goal orientated approach.  Using the example in Artificial Intelligence (Winston 1984)

Rules 10, 5 and 2  Rule 10  If T (animal is a carnivore) AND T(animal has tawny colour) AND T(animal has dark spots) THEN T(animal is a cheetah)  Rule 5  If T (animal is a mammal) AND T(animal eats meat) THEN T(animal is a carnivore)  Rule 2  If T (animal gives milk) THEN T(animal is a mammal)

Is it a cheetah?  Rule 10 has a consequent predicate that matches what we looking for. So we have our goal.  We now work backwards and see if the antecedents fit.  So lets say that it is a tawny colour animal with dark spots so two of the antecedents are true.  The third we need to find a definition of a carnivore (rule 5)

Is it a carnivore?  Rule 10 left us needing to find out what is a carnivore. Is there a Rule that has a consequent that matches this question.  Now we look at the antecedents assuming they are true then we have an intermediate goal of it is a carnivore.  But what does a mammal mean – We need to rule 2

 So now the system works backwards starting with does it give milk, eat meat, have tawny colour and darks spots.  So eventually the system finds the necessary facts in its facts database or obtains the information which is then added to the facts database  So rules 2, then 5 and then 10 would fire.

Not a cheetah  If the cheetah rule is not fired. The system looks another rule.  During backward chaining get intermediate facts (e.g. mammal and carnivore) these are useful when the system does not fire.

Example 2 (Johnson and Picton, 1995, pp )  Rule Database  1.IF (T(room temp<20) AND T(timer ON)) THEN T(Boiler ON)  2.IF (T(water temp<40) AND T(timer ON)) THEN T(Boiler ON)  3.IF T(Boiler ON) THEN T(Pump ON)  4.IF (T(Pump ON) AND T(room temp<20)) THEN T(valve 1 OPEN)  5.IF (T(Pump ON) AND T(water temp<40)) THEN T(valve 2 OPEN)

 6. IF ¬T(Timer ON) THEN ¬T(Boiler ON)  7. IF ¬T(room temp< 20) THEN ¬T(valve 1 OPEN)  8. IF ¬T(water temp< 40) THEN ¬T(valve 2 OPEN)  9. IF ¬T(Boiler ON) THEN ¬T(pump ON)  10. IF (¬T(water temp< 40) AND (¬T(room temp< 20)) THEN ¬T(Boiler ON)

Diagnostic use of backward chaining.  Room heating is off but room is cold use backward chaining to find the problem (assuming mechanics all working)  Possibilities  ¬ T(Boiler ON)  ¬ T(Pump ON)  ¬ T(Valve 1 OPEN)  The known fact  T(Room temp<20)  Go through the possibilities

¬ T(Boiler ON)  Need to find a rule that has this as a consequent. We have two  Rule 6:  IF ¬T(Timer ON) THEN ¬T(Boiler ON)  Rule 10:  IF (¬T(water temp< 40) AND (¬T(room temp< 20)) THEN ¬T(Boiler ON)

Rule 10  The known fact is:  T(Room temp<20)  Rule 10  IF (¬T(water temp< 40) AND (¬T(room temp< 20)) THEN ¬T(Boiler ON)  So Rule 10 can not fire.

Rule 6  IF ¬T(Timer ON) THEN ¬T(Boiler ON)  We don’t what the state of the timer is so we need to look for a rule to find if the timer is on or not. No rule has ¬T(Timer ON) as a consequence.  So we can not go any further and we can have ¬T(Timer ON) has a possible reason.

¬ T(Pump ON)  Trying out the second possibility.  Rule 9: IF ¬T(Boiler ON) THEN ¬T(pump ON)  So we need to check if boiler is not on.  We just done this so again a possible reason is ¬T(Timer ON)

¬ T(Valve 1 OPEN)  Trying the third possibility.  Rule 7  IF ¬T(room temp< 20) THEN ¬T(valve 1 OPEN)  So the antecedent is FALSE so this not a possibility.

Diagnostic conclusion  One conclusion is the timer is off.

 Knowledge-base: Contains facts and rules  Inference engine: input information is combined with rules and facts to make decisions and construct new information.

References  Johnson J and Picton P (1995) Mechatronics : designing intelligent machines. - Vol.2 : concepts in artificial intelligence Oxford : Butterworth- Heinemann pg  Winston PH (1984) Artificial Intelligence Addison- Wesley cited by Johnson and Picton (1995)