1 Rule Based Systems Introduction to Production System Architecture.

Slides:



Advertisements
Similar presentations
Rule-based representation
Advertisements

Assignments An Exercise in Building a KBS. Assignments  Goals: Exercise in the building of a simple KBS  Implementation of a simple knowledge base 
Truth Maintenance Systems. Outline What is a TMS? Basic TMS model Justification-based TMS.
Rulebase Expert System and Uncertainty. Rule-based ES Rules as a knowledge representation technique Type of rules :- relation, recommendation, directive,
Reasoning Forward and Backward Chaining Andrew Diniz da Costa
CS 484 – Artificial Intelligence1 Announcements Choose Research Topic by today Project 1 is due Thursday, October 11 Midterm is Thursday, October 18 Book.
Forward Chaining and Backward Chaining. Inference Engine cycles via a match-fire procedure Knowledge Base Database Fact:A isx MatchFire Fact:B isy Rule:
Inferences The Reasoning Power of Expert Systems.
Expert System Shells - Examples
Conflict Resolution  what to do if there is more than 1 matching rule in each inference cycle? match WM with LHS of rules select one rule (conflict resolution)
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.
Intelligent systems Lecture 6 Rules, Semantic nets.
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.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Introduction to Expert Systems
 Negnevitsky, Pearson Education, Lecture 2 Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation.
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
Designing A KBS Rulebase Expert System Uncertainty Management
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.
Rules and Expert Systems
© C. Kemke1Reasoning - Introduction COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.
Production Rules Rule-Based Systems. 2 Production Rules Specify what you should do or what you could conclude in different situations. Specify what you.
EXPERT SYSTEMS Part I.
Artificial Intelligence Chapter 17 Knowledge-Based Systems Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Modelling planning problems using PDDL
Artificial Intelligence CSC 361
© Negnevitsky, Pearson Education, Lecture 2 Introduction, or what is knowledge? Introduction, or what is knowledge? Rules as a knowledge representation.
1 Backward-Chaining Rule-Based Systems Elnaz Nouri December 2007.
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.
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,
School of Computer Science and Technology, Tianjin University
Knowledge based Humans use heuristics a great deal in their problem solving. Of course, if the heuristic does fail, it is necessary for the problem solver.
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 
Jess: A Rule-Based Programming Environment Reporter: Yu Lun Kuo Date: April 10, 2006 Expert System.
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
CSE Winter 2008 Introduction to Program Verification January 15 tautology checking.
Chapter 4: Inference Techniques
Chapter 9. Rules and Expert Systems Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
1 Intelligent Systems and Control Rule-based expert systems n Introduction, or what is knowledge? n Rules as a knowledge representation technique n The.
Artificial Intelligence
Forward and Backward Chaining
Expert System Seyed Hashem Davarpanah University of Science and Culture.
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.
Summary for final exam Agent System..
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
Rule-based expert systems
Artificial Intelligence Chapter 17 Knowledge-Based Systems
Introduction to Expert Systems Bai Xiao
Knowledge-Based Systems Chapter 17.
Artificial Intelligence Chapter 17 Knowledge-Based Systems
Architecture Components
CS62S: Expert Systems Based on:
Knowledge Representation and Inference
Artificial Intelligence Chapter 17. Knowledge-Based Systems
Chapter 9. Rules and Expert Systems
Artificial Intelligence Chapter 17 Knowledge-Based Systems
Presentation transcript:

1 Rule Based Systems Introduction to Production System Architecture

2 Rules and ‘Productions’ ‘Production’ - a rule for changing grammar Englishs regular verbs –regular_verb + (past) --> verb + ‘ed’ Pig-latin productions –consontant string  string + consonant + ‘ay’ –vowel + string  string + ay Is this enough? What do we have to add? Can you reverse it?

3 Work through this production system to decode the result z  l u  p p  h lw  llo q  r v  w r  e uqzv  ??

4 Rules Form –IF antecedent THEN conclusion –IF condition THEN action –IF antecedent THEN goal Interpreters –Backward chaining »Trigger on conclusion/goal –Forward chaining »Trigger on antecedent/condition

5 Rules and Logic Rules are really statement in logic –About what we believe to be true –About what should occur Translation 1 - situations –IF may_rain THEN should_take_umbrella  s. Situation s  May_rain s  Take_umbrella s “For all s, if s is a situation & s is a may_rain situation, then s is a take_umbrella situation.

6 Rules and Logic Translation 2 - implied objects –IF may_rain THEN should_take_umbrella  wp. Weather w  Person p  May_rain w  Out_in p w  Take_umbrella p “For all w and p, if w is a weather and w is may_rain weather and p is a person and p is out in w, then p (should) take an umbrella.” Translations: be careful of the words –The words are just symbols »They have no meaning except help human know what the symbols are for »Just like variable names - could all be x,y,z...  wp. W w  P p  M w  O p w  T p

7 Forward and Backward Chaining Rules –r1: IF may_rain THEN should_take_umbrella –r2: IF cloudy THEN may_rain Questions –“Should I take an umbrella?” –“What should I do if it is cloudy?” How did you answer the questions? –Which part of the rule did you look for? (‘match’)

8 Backward Chaining Rules –R1: IF may_rain THEN should_take_umbrella –R2: IF cloudy THEN may_rain “Should I take an umbrella?” –“Do the rules indicate I should take an umbrella? »Is there a rule about “taking umbrellas”? R1: goal: should_take_umbrella »How can I prove that goal? What has to be true for r1 to hold? –may_rain is the antecedent of r1 »Can I prove that it may_rain? R2: goal: may_rain »How can I prove that goal2 What has to be true for r2 to hold –cloudy is the antecedent of r2 »How can I prove ‘cloudy’?

9 Backward Chaining Goal_1  Goal_2 Goal_2  Goal_3 Goal_3  Goal_4 Goal_4  Goal_5 Question rules Direction of reasoning

10 Backward Chaining Rules –R1: IF may_rain THEN should_take_umbrella –R2: IF cloudy THEN may_rain –R3: IF may_be_intense_sun THEN should_take_umbrella –R4: IF summer AND in_tropics THEN may_be_intense_sun “Should I take an umbrella?” –“Do the rules indicate I should take an umbrella? »Is there are rule about “taking umbrellas”? R1: goal: should_take_umbrella »What is antecedent for r1? R1:antecedent may_rain »Can I prove that it may_rain? R2: goal: may_rain »How can I prove may_rain R2:antecedent: cloudy »BUT NOT CLOUDY!

11 Backward Chaining: Backtracking Rules –R1: IF may_rain THEN should_take_umbrella –R2: IF cloudy THEN may_rain –R3: IF may_be_intense_sun THEN should_take_umbrella –R4: IF summer AND in_tropics THEN may_be_intense_sun “Should I take an umbrella?” »Are there any other rules about umbrellas? R3: goal: should_take_umbrella »What is antecedent of R3? R3:antecedent: summer AND in tropics

12 Backwards Chaining with Backtracking Goal_1  Goal_2 Goal_2  Goal_3 Goal_3  Goal_4 Goal_4  Goal_5 Question rules fail Goal_6  Goal_4 Goal_7  Goal_6 Goal_8  Goal 7 Direction of reasoning

13 Backwards Chaining Systems MYCIN –‘The original expert system’ »Diagnosis of acute infections (Meningitis, blood infections) Still a good example of how it works »Also used uncertain reasoning Explanation –‘How’ did you prove that? –‘Why’ are you asking me that? »Never used ‘for real’ PROLOG –One of the two standard AI languages »A simple backwards chaining engine with backtracking

14 Backwards Chaining Engines usually written ‘backwards’ Goal  Antecedent –Umbrella  may_rain –may_rain  cloudy Prolog ‘Edinburgh’ notation –umbrella :- may_rain. –may_rain :- cloudy. NB upper and lower case very important in Prolog In KnowledgeWorks –(defrule r1 :backward ) »Or special functions ‘any’, ‘test’, and ‘not’ Awkward - don’t try it first time.

15 Forward Chaining Rules –R1: IF may_rain THEN should_take_umbrella –R2: IF cloudy THEN may_rain “What should I do if it is cloudy?” –“What do the rules indicate I should do if it is cloudy?” »Is there a rule that applies when it is cloudy? R2: antecedent: cloudy »What do I conclude from that antecedent, ‘cloudy’ R2: conclusion: may_rain »Is there a rule that applies when it may_rain? R1: antecedent: may_rain »What do I conclude from that antecedent: ‘may_rain’ R1: conclusion: should_take_umbrella

16 Forward chaining ‘Production Systems’ –Vocabulary used differently on west and east coast of US for many years »On east coast, ‘production systems’ means forward chaining »On west coast, ‘production systems’ just means rule based systems –Usually, and in this course, ‘Production System’ means ‘forward chaining’ Classic system is OPS5 Basic strategy of KnowledgeWorks

17 Forward Chaining Fact_1  Fact_2 Fact_2  Fact_3 Fact_3  Fact_4 Fact_4  Fact_5 Action=Fact_5 rules Direction of reasoning Fact_1

18 Consider R1: IF sky=cloudy THEN expect=rain R2: IF expect=?X THEN weather=?X R3: IF sky=cloudy AND temperature=freezing THEN expect=snow R4: IF weather=rain THEN termperature=above_freezing What happens if ‘sky=cloudy’? What happens if ‘sky=cloudy and ‘temperature=freezing’? Conflict Resolution

19 Production system interpreter Objectives: –Fire rules as the facts come in to the knowledge base –Never fire a rule unless its conditions are satisfied –Fire every rule whose conditions are satisfied Are these objectives consistent. –Forward chaining rules sometimes called ‘demons’ »From a system called “Pandemonium” –How can they be made consistent?

20 Production System Strategy All rules tested at each cycle Only one rule fires at a time

21 Production System Cycle 1Test all rules 2Put all rules satisfied into the ‘conflict set’ 3Choose one rule from the conflict set 4Fire the rule 5Update the dynamic database 6Repeat until goal reached or no more rules satisfied

22 Conflict Resolution R1: IF sky=cloudy THEN expect=rain R2: IF expect=?X THEN weather=?X R3: IF sky=cloudy AND temperature=freezing THEN expect=snow R4: IF weather=rain THEN termperature=above_freezing What happens if ‘sky=cloudy’? What happens if ‘sky=cloudy and ‘temperature=freezing’?

23 Possible Conflict Resolution Strategies Specificity Priority Lexical Ordering Source file ordering Explicit rules for conflict resolution –a rule based system within a rule based system

24 Basic Production System Architecture Dynamic Memory Rule Store Conflict Set Rule Execution tickle check satisfactionSelect (resolve conflicts) execute

25 Modules (Contexts) & Agendas How to modularise RBSs Agenda = Sequence of modules (Stack) Module = Named Set of rules –(Rule MODULE::rule_name IF...THEN...) Contexts popped off stack when finished.

26 Agenda/Modules Example focussearch stuck defrule search::r1 IFhero is at ?Place-1 & ?Place-1 gives_access_to ?Place-2 THENmove hero to ?Place-2 defrule stuck::r1 IF context stuck & hero is at ?Place not ?Place = goal THENask-user “What do I do now?”

27 Expert Systems Configuring systems defruleBACKPLANE_STRUCTURE::R1 IFthe_processor IS in place ANDthe_devices_to_mount INCLUDE ?Device THENmount ?Device defruleBACKPLANE_STRUCTURE::R1 IFmount ?Device AND?Slot_1 IS_A backplane_slot ANDNOT lower_number_available_than ?Slot_1 ?Slot_2 THEN?Slot_1 is_occupied_by ?Device AND?Device is_mounted.

28 The Structure of Heuristics Trigger Constraints Antecedents Actions Conclusions Control

29 Formalising Heuristics Triggers –quick & sensitive Constraints –quick & specific Antecedents –complete and sufficient Actions Conclusions Control

30 Formalising Heuristics Triggers Constraints Antecedents Actions –Things effecting the outside world Conclusions –New facts for the dynamic data base Control –changes to agenda