 |
the Java Expert System Shell
|
The Jess FAQ
(C) 1999 Ernest J. Friedman-Hill and Sandia National Laboratories
You can obtain the most recent version of this document at
http://herzberg.ca.sandia.gov/jess/FAQ.html
Last updated: Thu Mar 18 09:56:22 1999
Table of Contents
Introduction
General information
- What is Jess?
- Who wrote Jess?
- What are the licensing issues surrounding Jess?
- What versions of Jess are there?
- Where can I get Jess?
- Where can I get more information about Jess?
How do I do...
- How do I make Jess run forever?
- I'm having problems compiling Jess. Why?
- Are there any known bugs in Jess?
- My expert system is slow. How do I speed it up?
Can Jess do...
- Can Jess do fuzzy logic like FuzzyCLIPS?
- Can Jess do backwards chaining?
Introduction
This is the first verison of a FAQ for Jess. It is quite obviously
unfinished. I will add to it as time permits.
The Questions
Jess is a tool for building a type of intelligent software called Expert
Systems. An Expert System is a set of rules that can be repeatedly
applied to a collection of facts about the world. Rules that
apply are fired, or executed. Jess uses a special algorithm
called Rete to match the rules to the facts. Rete makes Jess
much faster than a simple set of cascading if.. then statements
in a loop. Jess was originally conceived as a Java clone of
CLIPS, but nowadays
has many features that differentiate it from its parent. You can learn
more about expert systems from the
Expert
Systems FAQ (which hasn't been updated in quite a while.)
Jess was written by
Ernest
Friedman-Hill at Sandia National
Laboratories as part of an internal research project. The first
version of Jess was written in late 1995, when Java was very, very
new. Jess has evolved considerably since then! A large number of Jess
users have contributed code, suggestions, and patches; many of them
are thanked by name in the
Jess Manual.
Jess is and will always be free for academic use worldwide. Commercial
users can negiotiate a Jess license by contacting
Subra Subramanian at Sandia's
Technology Transfer office. A license is currently not required, merely
encouraged, for domestic commercial use; this will likely change in
the near future. A license is required for commercial use
outside of the U.S. The licensing fees are negotiable and generally
quite reasonable.
Usually there is one "released" version and one "test" version
available for download at any one time. As of this writing, version
4.4 is the stable released version, and the test version is 5.0a4. You
are always encouraged to try the test version.
From the official Jess home page at
http://herzberg.ca.sandia.gov/jess.
There are no authorized mirror sites.
From the official Jess home page at
http://herzberg.ca.sandia.gov/jess.
The default behaviour of Jess is to stop running as soon as there are
no activated rules. This is not appropriate for some applications; for
example, an intelligent agent probably should keep running at all
times. To keep the (run) command from ever returning, you
merely need to write a rule that will always be activated. Mine
generally looks like this:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This fact will be used to sleep when idle
(deffacts idle-fact
(idle))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This rule will always be on the agenda! Make the salience
;; lower than any other rule.
(defrule sleep-if-bored
(declare (salience -100))
?idle <- (idle)
=>
(retract ?idle)
(call java.lang.Thread sleep 100)
(assert (idle)))
The following are all the known issues with compiling various versions
of Jess. Please let me know
of any others.
The following are all the known bugs in the current versions of Jess.
Please let me know of any
others. In general, all of these will be fixed in any successive release.
The performance of a Rete-based system depends not so much on the
number of rules and facts but on the number of partial matches
generated by the rules. Section 4.2 of the Jess manual mentions this
briefly, but there is a much better treatment in the Giarrantano and
Riley book (also mentioned in the Jess Manual.) The classic example of
writing efficient rules looks like this: this rule
(defrule match-1
(item ?x)
(item ?y)
(item ?z)
(item ?w)
(find-match ?x ?y ?z ?w)
=> )
is HORRIBLE, because it must form all possible permutations of 'item'
facts before finding the one permutation that matches the 'find-match'
fact. If there are 10 'item' facts, this is 10x10x10x10 = 10,000
partial matches are sent to the last join node - a lot of
bookkeeping! If you rewrite the rule like this:
(defrule match-2
(find-match ?x ?y ?z ?w)
(item ?x)
(item ?y)
(item ?z)
(item ?w)
=> )
Then there is precisely one partial match sent to the last join
node - actually only one is sent to each join node. Whereas the first
rule might take several minutes to reset on a fast machine, the second
rule resets instantaneously.
The jess (view) command can be used to explore the efficiency of your
rules.
Bob Orchard, the creator of FuzzyCLIPS, is interested in
adding fuzzy extensions to Jess. We have been discussing an
architecture for adding core extensions like fuzzy logic to Jess. When
I know more, I will write about it here.
Jess version 5.0, which was released in alpha form in December
1998, has built-in support for efficient backwards chaining. See the
README for details.