The order in which rules fire is obviously irrelevant if that order does not affect the behaviour of the program. I discovered that the order in which rules are defined affects program behaviour because I was unknowingly trying to assert the same working memory element twice. This I now understand to be because, even with different definstance labels, the wme is the object and not the defined instance. This is an issue for multislots where the same Java object can be stored in more than one array.

I wonder if there are other cases where the order of defrule statements affects outputs?

[EMAIL PROTECTED] wrote:

I think Scott Moss wrote:

The order in which rules are fired depends first on the conflict
resolution strategy, but if two rules are of equal priority by that
criterion, then they'll fire in an arbitrary order that just falls out
of the Rete network implementation. That order is affected by, but
isn't equal to nor even easily predicatable from, the order in which
the rules are defined.

That's good to know since one of our developments will be to implement a conflict resolution strategy sound and consistent with a formal logic or, more likely, several conflict resolution strategies based on several logics. The ability to do this is, I think, one of the great strengths of Jess from a modeller's point of view. I imagine that, in so doing, the order of the defrule statements can be entirely irrelevant. Is that right?

Only if you replace the existing arbitrary-but-not-random order with
your own arbitrary-but-not-random order. As a trivial example, these
two rules:

(defrule rule-1
 => )

(defrule rule-2
 => )

will fire in an arbitrary order which will definitely depend on the
order in which they're defined. To remove that dependency in your
strategy implementation, you'd have to order them based on dictionary
ordering of their names, or some other arbitrary criterion.

But the point is that yes, you could do that


--------------------------------------------------------------------
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