I think Saumil Sunil Mehta wrote:
> 
> I am wondering if anybody has any insight regarding this or if they've 
> seen this before. If anybody else has faced a similar situation, and if 
> they'd share their experience with me, Id appreciate it. Also, is this 
> unusual, or is it to be expected?

In both Jess and in CLIPS, the order in which multiple rules activated
by the identical set of facts is undefined (not random, just
undefined.) So if two different rules R1 and R2 are simultaneously
activated by the fact X, then CLIPS might fire R1 first, and Jess
might fire R2 first (and indeed, different versions of CLIPS and Jess
might reverse this, and the presence of other rules might affect the
order too. Switching the order of two rules shouldn't affect the
execution of a well-formed program, but in practice it often does. An
extreme example:

(defrule R1  
  ?X <- (X)
  =>
  (retract ?X))

(defrule R2
  (X)
  =>
  (halt))

If R2 fires first, the program halts immediately; if R1 fires first,
it never halts. 

The Jess and CLIPS manuals both mention that writing programs that
depend on this arbitrary ordering is a bad idea; but in practice it's
often done accidentally.

Using "(watch rules)" while running the program under both CLIPS and
Jess and then comparing the results will help you find the point at
which the programs diverge, and you may then be able to decide whether
the new ordering leads to a correct outcome even if the number of
rules that fire is different.

---------------------------------------------------------
Ernest Friedman-Hill  
Science and Engineering PSEs        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