© C. Kemke Control 1 COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.

Slides:



Advertisements
Similar presentations
CSC 4181 Compiler Construction Scope and Symbol Table.
Advertisements

© C. Kemke Constructive Problem Solving 1 COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.
10/4/2003COMP 474/674 Fall 2003 Michelle Khalife1 Conflict Resolution in CLIPS COMP 474/674 FALL 2003 Michelle Khalifé.
1 Rule Based Systems Introduction to Production System Architecture.
Rules, page 1 CSI 4106, Winter 2005 Representing knowledge with rules Points Definitions Production systems Conflict resolution strategies Examples A financial.
CS 484 – Artificial Intelligence1 Announcements Choose Research Topic by today Project 1 is due Thursday, October 11 Midterm is Thursday, October 18 Book.
(FO) Inference Methods CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
The CLIPS Programming Tool History of CLIPS –Influenced by OPS5 and ART –Implemented in C for efficiency and portability –Developed by NASA, distributed.
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)
Samad Paydar Ferdowsi University of Mashhad.  C Language Integrated Production System (CLIPS)  A tool for building expert systems  An expert system.
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.
November 2, 2004AI: CLIPS Language Tutorial1 Artificial Intelligence CLIPS Language Tutorial Michael Scherger Department of Computer Science Kent State.
Chapter 8 Pattern Matching
© C. Kemke CLIPS 1 1 COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.
Chapter 7: Introduction to CLIPS
CLIPS C Language Integrated Production System Note: Some slides and/or pictures are adapted from Lecture slides / Books of Dr Zafar Alvi.
Artificial Intelligence Lecture No. 18 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Intelligent systems Lecture 6 Rules, Semantic nets.
Rule Based Systems Michael J. Watts
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.
© C. Kemke1Expert Systems Tasks COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.
© C. Kemke1Reasoning - Introduction COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.
Introduction to CLIPS (Chapter 7) Fact List (contains data) Knowledge Base (contains rules) Inference Engine (controls execution)
© 2002 Franz J. Kurfess Introduction 1 CPE/CSC 481: Knowledge-Based Systems Dr. Franz J. Kurfess Computer Science Department Cal Poly.
Expert Systems 3 1 Rewriting Rules, CLIPS Content of this lecture: 1.Interpretation of rules 2.Example: CLIPS Sorting 3.Non-determinism 4.Control regimes:
Mary Lou Maher MIT Fall 2002 Jess: A Production System Language Agent-Based Virtual Worlds.
1 Pertemuan 6 RULE-BASED SYSTEMS Matakuliah: H0383/Sistem Berbasis Pengetahuan Tahun: 2005 Versi: 1/0.
© C. Kemke CLIPS 1 1 COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.
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.
By: 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.
Chapter 9: Modular Design, Execution Control, and Rule Efficiency Expert Systems: Principles and Programming, Fourth Edition.
EXPERT SYSTEMS Part I.
Introduction to Jess.
CS 561, Session 25 1 Introduction to CLIPS Overview of CLIPS Facts Rules Rule firing Control techniques Example.
1 01/12/2011Knowledge-Based Systems, Paula Matuszek More Intro to CLIPS Paula Matuszek CSC 9010, Spring, 2011.
Chapter 9: Modular Design, Execution Control, and Rule Efficiency Expert Systems: Principles and Programming, Fourth Edition.
1 Programming a Knowledge Based Application. 2 Overview.
Chapter 7: Introduction to CLIPS Expert Systems: Principles and Programming, Fourth Edition.
Features, Policies and Their Interactions Joanne M. Atlee Department of Computer Science University of Waterloo.
Sudoku Hands-on Training Masters Project Presentation Yiqi Gao March 19, 2014.
Chapter 9: Rules and Expert Systems Lora Streeter.
Jess: A Rule-Based Programming Environment Reporter: Yu Lun Kuo Date: April 10, 2006 Expert System.
Java Expert System Shell JESS 報告者 : 江梓安. Why we need an expert systems? Conventional programming languages Conventional programming languages Complex.
Expert System Note: Some slides and/or pictures are adapted from Lecture slides / Books of Dr Zafar Alvi. Text Book - Aritificial Intelligence Illuminated.
Expert Systems Chapter 7 Introduction to CLIPS Entering and Exiting CLIPS A> CLIPS  CLIPS (V6.5 09/01/97) CLIPS> exit exit CLIPS> (+ 3 4)  7 CLIPS>
Artificial Intelligence Lecture No. 26 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Introduction to CLIPS. Expert Systems: Principles and Programming, Fourth Edition2 What is CLIPS? CLIPS is a multiparadigm programming language that provides.
1 Knowledge Based Systems (CM0377) Lecture 10 (Last modified 19th March 2001)
Inferencing in rule-based systems: forward and backward chaining.
Artificial Intelligence Lecture No. 19 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Mostly adopted from Jason Morris notes (Morris Technical Solutions)
Forward and Backward Chaining
Artificial Intelligence Lecture No. 22 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Expert System Seyed Hashem Davarpanah University of Science and Culture.
Intelligent systems Lecture 11 Tools for development of Expert Systems.
The CLIPS Expert System Shell Dr Nicholas Gibbins
Artificial Intelligence: Applications
Summary for final exam Agent System..
Jörg Kewisch, June 10, 2013, LILUG Meeting CLIPS C Language Integrated Production System Developed at the Software Development Branch, NASA Lyndon B. Johnson.
Lecture 20. Recap The main components of an ES are –Knowledge Base (LTM) –Working Memory (STM) –Inference Engine (Reasoning)
Intelligent Systems JESS constructs.
Chapter 7: Introduction to CLIPS
بسم الله الرحمن الرحیم آموزش نرم افزار CLIPS
Computer Based Tutoring
Presentation transcript:

© C. Kemke Control 1 COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba

© C. Kemke Control 2 Rule-based Systems Control u Procedural Control u Conflict Resolution Strategies u Salience u Modules

© C. Kemke Control 3 Procedural Control if-then-else while-do

© C. Kemke Control 4 Procedural Control in Actions  Procedural Control Elements can appear on the RHS of a rule or in message-handlers of classes. ( if then + [else + ]);; else-part optional ( while [do] * ]);;‘ do’ not mandatory

© C. Kemke Control 5 Example – if-then-else (defrule special-age “18, 21, 100” (or (person (name ?name) (age ?age&18)) (person (name ?name) (age ?age&21)) (person (name ?name) (age ?age&100))) => (if (= ?age 18) then (printout t ?name “ can buy beer in Canada.”) else (if (= ?age 21) then (printout t ?name “ can buy beer in the USA.”) else (if (= ?age 100) then (printout t “The major will visit ” ?name ))...)

© C. Kemke Control 6 Rule Activation and Execution  Pattern Matching, Rule Activation, Rule Execution  Conflict Set, Conflict Resolution, Strategies

© C. Kemke Control 7 Facts, Rules, Pattern Matching  Forward-chaining systems begin with an initial set of facts and in an inference process generate new facts until a goal state is reached.  Facts are entered into the Working Memory (WM).  The conditions of each rule are matched to these facts  Pattern Matching (e.g. Rete Algorithm)  Rules whose conditions are satisfied are activated and entered on the agenda.

© C. Kemke Control 8 Rule Activation  The pattern matching algorithm determines, in which sequence rules are being activated, i.e. placed on the agenda.  In CLIPS, you cannot easily determine the sequence of rule activations.  Thus, do not write programs, which implicitly depend on a certain sequence of facts activating rules.

© C. Kemke Control 9 Conflict Resolution  The set of activated rules on the agenda is called the Conflict Set.  Choosing which of the activated rules to fire next is known as Conflict Resolution.  A simple strategy is to select rules according to the order, in which they are put on the agenda. CLIPS, for example, uses a stack (last-in first- out).  There are different types of Conflict Resolution Strategies.

© C. Kemke Control 10 Conflict Resolution Strategies There are two categories of strategies:  global strategies  local strategies Global Strategies are domain-independent and part of the Rule Interpreter/Inference Engine. Local Strategies are domain-dependent and implemented as part of the Rule Base.

© C. Kemke Control 11 Conflict Resolution: Refractoriness  Refractoriness Forward chainers typically implement a refractory conflict resolution strategy - once a rule is fired, it isn't used again on the same data

© C. Kemke Control 12 Conflict Resolution: Specificity  Specificity: Choose a rule with the most conditions or the most specific conditions ahead of a more general rule (prefer most specific knowledge instead of general knowledge)

© C. Kemke Control 13 Conflict Resolution: Recency  Recency: Fire a rule first that is activated by a fact just added to Working Memory, i.e. fire most recently activated rule first (  focus on one line of reasoning, with all related facts and rules)

© C. Kemke Control 14 Explicit Control  Salience  Meta-Rules

© C. Kemke Control 15 Salience  We can use salience measures to prioritize rules.  CLIPS provides a built-in method for prioritizing rules: (declare (salience value))  Salience values can range from to Default is 0.  We can thus force the execution of one rule over another. We can implement sequencing of rules.

© C. Kemke Control 16 Rule Prioritization in Clips  for example, consider the following rules... (forced order of execution)

© C. Kemke Control 17 Two Nifty Rules (defrule fire-first (declare (salience 30)) (priority first) => (printout t "Print First" crlf) ) (defrule fire-second (declare (salience 20)) (priority second) => (printout t "Print Second" crlf) )

© C. Kemke Control 18 And One More... (defrule fire-third (declare (salience 10)) (priority third) => (printout t "Print Third" crlf) )

© C. Kemke Control 19 Getting Ready to Run... (assert (priority second)) (assert (priority first)) (assert (priority third)) (agenda) 30 fire-first: f-2 20 fire-second: f-1 10 fire-third: f-3 For a total of 3 activations.

© C. Kemke Control 20 Running This...  The CLIPS agenda acts like a stack - last rule on, first fired  If salience were not used, the third rule, then the first, then the second would fire, due to the sequence of facts and activation of rules: (assert (priority second)) (assert (priority first)) (assert (priority third))

© C. Kemke Control 21 Reasoning Control Classes of Rules

© C. Kemke Control 22 Categories of Rules  Salience values are arbitrary; often what we want is that a certain class of rules are considered before others.  This can be built into the rules themselves using a kind of 'tag' IF (status is check-for-emergencies).... and employed by setting a fact to allow various categories of rules to be selected - for example, asserting that the status is check-for-emergencies  Another rule can be implemented to change status to the next group of rules.

© C. Kemke Control 23 Categories Example (deffacts control-information (phase detection) (phase-after detection isolation) (phase-after isolation recovery) )

© C. Kemke Control 24 Categories Example (defrule change-phase (declare (salience -10)) ?phase <- (phase ?current-phase) (phase-after ?current-phase ?next-phase) => (retract ?phase) (assert (phase ?next-phase) )  Context Limiting

© C. Kemke Control 25 Another Way... (deffacts control-information (phase detection) (phase-sequence isolation recovery detection))

© C. Kemke Control 26 Another Way... (defrule change-phase (declare (salience -10)) ?phase <- (phase ?current-phase) ?list <- (phase-sequence ?next-phase $?other-phases) => (retract ?phase ?list) (assert (phase ?next-phase) (assert (phase-sequence ?other-phases ?next-phase)) )

© C. Kemke Control 27 Explanation  Note the $?other-phases  The $ operator causes the variable to be bound to several symbols (the remainder of the list of phases, in this case) rather than one. Note that the $ is not part of the variable name and isn't used later when referencing the variable.

© C. Kemke Control 28 Explanation  This approach could be used in a monitoring or control system - forward reasoning is typically used in such systems because we get information, then want to see the ramifications of it (analyze, provide treatment, and so on)

© C. Kemke Control 29 Control: Meta-Rules  Meta-Rules Use Meta-Rules to divide rules into classes. Choose one class over another at a given point. This implements domain-dependent knowledge about which set of rules to use during reasoning. CLIPS provides a Module-construct with similar effects.