Simple Rule Based Systems Directly implementing rule based systems in Java Need vocabulary Simplicity sometimes works.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

1 Todays Objectives Announcements Homework #1 is due next week Return Quiz 1 – answers are posted on the Yahoo discussion page site Basic Java Programming.
Getting Input in Python Assumes assignment statement, typecasts.
(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.
 Statistics package  Graphics package  Programming language  Can be used to share/reproduce analyses  Many new packages being created - can be downloaded.
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.
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)
Hashes a “hash” is another fundamental data structure, like scalars and arrays. Hashes are sometimes called “associative arrays”. Basically, a hash associates.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
JavaScript Lesson 1 TBE 540. Prerequisites  Before beginning this lesson, the learner must be able to… Create a basic web page using a text editor and/or.
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.
CS 561, Session 25 1 Introduction to CLIPS Overview of CLIPS Facts Rules Rule firing Control techniques Example.
ROBOTC Software Introduction. ROBOTC Software ROBOTC developed specifically for classrooms and competitions Complete programming solution for VEX Cortex.
1 01/12/2011Knowledge-Based Systems, Paula Matuszek More Intro to CLIPS Paula Matuszek CSC 9010, Spring, 2011.
Review Topics Test 1. Background Topics Definitions of Artificial Intelligence & Turing Test Physical symbol system hypothesis vs connectionist approaches.
Expert System Topic 2.
The if statement and files. The if statement Do a code block only when something is True if test: print "The expression is true"
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
Chapter 7: Introduction to CLIPS Expert Systems: Principles and Programming, Fourth Edition.
Chapter 10: Procedural Programming Expert Systems: Principles and Programming, Fourth Edition.
File I/O 11_file_processing.ppt
Hey, Ferb, I know what we’re gonna do today! Aims: Use formatted printing. Use the “while” loop. Understand functions. Objectives: All: Understand and.
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.
Artificial Intelligence as Representation and Search.
WS11-1 ADM , Workshop 11, August 2005 Copyright  2005 MSC.Software Corporation WORKSHOP 11 MACROS: OVERVIEW.
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>
Course roster management in scheme Data to be managed – A class roster is list of student entries of the form (ID, name, grade) – Example (“001”, “John.
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.
Artificial Intelligence Lecture No. 24 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Sections © Copyright by Pearson Education, Inc. All Rights Reserved.
1 Knowledge Based Systems (CM0377) Lecture 10 (Last modified 19th March 2001)
Exceptions CMSC 201. Overview Exceptions are run-time errors, especially ones that the programmer cannot predict.  example 1: division by zero  example.
Artificial Intelligence Lecture No. 19 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Python Let’s get started!.
Artificial Intelligence Lecture No. 23 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Logic Programming Dr. Yasser Nada Fall 2010/2011 Lecture 1 1 Logic Programming.
Mostly adopted from Jason Morris notes (Morris Technical Solutions)
Exception Handling and String Manipulation. Exceptions An exception is an error that causes a program to halt while it’s running In other words, it something.
Control Structures If Else Statement. S E S Q C E N U …consecutive steps (or groups of steps) processed one after another in the order that they arise.
1 TP #2: How does Prolog answer questions? n Miscellaneous info; n Last TP exercises solved; n How does Prolog answer questions? n Recursive Prolog programs;
The CLIPS Expert System Shell Dr Nicholas Gibbins
Introduction to CLIPS 2 Session 13 Course: T0273 – EXPERT SYSTEMS Year: 2014.
Jörg Kewisch, June 10, 2013, LILUG Meeting CLIPS C Language Integrated Production System Developed at the Software Development Branch, NASA Lyndon B. Johnson.
Intelligent Systems JESS constructs.
Python Let’s get started!.
HW7(100pts+10bonus) The homework Due on May 11, 23:59:59
Vi Editor.
Chapter 7: Introduction to CLIPS
Computer Science II First With files.
Computer Science II First With files.
بسم الله الرحمن الرحیم آموزش نرم افزار CLIPS
JESS (Java Expert System Shall)
Input from the Console This video shows how to do CONSOLE input.
Python programming exercise
if-else Structures Principles of Engineering
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Indefinite loop variations
Python 10 Mr. Husch.
Computer Based Tutoring
Computer Science II First With files.
Presentation transcript:

Simple Rule Based Systems Directly implementing rule based systems in Java Need vocabulary Simplicity sometimes works

Simple Rules do { fired = false;... if ( (!wm[influenza] && wm[nasal_congestion] && wm[viremia]) { wm[influenza] = true; fired = true; continue; }... // more rules } while (fired == true);

CLIPS Install and set shortcut as needed for your system. Prompt CLIPS> To quit type (exit) CLIPS> (exit) For help type (help) CLIPS> (help)

Facts Form: List with parentheses around it. (Harry likes Sally) Order counts –(Sally likes Harry) is not the same fact. Can have strings or numbers –(car price 25000)

Entering Facts CLIPS> (assert (Harry likes Sally)) –Assert is a command to enter the fact CLIPS> (facts) –Show all facts CLIPS> (clear) –Erase all facts CLIPS> (reset) –Erases all facts except (initial-fact)

Retracting Facts Use (facts) to see fact number Use retract with the number –CLIPS> (retract 3) –Removes fact number 3

Rules Example CLIPS> (defrule valuable_horse ( ?x horse) ( ?x parent_of ?y) ( ?y is_fast) ( ?z <- (buy_nothing) => ( assert (?x is_fast)) (printout t “buy this horse” ?x crlf) (retract ?z) ) ) ; Close all braces

Useful Commands CLIPS> (save “duck.clp”) CLIPS> (load “duck.clp”); Loads all rules in file CLIPS> (save-facts “duck-facts.fct”) – Saves all facts CLIPS> (load-facts “duck-facts.fct”) – Loads all facts in file. CLIPS> (rules) shows rules CLIPS> (ppdefrule duck) shows rule duck CLIPS> (run ) runs rules

Reading Data Use the (read) function. Wherever (read) is encountered, the program waits for the user to type something in, then substitutes that response. –Try (assert (user-input (read))) at the CLIPS prompt. –After you press return, you'll need to type something else (anything) before the command will complete. –When you look at the facts, you'll see a new fact with your input as the second item.

Read Example (defrule what-is-child (animal ?name) (not (child-of ?name ?)) => (printout t "What do you call the child of a " ?name "?") (assert (child-of ?name (read))) )

Result When you run it, the system will now prompt you for the name of the young of any animal it doesn't know about. It will use the data you enter to assert a fact, which could then be used by other rules.

Example 2 (defrule are-lights-working (not (lights-working ?)) => (printout t "Are the car's lights working (yes or no)?") (assert (lights-working (read))) )