I think that James Owen wrote: >As I recall, salience in rulebased programming is akin to goto statements in BASIC; a crutch for poor programming
On that subject: Just as there are legitimate, structured uses for the GOTO statement in some languages, salience can be used in a structured way that doesn't violate the spirit of rule-based programming. I've spent a lot of time studying the Jess In Action sections on salience, modules, general flow control in Jess programs, and anything else I could find on the subject -- and it's all very helpful. However, ironically, I recently came across an old ART Enterprise tutorial manual (1987) that has a fantastically clear explanation of when it is proper to use salience and how to do it. (For the AI history buff: ART was one of the first commercial expert system shells and was also the progenitor of CLIPS - Jess's "inspiration". See http://www.ghg.net/clips/WhatIsCLIPS.html#History ) In any case, the examples (easily extrapolated to Jess) were (quoting now): * To stratify the rule base into classes of rules dedicated to different tasks (filtering, pre-processing, etc.) * To give a very important rule priority over most other or all other rules (error conditions or "alarms"). * To keep a utility rule in the background until the rest of the program has run to completion (final output, re-init fact base, etc.) As far as item one goes, it's easy to implement in Jess with global variables like this: (defglobal ?*TASK_PRIORITY_1* = 500) (defglobal ?*TASK_PRIORITY_2* = 200) (defglobal ?*TASK_PRIORITY_3* = 100) (defrule foo-1 (declare (salience ?*TASK_PRIORITY_1*)) ... => ... ) (defrule foo-2 (declare (salience ?*TASK_PRIORITY_2*)) ... => ... ) and so on. Again, this would be for controlling "layers" of rules that sort of "swarm" on completing one complex task at a time. One other technique that I've been practicing is the notion of LHS Control Patterns (LHSCP), that is asserting and retracting ordered facts (triggers) to enable or disable large groups of rules simultaneously. In other words, in a rule having the LHSCP, if that control fact is not present in working memory, then that rule (and all rules of its "kind") are essentially disabled until reactivated by the assertion or modification of that control fact or facts. This seems to handle a wide range of control problems without, again, violating the rule-based paradigm. However, there was no mention of (defmodule) in ART in '87 -- although CLIPS has had it for awhile now -- so maybe even the structured use of salience is dated. Clearly Dr. Friedman-Hill prefers a modular approach in JIA -- changing the focus of modules to control activations of groups of rules -- and that certainly seems the best way to go for most Jess applications. BTW - Examples of creative uses of salience or other control mechanism in Jess would be much appreciated. -JM ------------------------ Jason Morris Morris Technical Solutions [EMAIL PROTECTED] www.morristechnicalsolutions.com fax/phone: 503.692.1088 -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
