Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 Jess Presentation by Chun Ping Wang

2 What is Jess? Jess is an expert system shell made for java. Rete pattern algorithm. Purpose. –Jess is best use for decision making. –Has integrated support with java. –Has procedural programming support.

3 Is it really open source? Hmm depends, you do need a license from Craig smith and you may email him at (casmith@sandia.gov) for licensing information.casmith@sandia.gov 11 are available. 30 days free trial for non licensing use.

4 Basic execution. Jess execute by order of rules. Priority. –1.) Templates and function are loaded into memory. –2.) All rules without precondition A are executed in code order (=> B). –3.) Rules with best matching precondition A are executed. (A => B).

5 Installing Jess. First install java. (Although not necessary but you wouldn’t get the full power). Second download Jess latest stable version and unzip it Third two ways to start Jess. – \bin\jess.bat –Java –classpath \lib\jess.jar \jess.Console While in Jess mode (batch filename)

6 Example 1. Whose the children. –Purpose base on list of parents and children from a file list, find all the children of that particular parent. –Not really a good e.g. of Expert System but rather procedural programming capability.

7 Templates and Function. Templates are like aggreated-structure define by (deftemplate (slot A) (slot B) …) Function are define by (deffunction (?parameter) ( ;; function body ) )

8 File I/O. (open “filename.dat" data "r")  opens a file call “person.dat” and associate it with data. (bind ?X (read data))  reads a single word from file and bind to variable X. (bind ?Y (readline data))  reads the rest of the line from file and bind to variable Y.   $explode treats the entire line as multiple symbols not just one whole symbol. EOF: When there is no more data to be read.

9 User input. Basic command prompt: Ask and get an answer. E.g. (printout t “what is your name?” crlf). (bind ?ans (readline))

10 Procedural programming support. Basic math operation and logical operation (op ?A ?B)  ?A op ?B. e.g. 5 – 3 is same as (- 5 3). Conditional programming (e.g. (while (X) do Y) (while (eq ?A ?B) do (printout t ?A “ is equal to ” ?B crlf) )

11 Whose the children execution order. 1 st (clear) (clears all templates) 2 nd (template and functions define are loaded into memory). 3rd (reset)  resets all the assertion. 4 th (rules without precondition such as get-and- print-data and main-prog are executed first) 5 th (best matching rule (rete pattern matching) are than executed in order). E.g. print-children *-*> print_parent_child * Note JESS won’t execute the rule unless you input (run).

12 Retract As you can see the only big difference between example 1 and example 2 is the word “retract”. You use it to remove a specific fact from knowledge database. - example you have 3 facts (f0, f1, f2). Doing (retract f1) removes fact 1 from knowledge database.

13 Example 2: Blocks. Purpose of program. –To determine the best possible ways for block X to be on top of Y. –Rules. We can only move one stack at a time. We can’t move a stack from bottom to top. We can move stack onto floor define by rule “move-to-floor”).

14 Clear upper block Precondition: You want to move block A but there happens to be block B on the very top of the stack with x number of blocks below it. Postcondition. You remove block B and put it onto the floor

15 Clear lower-block Precondition: You want to move a block onto block B but there is blocks C on top of stack with x amount of blocks below it. Postcondition. You move block C onto the floor.

16 Move directly. Precondition: You want to move block A onto block B and stack1 contains “A” and stack2 contains B. Post condition: –Remove the precondition from knowledge fact. –Make two new stack. One with stack and whatever is behind it and other with ?block1 ontop of block2.

17 Move-to-floor. Precondition. You want to move a stack onto the floor and there is actually something on the stack “X” Post condition. –First we remove the rule that we want to move stack “Y” onto floor and that there is blocks “Y” on top of pile “X”. –Than we divide it into two pile. Stack A is just block “Y” and stack B is just pile “X”


Download ppt "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."

Similar presentations


Ads by Google