Presentation is loading. Please wait.

Presentation is loading. Please wait.

Jess: A Rule-Based Programming Environment Reporter: Yu Lun Kuo Date: April 10, 2006 Expert System.

Similar presentations


Presentation on theme: "Jess: A Rule-Based Programming Environment Reporter: Yu Lun Kuo Date: April 10, 2006 Expert System."— Presentation transcript:

1

2 Jess: A Rule-Based Programming Environment Reporter: Yu Lun Kuo E-mail: sscc6991@gmail.com Date: April 10, 2006 Expert System

3 Page 2 Why Expert System Question of project developer –Program = algorithm + Data Structure (Hard) –Software Engineering Demand  Design  Coding (Demand Phase) –Programmer Expert Systems –Rule-based computer programs that capture the knowledge of human experts in their own fields of experience

4 Page 3 Rules A rule is a kind of instruction or command that applies in certain situations Rules are a lot like the if-then statements of traditional programming languages –if part of a rule is often called its left-hand side –then part of a rule is often called its right-hand side A rule-based system is a system that uses rules to derive conclusions from premises if predicate or premises then actions or conclusions

5 Page 4 Rule Engine A rule engine doesn’t contain any rules until they are programmed in –A rule engine knows how to follow rules, without containing any specific knowledge itself –deployment environment

6 Page 5 Architecture of a Rule-Based System A typical rule engine contains –Inference engine Forward Chaining – LISP, CLIPS Backward Chaining - PROLOG –Rule base (knowledge base) –Working memory (fact base) Inference engine consists of –Pattern matcher –Agenda –Execution engine

7 Page 6 Pattern Matcher The working memory contains thousands of facts, and each rule has two or three premises The pattern matcher need to search through millions of combinations of facts to find those combinations that satisfy rules –All the rules are compared to working memory –Decide which ones should be activated during this cycle

8 Page 7 Agenda Inference engine figures out which rules should be fired, it still must decide which rule to fire first –The list of rules that could potentially fire is stored on the agenda –Ex. Give high priority

9 Page 8 Execution Engine The execution engine is the component of a rule engine that fires the rules Some modern rule engines offer a complete programming language you can use define –What happen when a give rules fires

10 Page 9 Conflict Set Conflict Resolution Fired

11 Page 10

12 Page 11 Jess (Java Expert System Shell) The Java Rule Engine API defined by the javax.rules package –A standard enterprise API for accessing rule engines –Site: http://www.jcp.org/jsr/detail/94.jsp Jess rule engine –A rule engine and scripting language developed at Sandia National Laboratories in Livermore, California in the late 1990s –It can access to all of Java’s powerful APIs for networking, graphics, database access, and so on

13 Page 12 Jess (Cont.) The Jess language can directly access all Java classes and libraries –This allows you to experiment with Java APIs interactively and build up large programs incrementally –Jess is therefore useful in a wide range of situations –Jess can be used in command-line applications, GUI applications, servlets, and applets.

14 Page 13 The most important step in developing a Jess application is to choose an architecture –Pure Jess language, with no Java code –Pure Jess language, but the program accesses Java APIs –Mostly Jess language code, but with some custom Java code in the form of new Jess commands written in Java –Half Jess language code, with a substantial amount of Java code providing custom commands and APIs. Jess provides the main() function –Half Jess language code, with a substantial amount of Java code providing custom commands and APIs. You write the main() function –Mostly Java code, which loads Jess language code at runtime –All Java code, which manipulates Jess entirely through its Java API

15 Page 14 Scripting Java with Jess From Java code, you can access all parts of the Jess library –Easy to embed Jess in any Java application –Use Jess for experimenting with Java APIs Jess is therefore a kind of scripting language for Java You can create the windows, buttons, and other graphical components with a few lines of Jess code

16 Page 15 Representing facts in Jess The contents of Jess’s working memory are held in your computer’s RAM Most other constructs in Jess, facts are stored as lists Jess offers a set of functions to let a program perform the basic collection operations on the working memory –add, remove, modify, duplicate

17 Page 16 Working memory assert – Add facts to working memory Clear – Clears all of Jess Deffacts – Defines the initial contents of working memory Facts – Display the content of working memory Reset – Initializes the working memory Retract – Removes facts from working memory Watch – Tells Jess to print diagnostics when interesting things happen


Download ppt "Jess: A Rule-Based Programming Environment Reporter: Yu Lun Kuo Date: April 10, 2006 Expert System."

Similar presentations


Ads by Google