I think Sven Siorpaes wrote:
>
> The "no-loop" declaration works fine with one
> single rule modifying a fact used on the LHS of
> the rule. But in the situation mentioned above
> the two rules produce a infinite loop...
>
> Does anyone know a "good" way to realize this?
This is a new feature, and, in the grand Jess tradition, we're all
going to figure out the best practices for using it together -- or
even modifying it to make it more useful. Suggestions are more than
welcome -- they're encouraged.
That said, another way to approach this is to use the (also new)
slot-specific activations feature. If you declare a template to be
slot-specific, then it acts more "object-like". In fact, I think
slot-specific would make a better default than the current default,
but we don't want to break existing code.
In any event, what you can do is to declare the template to be
slot-specific, and then not match this slot on the rule's LHS. This is
perfectly valid since the rules aren't actually reacting to the values
of that slot -- they're just binding it so that they can do math. So
you declare the "item" template to be slot-specific, as
(deftemplate item (declare (slot-specific TRUE)) (slot weight) ...)
and then the rules can be written as
(defrule MODULE1::rule2)
(factor2 (factorValue ?value)
?item <- (item)
=>
(bind ?weight (fact-slot-value ?item weight))
(modify ?item (weight (* ?weight ?value)))
)
Because this rule doesn't explicitly mention the "weight" slot on the
LHS, it won't be reactivated if the "weight" slot is modified.
---------------------------------------------------------
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]
--------------------------------------------------------------------