Production Systems Productions systems are rule based forward chaining systems. They are based on forward chained reasoning, but are extended to be a kind.

Slides:



Advertisements
Similar presentations
10/4/2003COMP 474/674 Fall 2003 Michelle Khalife1 Conflict Resolution in CLIPS COMP 474/674 FALL 2003 Michelle Khalifé.
Advertisements

1 Rule Based Systems Introduction to Production System Architecture.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Reasoning Forward and Backward Chaining Andrew Diniz da Costa
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.
The CLIPS Programming Tool History of CLIPS –Influenced by OPS5 and ART –Implemented in C for efficiency and portability –Developed by NASA, distributed.
Web Science & Technologies University of Koblenz ▪ Landau, Germany Implementation Techniques Acknowledgements to Angele, Gehrke, STI.
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,
1 01/12/2011Knowledge-Based Systems, Paula Matuszek Intro to CLIPS Paula Matuszek CSC 9010, Spring, 2011.
Intelligent systems Lecture 6 Rules, Semantic nets.
Rule Based Systems Michael J. Watts
Expert System Human expert level performance Limited application area Large component of task specific knowledge Knowledge based system Task specific knowledge.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
1 FOL CS 331/531 Dr M M Awais Unification “It is an algorithm for determining the substitutions needed to make two predicate calculus expressions match”
1 FOL Resolution based Inferencing Resolution based rules studied earlier can lead to inferences, rules such as modus ponen, unit resolution etc… Other.
Introduction to Expert Systems
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.
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.
Methods of Proof Chapter 7, second half.
© C. Kemke Control 1 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.
Knoweldge Representation & Reasoning
EXPERT SYSTEMS Part I.
CS 561, Session 25 1 Introduction to CLIPS Overview of CLIPS Facts Rules Rule firing Control techniques Example.
Inference in First-Order Logic Inference Rules with Quantifiers The three new inference rules are as follows: Universal Elimination: For any sentence ,
Cooperating Intelligent Systems Inference in first-order logic Chapter 9, AIMA.
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,
 Architecture and Description Of Module Architecture and Description Of Module  KNOWLEDGE BASE KNOWLEDGE BASE  PRODUCTION RULES PRODUCTION RULES 
Logical Inference 2 rule based reasoning
Jess: A Rule-Based Programming Environment Reporter: Yu Lun Kuo Date: April 10, 2006 Expert System.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
Rule Based Systems  If then  Rules to solve problems  What is forward chaining?  What is backward chaining?  Expert systems.
COM362 Knowledge Engineering Inferencing 1 Inferencing: Forward and Backward Chaining John MacIntyre
An Introduction to Artificial Intelligence – CE Chapter 9 - Inference in first-order logic Ramin Halavati In which we define.
1 Knowledge Based Systems (CM0377) Lecture 10 (Last modified 19th March 2001)
1/19 Inference in first-order logic Chapter 9- Part2 Modified by Vali Derhami.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Inference in First Order Logic. Outline Reducing first order inference to propositional inference Unification Generalized Modus Ponens Forward and backward.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Forward and Backward Chaining
Expert System Seyed Hashem Davarpanah University of Science and Culture.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
1 Chaining in First Order Logic CS 171/271 (Chapter 9, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Artificial Intelligence: Applications
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
EA C461 Artificial Intelligence
Presented By S.Yamuna AP/CSE
Rules: Knowledge Representation & Manipulation
Inference in first-order logic
Inference in First-Order Logic
Chapter 9. Rules and Expert Systems
EA C461 – Artificial Intelligence Logical Agent
Knowledge Representation & Reasoning
Inference in first-order logic part 1
Example of Knowledge Base
Artificial Intelligence
Forward Chaining DFS can supply compatible bindings for forward chaining.
Inference in first-order logic part 1
Chapter 9. Rules and Expert Systems
Methods of Proof Chapter 7, second half.
CS 8520: Artificial Intelligence
Presentation transcript:

Production Systems Productions systems are rule based forward chaining systems. They are based on forward chained reasoning, but are extended to be a kind of programming language systems. Systems exist that can handle several thousand rules efficiently.

What is Production Systems  Algorithmic,procedural (C,FORTRAN)  Applicative,functional (LISP)  Logic programming (PROLOG)  Object oriented (Smalltalk,Java,Simula)  Hybrid systems (KEE,NEXPERT,ART) Forward chained Rule based Symbolic Rules comunicate only through Working Memory

When is Production Systems used When the knowledge is present on the form situation-action When the program control is very complex, i.e. no algorithm When the program is expected to be heavily extended and modified over a long period

Good applications for FC Good applications for BC Conclusions Hypothesis Evidence Facts Forward and Backward chaining Narrow and deep Broad and shallow

Incremental forward chaining % rule '9.3' american(X) and weapon(Y) and sells(X,Y,Z) and hostile(Z) => criminal(X). % rule '9.6' missile(X) and owns(nono,X) => sells(west,X,nono). % rule '9.7' missile(X) => weapon(X). % rule '9.8' enemy(X,america) => hostile(X). % facts t=> owns(nono,m1). % 9.4 t=> missile(m1). % 9.5 t=> american(west). % 9.9 t=> enemy(nono,america). % 9.10 Derivations: + owns(nono,m1) + missile(m1) + sells(west,m1,nono) + weapon(m1) + american(west) + enemy(nono,america) + hostile(nono) + criminal(west)

Forward chaining Proxy format rule '9.3' if american(X) and weapon(Y) and sells(X,Y,Z) and hostile(Z) then criminal(X). rule '9.6' if missile(X) and owns(nono,X) then sells(west,X,nono). rule '9.7' if missile(X) then weapon(X). rule '9.8' if enemy(X,america) then hostile(X) facts owns(nono,m1) and % 9.4 missile(m1) and % 9.5 american(west) and % 9.9 enemy(nono,america). % 9.10 Derivations *** 9.6 ==> sells(west,m1,nono) *** *** 9.7 ==> weapon(m1) *** *** 9.8 ==> hostile(nono) *** *** 9.3 ==> criminal(west) *** *** Time 0 ms

Production Systems Forward Chained All communictations via Working Memory (WM). 1.[Matching] Find all the rules whose premise are satisfied 2.[Conflict Resolution] If more than one rule apply, select the one with the highest priority 3.[Execution] Execute(fire) the rule selected. The execution will change the WM. 4.Then start again from top.

Efficiency considerations 1 Forward reasoning can be done in levels. Every new fact must be derived from at least 1 fact in the previous level. This is true because inference mechanism that does not require a new fact from level t-1 could have been done at in level t-1 already.

Efficiency considerations 2 With suitable indexing, it is easy to identify all the rules that can be triggered by a new fact. Typically, there are many more rules than facts in a production system rule base. Rules Facts

Efficiency considerations 3 Forward chaining gives a lot of irrelevant facts. One way to avoid this is to simulate backward chaining. This means that goals and subgoals are explicitly represented and used to control the reasoning. Another way is to restrict forward chaining to a subset of rules.

Efficiency considerations 4 (according to AIMA) A method is to rewrite the rule set using information about the goal so that only relevant variable bindings – those belonging to a magic set – are considered during forward inference. For instance, if the goal is criminal(west), the rule that concludes criminal(X) is prefixed with an extra conjunct magic(X) and american(X) and weapon(X) and sells(X,Y,Z) and hostile(Z) => criminal(X) which avoids redundant inferences if west is in the magic set.

Efficiency considerations 5 There may be 300 mill americans but only 5(?) hostile nations. It may be smart to reorder the condition sequence of the rules in increasing ”plurality”. not american(X) and weapon(X) and sells(X,Y,Z) and hostile(Z) => criminal(X) but hostile(Z) and sells(X,Y,Z) and weapon(X) and american(X) => criminal(X)

Facts searching for rules FACTSRULES FACTS Facts searching for rules Rules searching for facts

The Rete(*) algorithm This algortithm preprocesses the set of rules in the knowledge base to construct a set of dataflow network in which each rule is a literal from the rule premise. Variable bindings flow through the network and are filtered out when they fail to match a literal. … At any given point, the state of a rete network captures all the partial matches of the rules, avoiding a great deal of recomputation. Efficient algorithm to match facts against (patterns) of rules to determine which rules have all its conditions fullfilled (*) pronounced as ”treaty”. Means ”net” in Latin

Production systems and applications System Application R1 XCON (configuration of VAX computers) OPS-5 Several applicatons CLIPS Severl applications, used by NASA ACT Cognitive architecture SOAR Cognitive architecture with learning PRAGMA BusTUC ( natural language interpretation) PROXY Education

Production system PROXY PRO log implementationof produ X ion s Y stem All communictations via Working Memory (WM). 1.[Matching] Find the first rule whose premise are satisfied 2.[Conflict Resolution] The first has highest priority 3.[Execution] Execute(fire) the rule selected. The execution will change the WM. Then start from top.

Conflict Resolution Strategies First found Least recently used Most recently used Antecedent ordered Consequent ordered Most complex first Simplest first Rule priority User defined Refraction (don’t fire twice in sequence) Recency (the newest fact has priority) Specificity (the rule that matches most facts) Arbitrary choice Menu ”LEX” strategy

The logic of Proxy ”Imperative logic” Indicative Logic If Conditions then Conclusions Productions If Conditions then Actions Imperative Logic If Conditions then cause Conclusions

PROXY implementation outline proxy:- repeat, not epoch. epoch :- ( if P then Q ), P, not Q, assert Q. % repeat until % epoch fails % find a rule % check that P is true % and not Q is true % put Q into KB Alternative for negative conclusions epoch :- ( if P then not Q ), P, Q, retract Q.

Proxy’s Refraction Rule Proxy requires that all the conditions and not all the conclusions are true when a rule fires. Then all the conclusions will be made true by the imperative logic, so the same rule will not fire the next time. The method is not particularly efficient, but suffices for small to medium rule bases (< 1000 rules). Refraction (from refrain)

CLIPS C Language Implementation of production Systems Example of rule format (defrule become-adult (child harry) (birthday harry August-15) (age harry 17) (date today August-15) => (assert (adult harry)) (retract (child harry)) (retract (age harry 17)) (assert (age harry 18)) (print t “harry is now an adult”))

OPS-5 with example of rules for goal based reasoning English version IF there is a goal for monkey to be on some physical object and the object is at a particular location and the monkey is at some location holding something THEN establish a goal for the monkey to hold nothing. (p On::Phys-Object:Holds (goal ^status active ^type on ôbject-name ) (phys-object ^name ^at ) (monkey ^at ^holds <> nil) --> (make goal ^status active ^type on ^object-name nil))

Pragma Example of Pragma rule (to be shown), Purpose: If time requested is before 430 (today) (" half past four" ) and time now is after requested time then change time requested to time requested and change day to tomorrow. Pragma is a production system for translating the natural language queries (in the form of an intermediate meaning representation language TQL) to a database query. At present, there are 1329 rules. In average, 10 rules are fired. The time used is negligable.

Pragma rule example then Sixteen isa clock, not Four isa clock, srel/Prep/time/Sixteen/D, not srel/Prep/time/Four/D, queryitem(atday(TOMORROW)), queryitem(atdate(TODATE1)), message( ‘I assume you mean routes for tomorrow'). rule defaulttomorrowafternoon if srel/Rel/time/Four/_, not _ isa midnight, not _ isa morning, not _ isa prenoon, not _ isa afternoon, not _ isa evening, not _ isa night, not _ isa date, not _ isa weekday, {Four < 0430, Sixteen is Four )}, queryitem(timenow(NOW)), {NOW > Sixteen} queryitem(today(TODAY)), queryitem(todaysdate(TODATE)), { daysucc(TODAY,TOMORROW)}, { add_days(TODATE,1,TODATE1)},