Jess Information

Jess Home
Jess 7 Features
Download Now!
Online Demo

Documentation
FAQ
Manual
Mailing List
Jess Wiki

More information Related Web Sites
User Contributions
JSR94 Info
Developer's Log
About This Site

JESS ®, the Rule Engine for the JavaTM Platform

Jess Wiki: Bad Salience

Bad Salience

Salience has a bad reputation in the rule-based computing world, much like the goto statement has in some procedural languages. This is because it allows a novice programmer to control when rules fire -- and this is strictly against the ZenOfJess.

An interesting observation on this can be found in J. Giarratano's Expert Systems: Principles and Programming ISBN 0878353356 where he says:

"...In dealing with ill-structured problems, there is a danger that the expert system's design may accidentally mirror an algorithmic solution. That is, the development of the expert system may unknowingly discover an algorithmic solution. A clue that this has happened occurs if a solution is found that requires a rigid control structure. That is, the rules are forced to execute in a certain sequence by the knowledge engineer explicitly setting the priorities of many rules.

Forcing a rigid control structure on the expert system cancels a major advantage of expert system technology, which is dealing with unexpected input that does not follow a predetermined pattern. That is, expert systems react opportunistically to their input, whatever it is. Conventional programs generally expect input to follow a certain sequence. An expert system with a lot of control often indicates a disguised algorithm and may be a good candidate for recoding as a conventional program."

A drastic example would be:

(defrule rule-1
    (declare (salience 3))
    ; some patterns
    =>
    ; some actions )
   
(defrule rule-2
    (declare (salience 2))
    ; some patterns
    =>
    ; some actions )
   
(defrule rule-3
    (declare (salience 1))
    ; some patterns
    =>
    ; some actions )

The rules have become a cascade of subroutines waiting to be called, and we see Giarratano's warning.

(jco) Adding to what Jason has written, along with the G&R warnings, let's say that salience is much like OO inheritance; more than 3 levels of either is not good. However, this is NOT to say that either inheritance nor salience is a bad thing. OO without inheritance is basically C code. Rules without salience usually are not very functional.

Finally, another word on this subject: When using goal-oriented rules, the goals usually depend on recency to function properly. However, some rulebase systems (MindBox? comes to mind) do not use recency for conflict resolution and therefore the developer is forced to use more than three levels of salience. But that probably should be the only time. With Jess, as with CLIPS, you can set the conflict resolution strategy for each particular problem set.

SDG jco


James raises a good point here. Also, this is a great point for someone to add a page on creating custom conflict resolution strategies. -JM

Back to SalienceUsageTips | Next to GoodSalience


Front Page | Sandbox | Recent Changes | Powered by Friki | Last Edited: 12 September 2005