Introduction to CLIPS 2 Session 13 Course: T0273 – EXPERT SYSTEMS Year: 2014.

Slides:



Advertisements
Similar presentations
Expert systems CLIPS Seyed Hashem Davarpanah
Advertisements

Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Introduction to CLIPS COMP 474/674 FALL 2003 Michelle Khalifé.
The CLIPS Programming Tool History of CLIPS –Influenced by OPS5 and ART –Implemented in C for efficiency and portability –Developed by NASA, distributed.
CLIPS 1 Expert Systems Dr. Samy Abu Nasser. CLIPS 2 Course Overview u Introduction u CLIPS Overview u Concepts, Notation, Usage u Knowledge Representation.
Expert System Shells - Examples
Samad Paydar Ferdowsi University of Mashhad.  C Language Integrated Production System (CLIPS)  A tool for building expert systems  An expert system.
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.
Introduction to CLIPS (Lecture Note #17)
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.
Chapter 12: Expert Systems Design Examples
Introduction to CLIPS (Chapter 7) Fact List (contains data) Knowledge Base (contains rules) Inference Engine (controls execution)
© Franz J. Kurfess CLIPS 1 CPE/CSC 481: Knowledge-Based Systems Dr. Franz J. Kurfess Computer Science Department Cal Poly.
© C. Kemke CLIPS 1 1 COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.
Chapter 8: Advanced Pattern Matching Expert Systems: Principles and Programming, Fourth Edition.
Chapter 9: Modular Design, Execution Control, and Rule Efficiency Expert Systems: Principles and Programming, Fourth Edition.
Introduction to Jess.
Jess Presentation by Chun Ping Wang. What is Jess? Jess is an expert system shell made for java. Rete pattern algorithm. Purpose. –Jess is best use for.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
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.
Review Topics Test 1. Background Topics Definitions of Artificial Intelligence & Turing Test Physical symbol system hypothesis vs connectionist approaches.
Expert System Topic 2.
Introduction to Shell Script Programming
Chapter 7: Introduction to CLIPS Expert Systems: Principles and Programming, Fourth Edition.
Artificial Intelligence Lecture No. 17 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Chapter 10: Procedural Programming Expert Systems: Principles and Programming, Fourth Edition.
Chapter 7: Introduction to CLIPS Presented By: Farnaz Ronaghi.
IMSS013 CLIPS. 2 Background CLIPS is an expert system tool developed by the Software Technology Branch (STB), NASA/Lyndon B. Johnson Space Center. First.
Computer Science Department California Polytechnic State University San Luis Obispo, CA, U.S.A. Franz J. Kurfess CPE/CSC 481: Knowledge-Based Systems.
Artificial Intelligence as Representation and Search.
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>
Advanced Pattern Matching. Field constraints Used to restrict the values of a field on LHS of a rule Used to restrict the values of a field on LHS of.
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.
Artificial Intelligence Lecture No. 19 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Artificial Intelligence Lecture No. 23 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Mostly adopted from Jason Morris notes (Morris Technical Solutions)
Artificial Intelligence Lecture No. 22 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
The CLIPS Expert System Shell Dr Nicholas Gibbins
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
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.
Inexact Reasoning 2 Session 10
Release Numbers MATLAB is updated regularly
Intelligent Systems JESS constructs.
CS170 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
Methods of Inference 2 Session 6
Inexact Reasoning 2 Session 10
Inexact Reasoning 1 Session 9
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Chapter 7: Introduction to CLIPS
Microsoft Access Illustrated
Command Syntax Chapter 2 Using the DIR Command with
Topics Introduction to File Input and Output
Guide To UNIX Using Linux Third Edition
Chapter 8: Advanced Pattern Matching
بسم الله الرحمن الرحیم آموزش نرم افزار CLIPS
Chapter 11: Classes, Instances, and Message-Handlers
JESS (Java Expert System Shall)
CPE/CSC 481: Knowledge-Based Systems
Topics Introduction to File Input and Output
Computer Based Tutoring
Presentation transcript:

Introduction to CLIPS 2 Session 13 Course: T0273 – EXPERT SYSTEMS Year: 2014

Learning Outcomes LO 4 : Demonstrate the algorithm using Expert Systems tools After taking this course, students should be expected to use CLIPS as a tool to build an expert system. 3T Expert Systems

Lecture Outline Commands for Manipulating Constructs The Printout Command Using Multiple Rules The Set-Break Command Loading and Saving Constructs Commenting Constructs Variables Multiple Use of Variables Fact Addresses Single-Field Wildcards Blocks World Multifield Wildcards and Variables Summary Exercise 4T Expert Systems

Commands for Manipulating Constructs The list-defrules command is used to display the current list of rules maintained by CLIPS. Similarly, the list- deftemplates and list-deffacts commands, respectively can be used to display the current list of deftemplates or the current list of deffacts. (list-defrules) (list-deftemplates) (list-deffacts) The ppdefrule, ppdeftemplate, ppdeffacts commands are used to display the text representations of a defrule, a deftemplate, and a deffacts respectively. (ppdefrule ) (ppdeftemplate ) (ppdeffacts ) 5T Expert Systems

Commands for Manipulating Constructs The undefrule, undeftemplate, and undeffacts commands are used to delete a defrule, a deftemplate, and a deffacts, respectively. (undefrule ) (undeftemplate ) (undeffacts ) The clear command can be used to remove all information contained in the CLIPS environment. (clear) 6T Expert Systems

The Printout Command Beside asserting facts in the RHS of rules, the RHS can also be used to print out information using the printout command. (printout *) The following rule demonstrates the use of the printout command: (defrule fire-emergency (emergency (type fire)) => (printout t “Activate the sprinkler system” crlf)) 7T Expert Systems

Using Multiple Rules Practical expert systems may consist of hundreds or thousands of rules. (defrule fire-emergency (emergency (type fire)) => (printout t “Activate the sprinkler system” crlf)) (defrule flood emergency (emergency (type flood)) => (printout t “Shut down electrical equipment” crlf)) 8T Expert Systems

The Set-Break Command CLIPS has a debugging command called set-break that allows execution to be halted before any rule from a specified group of rules is fired. A rule that halts execution before being fired is called a breakpoint. (set-break ) The show-breaks command can be used to list all breakpoints. (show-breaks) The remove-break command can be used to remove breakpoints. (remove-break [ ]) 9T Expert Systems

Loading and Saving Constructs A file of constructs made with a text editor can be loaded into CLIPS using the load command. (load ) (load “N:fire.clp”) CLIPS also provides the opposite of the load command. The save command allows the set of constructs stored in CLIPS to be saved to a disk file. (save ) (save “B:fire.clp”) 10T Expert Systems

Commenting Constructs Comments are used for good documentation of programs and will be helpful in lengthy programs. A comment in CLIPS is any text that begins with a semicolon and ends with a carriage return. ; Deftemplates (deftemplate emergency “template #1” (slot type)); What type of emergency (deftemplate response “template #2” (slot type)); How to respond ; The purpose of this rule is to activate ; the sprinkler system if there is a fire 11T Expert Systems

Variables Just as with other programming languages, CLIPS has variables available to store values. Variables are always written in the syntax of a question mark followed by a symbolic field name. Variable names follow the syntax of a symbol, with the exception that they must begin with a character. ?speed ?sensor ?value ?noun ?color 12T Expert Systems

Multiple Use of Variables Instead of writing a single rule that looks only for people with blue eyes, a fact can be asserted that indicates the specific color of eyes to look for. CLIPS> (undefrule *) ↵ CLIPS> (deftemplate find (slot eyes)) ↵ CLIPS> (defrule find-eyes (find (eyes ?eyes)) (person (name ?name) (eyes ?eyes)) => (printout t ?name “ has “ ?eyes “ eyes.” crlf)) ↵ CLIPS> 13T Expert Systems

Fact Addresses Before a fact can be manipulated from the RHS of a rule, however, there must be some way to specify the fact that matched a particular pattern. To accomplish this, a variable can be bound to the fact address of the fact matching a pattern on the LHS of a rule by using the pattern binding operator, “<-”. CLIPS> (defrule process-moved-information ?f1 <- (moved (name ?name) (address ?address)) ?f2 <- (person(name ?name)) => (retract ?f1) (modify ?f2 (address ?address))) ↵ 14T Expert Systems

Single-Field Wildcards Instead of using a variable, a single-field wildcard can be used when a field is required, but the value is not important. A single-field wildcard is represented by a question mark. (defrule print-social-security-numbers (print-ss-numbers-for ?last-name) (person (name ? ? ?last-name) (social-security-number ?ss-number)) => (printout t ?ss-number crlf)) 15T Expert Systems

Blocks World To demonstrate variable bindings, we will build a program to move blocks in a simple blocks world. The only things of interest in a blocks world are blocks. The goal of a complex blocks world program is to rearrange the stacks of blocks into a goal configuration with the minimum number of moves. To begin to solve this problem, it will be useful to set up a configuration of blocks that can be used for testing the program. See the example in your textbook page T Expert Systems

Multifield Wildcards and Variables Multifield wildcards and variables can be used to match against zero or more fields of a pattern. The multifield wildcard is indicated by a dollar sign followed by a question mark, “$?”, and represents zero or more occurrences of a field. (defrule print-social-security-numbers (print-ss-numbers-for ?last-name) (person (name $? ?last-name) (social-security-number ?ss-number)) => (printout t ?ss-number crlf)) 17T Expert Systems

Multifield Wildcards and Variables Just as single-field variables are preceded by a “?”, multifield variables are preceded by a “S?”. (defrule print-children (print-children $?name) (person (name $?name) (children $?children)) => (printout t ?name “ has children “ ?children crlf)) 18T Expert Systems

Summary Practical expert systems may consist of hundreds or thousands of rules. Comments are used for good documentation of programs and will be helpful in lengthy programs. Just as with other programming languages, CLIPS has variables available to store values. The goal of a complex blocks world program is to rearrange the stacks of blocks into a goal configuration with the minimum number of moves. 19T Expert Systems

Exercise You have to create an Expert system for New Toyota Yaris for detecting troubles and give solution. –Please explain stages in development of an Expert Systems –Explain variables and components in the development phase –Create the main construction of the program using CLIPS 20T Expert Systems

Joseph Giarratano, Gary Riley Expert Systems: Principles and Programming Chapter 7. Thomson Course Technology. Australia. ISBN: Peter Jackson Introduction to Expert Systems. Addison-Wesley. Harlow, England. ISBN: References T Expert Systems21