1 01/12/2011Knowledge-Based Systems, Paula Matuszek Intro to CLIPS Paula Matuszek CSC 9010, Spring, 2011.

Slides:



Advertisements
Similar presentations
Expert systems CLIPS Seyed Hashem Davarpanah
Advertisements

CS 484 – Artificial Intelligence1 Announcements Choose Research Topic by today Project 1 is due Thursday, October 11 Midterm is Thursday, October 18 Book.
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.
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.
November 2, 2004AI: CLIPS Language Tutorial1 Artificial Intelligence CLIPS Language Tutorial Michael Scherger Department of Computer Science Kent State.
Chapter 8 Pattern Matching
Simple Rule Based Systems Directly implementing rule based systems in Java Need vocabulary Simplicity sometimes works.
Introduction to CLIPS (Lecture Note #17)
Reasoning System.  Reasoning with rules  Forward chaining  Backward chaining  Rule examples  Fuzzy rule systems  Planning.
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.
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.
Introduction to CLIPS (Chapter 7) Fact List (contains data) Knowledge Base (contains rules) Inference Engine (controls execution)
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
© 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.
© C. Kemke Control 1 COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.
Chapter 9: Modular Design, Execution Control, and Rule Efficiency Expert Systems: Principles and Programming, Fourth Edition.
EXPERT SYSTEMS Part I.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
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.
How to install the Zelle graphics package
CS 561, Session 25 1 Introduction to CLIPS Overview of CLIPS Facts Rules Rule firing Control techniques Example.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
A First Program Using C#
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.
Expert System Topic 2.
1 Programming a Knowledge Based Application. 2 Overview.
Using Eclipse. What is Eclipse? The Eclipse Platform is an open source IDE (Integrated Development Environment), created by IBM for developing Java programs.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Chapter 7: Introduction to CLIPS Expert Systems: Principles and Programming, Fourth Edition.
©Xiaoying Gao, Peter Andreae First Java Program COMP 102 #2 2014T2 Xiaoying Sharon Gao Computer Science Victoria University of Wellington.
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,
Computer Programming 12 Mr. Jean March 19 th, 2013.
First Java Program COMP 102 #2 2015T2 Xiaoying Sharon Gao Computer Science Victoria University of Wellington.
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.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
 Architecture and Description Of Module Architecture and Description Of Module  KNOWLEDGE BASE KNOWLEDGE BASE  PRODUCTION RULES PRODUCTION RULES 
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Jess: A Rule-Based Programming Environment Reporter: Yu Lun Kuo Date: April 10, 2006 Expert System.
Chapter 7: Introduction to CLIPS Presented By: Farnaz Ronaghi.
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>
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)
Artificial Intelligence Lecture No. 19 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
1 Getting Started with C++ Part 1 Windows. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Microsoft.
Mostly adopted from Jason Morris notes (Morris Technical Solutions)
Chapter – 8 Software Tools.
© Peter Andreae Java Programs COMP 102 # T1 Peter Andreae Computer Science Victoria University of Wellington.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Intelligent systems Lecture 11 Tools for development of Expert Systems.
1 1 1 Introduction to Java. 2 History of Java Java – Originally for intelligent consumer-electronic devices – Then used for creating Web pages with dynamic.
The CLIPS Expert System Shell Dr Nicholas Gibbins
Artificial Intelligence: Applications
UNIX U.Y: 1435/1436 H Operating System Concept. What is an Operating System?  The operating system (OS) is the program which starts up when you turn.
The full name of PERL is Practical extraction and report language. It is similar to shell script and lot easier & powerful language. Perl is free to download.
Development Environment
Intelligent Systems JESS constructs.
Chapter 7: Introduction to CLIPS
Intro to Expert Systems Paula Matuszek CSC 8750, Fall, 2004
بسم الله الرحمن الرحیم آموزش نرم افزار CLIPS
CPE/CSC 481: Knowledge-Based Systems
Presentation transcript:

1 01/12/2011Knowledge-Based Systems, Paula Matuszek Intro to CLIPS Paula Matuszek CSC 9010, Spring, 2011

2 Knowledge-Based Systems, Paula Matuszek 01/12/2011 CLIPS History  CLIPS = C Language Integrated Production System  Developed at NASA in the 1980s  C was used as implementation language  (because of restricted availability of LISP compilers and problems of integration LISP-code with non-LISP applications)  Initial version: a production rule interpreter. This is what we will use.  Extensions include COOL: CLIPS Object-Oriented Language JESS: Java Expert Systems Shell Fuzzy Clips: Fuzzy logic, for capturing uncertainty

3 Knowledge-Based Systems, Paula Matuszek 01/12/2011 What is it?  Classic Rule-Based Expert System shell  Core is facts and rules  Inference is forward chaining using the RETE algorithm  Multiple conflict resolution strategies  Advantages: Written in C; portable, embeddable, fast Public domain, readily available Easy to set up, low initial effort

4 Knowledge-Based Systems, Paula Matuszek 01/12/2011 Versions of CLIPS  CLIPS is written in C => CLIPS is portable => there are different versions that run on different platforms: mac, unix, windows.  Latest released version 6.24 can be downloaded from the CLIPS web site for Windows and OS X.  There is a beta version 6.30, but we are not going to use it. Feel free to explore it if you wish.  Download from

5 Knowledge-Based Systems, Paula Matuszek 01/12/2011 CLIPS Components  A basic CLIPS program has three primary components: Facts Rules Agenda  Facts represent information about the state of the world.  Rules represent things to do with/about facts.

6 Knowledge-Based Systems, Paula Matuszek 01/12/2011 CLIPS Facts  Facts are what CLIPS believes to be true.  The simplest form of a fact is a single string. (snowing) (“January 11”)  An ordered fact is a list of one or more strings: (snowing “January 11”)

7 Knowledge-Based Systems, Paula Matuszek 01/12/2011 Valid Facts  Examples of valid ordered facts (single-field) (two fields) (speed 38 mph) (cost 78 dollars 23 cents) (name “John Doe”)

8 Knowledge-Based Systems, Paula Matuszek 01/12/2011 Adding Facts  Putting facts into the CLIPS fact base is done by asserting. CLIPS> (assert(snowing)) This is the fact index. CLIPS> (assert(snowing Jan11))  You can also ask CLIPS what facts it knows. CLIPS> (facts) f-0 (initial-fact) f-1 (snowing) f-2 (snowing Jan11) For a total of 3 facts. CLIPS>

9 Knowledge-Based Systems, Paula Matuszek 01/12/2011 Retracting Facts  Facts can be removed or retracted using (retract ) CLIPS> (retract 1) CLIPS> (facts) f-0 (initial-fact) f-2 (snowing Jan11) For a total of 2 facts. CLIPS>  Retract can be used for more than one fact CLIPS> (retract 0 2) CLIPS> (facts) CLIPS>

10 Knowledge-Based Systems, Paula Matuszek 01/12/2011 Rules  Rules in CLIPS are forward chaining production rules.  LHS = Left Hand Side = IF = triggers  RHS = Right Hand side = THEN = actions  So a rule has a set of triggers; when they are true that rule is activated.  When a rule is fired the actions take place.  Conflict resolution determines which of the activated rules actually fires.

11 Knowledge-Based Systems, Paula Matuszek 01/12/2011 Rules Format  LHS => RHS  Syntax:  (defrule [ ] [ ] ; salience *; LHS, premises, patterns, ; conditions, antecedent => *) ; RHS, actions, consequent

12 Knowledge-Based Systems, Paula Matuszek 01/12/2011 Rules Example  Example:  (defrule snowing (snowing hard) => (assert(cancel class)))  Rules can have more than one pattern/premise: (defrule travel-bad (SEPTA no) (traffic horrible) => (assert(cancel class)))

13 Knowledge-Based Systems, Paula Matuszek 01/12/2011 Initial-fact  CLIPS has a special fact, initial-fact.  It is asserted by the system and can be used to initiate inference when no other facts are known.  A rule with no specified LHS will activate when initial-fact is true.

14 Knowledge-Based Systems, Paula Matuszek 01/12/2011 The Agenda  More than one rule may be activated at one time; CLIPS keeps all activated rules on an agenda. Conflict resolution chooses which to fire.  In each cycle one rule will be chosen to fire  The agenda can be listed: CLIPS> (agenda)

15 Knowledge-Based Systems, Paula Matuszek 01/12/2011 Agenda Example  CLIPS> (defrule snowing  (snowing hard) => (assert(cancel class))) CLIPS> (agenda) CLIPS> (defrule snowing2 (snowing hard) => (assert(alert maintenance))) CLIPS> (agenda) CLIPS> (assert(snowing hard)) CLIPS> (agenda) 0 snowing: f-0 0 snowing2: f-0 For a total of 2 activations.

16 Knowledge-Based Systems, Paula Matuszek 01/12/2011 Starting CLIPS  CLIPS can be run directly from the command line of a terminal window, but for Windows and Mac OS X there is a simple IDE which is preferable Windows: CLIPSWin.exe Mac: CLIPS IDE.app  When you start it, the CLIPS prompt will appear: CLIPS>  At that point you are at the CLIPS interpreter and can enter commands.  Everything in CLIPS is surrounded by ( )

17 Knowledge-Based Systems, Paula Matuszek 01/12/2011 Some Basic CLIPS Commands  (exit) to exit from CLIPS  (clear) to clear the environment from facts, rules, and other active definitions  (reset) to set the fact base to its initial state (clears existing facts; sets (initial-fact), and all (deffacts) constructs in the program). Perform (reset) before each program run!  (run) executes a program currently loaded into the CLIPS interpreter against currently defined rule- and fact-bases.

18 Knowledge-Based Systems, Paula Matuszek 01/12/2011 More Basic CLIPS Commands  (load “filename.clp”) to load CLIPS program into the interpreter from the file named filename.clp. This also does syntax check and defines constructs in the file. In some cases you may omit quotes in the name.  (facts) to display a list of currently active facts in the fact base.  (rules) to display a set of rules currently in the rule base.

19 Knowledge-Based Systems, Paula Matuszek 01/12/2011 “Hello World” in CLIPS  (defrule start  (initial-fact)  =>  (printout t “Hello, world!” crlf))

20 Knowledge-Based Systems, Paula Matuszek 01/12/2011 To Make It Run  The usual method of working in CLIPS is:  Type the code in a file, save it (e.g. hello-world.clp)  Start CLIPS  Do: File -> Load (in XCLIPS) or type  (load hello-world.clp)  When the file is loaded CLIPS will display:  (load hello-world.clp)  defining defrule start +j  TRUE

21 Knowledge-Based Systems, Paula Matuszek 01/12/2011 To Make It Run  Type (reset)  Type (run)  Tip:You can also use the menu  To exit CLIPS use the menu or (exit)

22 Knowledge-Based Systems, Paula Matuszek 01/12/2011 IDE  The IDE includes a fairly simple editor. The open command in the file menu loads a file into the edit buffer. The new command creates an empty buffer. From the IDE you can load the buffer directly into CLIPS This is easier if you are making and testing a lot of small changes.

23 Knowledge-Based Systems, Paula Matuszek 01/12/2011 SNOW Example  The file snow1.clp contains a program for deciding whether I will cancel class.  Its input is provided by directly asserting the current conditions.  If it concludes that class should be cancelled it will output a message.