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

Slides:



Advertisements
Similar presentations
Expert systems CLIPS Seyed Hashem Davarpanah
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
© C. Kemke XPS Implementation 1 COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.
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.
November 2, 2004AI: CLIPS Language Tutorial1 CLIPS Michael Scherger Department of Computer Science Kent State University.
The Web Warrior Guide to Web Design Technologies
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.
Artificial Intelligence Lecture No. 18 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Introduction to CLIPS (Chapter 7) Fact List (contains data) Knowledge Base (contains rules) Inference Engine (controls execution)
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
© Franz J. Kurfess CLIPS 1 CPE/CSC 481: Knowledge-Based Systems Dr. Franz J. Kurfess Computer Science Department Cal Poly.
© 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.
© C. Kemke Control 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.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
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.
ASP.NET Programming with C# and SQL Server First Edition
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.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
Chapter 7: Introduction to CLIPS Expert Systems: Principles and Programming, Fourth Edition.
INTRODUCTION TO ALGORITHMS PROGRAMMING. Objectives Give a definition of the term algorithm Describe the various parts of the pseudocode algorithm or algorithm.
1 CSC 221: Introduction to Programming Fall 2012 Functions & Modules  standard modules: math, random  Python documentation, help  user-defined functions,
Artificial Intelligence Lecture No. 17 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Programming Fundamentals. Today’s lecture Decisions If else …… Switch Conditional Operators Logical Operators.
Agenda Regular Expressions (Appendix A in Text) –Definition / Purpose –Commands that Use Regular Expressions –Using Regular Expressions –Using the Replacement.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Introduction to programming in the Java programming language.
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.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
COMP 171: Data Types John Barr. Review - What is Computer Science? Problem Solving  Recognizing Patterns  If you can find a pattern in the way you solve.
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.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
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.
 CONACT UC:  Magnific training   
The CLIPS Expert System Shell Dr Nicholas Gibbins
Linux Administration Working with the BASH Shell.
Summary for final exam Agent System..
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Introduction to CLIPS 2 Session 13 Course: T0273 – EXPERT SYSTEMS Year: 2014.
Intelligent Systems JESS constructs.
Chapter 7: Introduction to CLIPS
Chapter 8: Advanced Pattern Matching
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
بسم الله الرحمن الرحیم آموزش نرم افزار CLIPS
Chapter 11: Classes, Instances, and Message-Handlers
JESS (Java Expert System Shall)
CPE/CSC 481: Knowledge-Based Systems
Computer Based Tutoring
Presentation transcript:

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

© C. Kemke CLIPS 1 2 CLIPS Introduction 1 Overview and Introduction  CLIPS Programming System  Basic CLIPS Constructs and Syntax  Basic Data Types  Basic Data Structures  Basic Condition Patterns  Rules

© C. Kemke CLIPS 1 3 CLIPS – Background CLIPS – C Language Integrated Production System  Production System refers to Rule-Based Systems  Originally developed by NASA  download, user’s manual, developer’s forum etc. see CLIPS link on course web-page  CLIPS is free, shareware; can even be used for commercial applications

© C. Kemke CLIPS 1 4 CLIPS – Programming Systems CLIPS Editor  load, save and edit CLIPS program files CLIPS Interpreter  enter commands, execute CLIPS programs Execution-Menu  set execution parameters (e.g. watch) Browse-Menu  manage constructs

© C. Kemke CLIPS 1 5 CLIPS - Example CLIPS> (load “file”) or use file-menu CLIPS> (assert (today is Tuesday)) f-0(today is Tuesday) CLIPS> (retract 0)retract fact 0 CLIPS> (facts)display current facts CLIPS> (reset)reset facts; re-run definitions CLIPS> (clear)clear CLIPS Interpreter (everything’s gone now)

© C. Kemke CLIPS 1 6 CLIPS – Defining Facts CLIPS> (deffacts todaydefines the set today (today is Tuesday) with 2 facts (weather is cold)) CLIPS> (reset) re-read definitions CLIPS> (facts) display current facts f-0(initial-fact) system "start-fact" f-1(today is Tuesday) f-2(weather is cold) For a total of 3 facts.

© C. Kemke CLIPS 1 7 Working with Facts Changing the Fact Base  Adding facts(assert )  Deleting facts(retract )  Modifying facts(modify ( ))  Duplicating facts(duplicate ( )) Monitoring fact base  Print all facts(facts)  Displays changes(watch facts)

© C. Kemke CLIPS 1 8 CLIPS – Basic Constructs Basic Language Elements :  Fields(basic Data Types)  Facts(used in condition patterns)  Rules(condition-action rules)  Templates(like records; define facts)  Classes (like objects; define facts)  Messagehandlers (like methods defined for classes; used in condition patterns and actions)

© C. Kemke CLIPS 1 9 CLIPS – Basic Syntax Syntax of Constructs is LISP-like, e.g.  (deffacts )  (defrule )  (defclass ) General form: (function-name parameter-list) Don't forget the brackets (...) !

© C. Kemke CLIPS 1 10 CLIPS – Rules in General In CLIPS (and other Rule-based Languages) Rules are the core elements of program execution. Rules consist of a Condition-part and an Action- part. (defrule rule-name “Comment” => )

© C. Kemke CLIPS 1 11 CLIPS – Rules in General The condition-part of rules consists of patterns which are matched against facts; facts are defined based on data structures (like templates and classes); plus additional operators to form complex patterns. The action-part contains commands for modifying facts or the fact base, or external actions like printout or load.

© C. Kemke CLIPS 1 12 CLIPS – Patterns and Rules CLIPS provides a rich set of mechanisms to define and describe patterns used as Conditions ("Condition Elements") in rules. examples:  simple facts;  facts based on templates;  facts based on classes (instances);  facts with variables and wildcards;  connections of facts (logical connectives like 'and' and 'or')

© C. Kemke CLIPS 1 13 CLIPS – Basic Data Types and Constructs CLIPS  Fields (data types)  Facts  Templates  Rules

© C. Kemke CLIPS 1 14 CLIPS – special syntax for fields CLIPS is case-sensitive: symbolsSpace different from space but space same as _space strings “_space” different from “space” special characters in strings: insert \ “\”symbol\””  “symbol” as string “\\symbol\\”  \symbol\ as string

© C. Kemke CLIPS 1 15 CLIPS - Fields Fields (data types)  floatreal number  integerinteger numbers  symbolcharacter-sequence (without special characters); ends with space  ? and $? not at beginning of a symbol  ? and $? are pre-fix of variables  stringcharacter-sequence in double-quotes  instance namename of an instance in [ ]

© C. Kemke CLIPS 1 16 Fields - Examples Fields (data types)  float4.00, 2.0e+2, 2e-2  integer4, 2, 22  symbolAlpha24*,  string“Johnny B. Good”  instance name[titanic], [PPK] Variables ?var, ?x, ?dayvariables for single field value $?namesvariable for multi-field value

© C. Kemke CLIPS 1 17 CLIPS –Facts Facts  a relation-name,  an ordered sequence of values (ordered facts), or  a set of (slot-name slot-value)-pairs (i.e. deftemplate-facts) examples: (today is Thursday) (person (name “Johnny B. Good”) (age 25))

© C. Kemke CLIPS 1 18 Ordered Facts Ordered facts  are facts defined without (explicit) template;  the field-values are ordered. Examples: (number-list ) (today is Sunday)

© C. Kemke CLIPS 1 19 Deftemplate Facts Deftemplate-facts  are facts defined based on a template;  slots can be arranged arbitrarily, there is no specific order.  Define a template for describing a set of facts using deftemplate (record structure).  Use deffacts to create a list of facts based on a template.

© C. Kemke CLIPS 1 20 CLIPS – Defining Templates Templates  keyword ‘deftemplate’  relation-name  list of slot-specifications: (slot slot-name)... Example: (deftemplate person (slot name) (slot age)) You can add type constraints to the slots, e.g. (slot name) (type STRING) (slot age) (type INTEGER)

© C. Kemke CLIPS 1 21 No Order in Deftemplate-Facts Slots in templates can be arranged arbitrarily. The following templates define the same data structure: The template-facts are regarded the same (→ pattern matching). (deftemplate person (slot name) (slot age) (slot age)) (slot name)) (person (name Johnny) (age 42)) (person (age 42) (name Johnny))

© C. Kemke CLIPS 1 22 CLIPS – Defining a Fact List Fact List  keyword ‘deffacts’  name of the fact list  list of facts, each fact in (...) Example 1: Define the set today with 2 facts: (deffacts today (today is Thursday) (weather is cold) )

© C. Kemke CLIPS 1 23 CLIPS – Defining a Fact List Example 2: Define a set of old-students based on a student-template: (deffacts old-students (student (name “Igor”) (age 50)) (student (name “Berta”) (age 80))) (deftemplate student (slot name) (slot age))

© C. Kemke CLIPS 1 24 CLIPS – Defining Rules Rules  keyword ‘defrule’  name of the rule  condition patterns (condition elements)  =>  actions (+ control structure) (defrule rule-name “Comment” => )

© C. Kemke CLIPS 1 25 Defining Rules - Example (defrule birthday “A person’s birthday” (person (name ?name) (age ?age)) (has-birthday ?name ?age) => (printout t “Happy Birthday,” ?name))

© C. Kemke CLIPS 1 26 Rule - Example (defrule birthday “A person’s birthday” (person (name ?name) (age ?age)) (has-birthday ?name ?age) => (printout t “Happy Birthday, ” ?name)) template fact ordered fact terminal rule name comment variables variabletextfunction

© C. Kemke CLIPS 1 27 CLIPS - Refraction refraction: rule fires only once on the same data refresh (or reset): rule starts all-over again (defrule birthday “A person’s birthday” (person (name ?name) (age ?age)) (has-birthday ?name ?age) => (printout t “Happy Birthday,” ?name)) question: How many times does the rule above fire and produces an output when the fact-base consists of the 'old-students' fact-list from above?

© C. Kemke CLIPS 1 28 Rule - Test exercise: Test the rule above and then modify it in such a way that it produces outputs like "Mary is turning 40 today." (defrule birthday “A person’s birthday” (person (name ?name) (age ?age)) (has-birthday ?name ?age) => (printout t “Happy Birthday, ” ?name))