There are a couple of additional techniques you can use to control rule
firing order.  The main one is introducing additional "state" facts into
the fact base; another is using modules.  A very crude example is:

(deftemplate state (slot current))

(assert (state (current 0)))

In your MAIN module, have a rule that moves through the states that are
possible.  Then, in separate modules (declared with defmodule), have
your state-based logic.  Set the primary rule in each module to be in
auto-focus mode, and to rely on the appropriate state fact.  When the
primary rule fires, the focus will switch to that module until no more
rules there can fire.  Control then reverts back to the main module,
which alters the state, which allows the next module to fire, and so on.

Note that there is no difference between salience (order) and state in
this case...substitute "order" for "current" in the fact above and make
each module contain the rules that correspond to a given ordering.

Note that since the "state" facts change quite frequently it is a very
good idea to keep them near the bottom of your rules.

I have often wondered why the use of salience is discouraged so
much...dividing rules into bands of priority seems very sensible to
me...

RJ

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