Why not just write the r-update rule to update the fact when it sees a trigger like (update a), and then retract the trigger? Then whenever you want the fact updated, assert the trigger. You could use an idle rule (see the FAQ entry "How can I make my program run forever?") to assert the update fact.
(defrule change (a ? ?) ?s1 <- (situation s1) => (retract ?s1) (assert (update a))) (defrule r-update ?f1 <- (update a) ?f2 <- (a ?ts ?int) => (retract ?f1 ?f2) (assert (a (my-get-time) (f-of-time ?ts ?int)))) (defrule idle-rule (declare (salience -100)) (not (update a)) => (call Thread sleep 1000) (assert (update a))) I think Francisco Dario wrote: > > > Hi, > I have the following problem: > I want to update the intensity parameter of a fact through time. For > instance: (a 1 5.0) meaning that "a" has intensity "5.0" at time-stamp "1". > I want that "a" at time-stamp "2" becomes something like (a 2 3.4) where the > intensity value is calculated from a function "f-of-time". Besides this, I > have one rule that changes facts when a specific situation is true, which in > this case I didn�t want the update rule to fire (because the change rule > returns the facts updated already). Here are the rules: > > (defrule change > ?f1 <- (a ?ts1 ?int1) > (situation s1) > => > (retract ?f1) > (assert (a (my-get-time) (f-of-time ?ts1 ?int1))) > (assert (update a false))) > > > (defrule r-update > ?f1 <- (update a true) > ?f2 <- (a ?ts ?int) > => > (retract ?f1) > (retract ?f2) > (assert (a (my-get-time) (f-of-time ?ts ?int)))) > > > I wanted with these rules the following sequence: > >(assert (a 1 5.0)) > >(run) > ---> fire r-update and generate (a 2 3.4) > >(run) > ---> fire r-update and generate (a 3 2.2) > >(assert (situation s1)) > >(run) > ---> fire change (and not fire r-update) and generate (a 4 10.0) > >(run) > ---> fire r-update and generate (a 5 9.2) > >(run) > ---> fire r-update and generate (a 6 8.1) > > but the rules I wrote don't do this, because the first time r-update fires > it retracts the (update a true) fact and this rule will never fire again, > but I cannot take the rectract out because that way the r-update would enter > in a infinite cycle. > > Could any one help me with this? > Thanx. > Dario > > > > > > > > > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. > > > -------------------------------------------------------------------- > 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] > -------------------------------------------------------------------- > --------------------------------------------------------- Ernest Friedman-Hill Distributed Systems Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 -------------------------------------------------------------------- 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] --------------------------------------------------------------------
