I think =?iso-8859-1?Q?=5BEXTERN=5D_Manuel_Kollmu=DF?= wrote:
> I want to change the salience of a rule during process.
> e.g.
> (defrule number1
>             (salience 0)

You could use a function call or defglobal to return the salience,
then use (set-salience-evaluation) to tell Jess to reevaluate salience
every time a rule is fired; 

(defrule number1
        (salience (get-salience number1))

(deffunction get-salience (?name)
  (bind ?s (fetch (str-cat ?name "-salience")))
  (if (eq ?s nil) then
        (return 0)
        (return ?s)))

(deffunction set-salience (?name, ?value)
  (store (str-cat ?name "-salience") ?value))

(set-salience-evaluation every-cycle)

> How can I do this so that the new salience is save even after a restart
> of the program?

You'd have to store the values yourself in some kind of persistent
store -- a database, etc -- and restore them when the program starts

Ernest Friedman-Hill  
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

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]

Reply via email to