I went back and looked over your first message and this time paid
attention to the deffunction canBeginProcessing. Holy corrupted data
structures, Batman! You can't modify a fact on the *left* side of a
rule! The Rete network is *not* re-entrant, which is why it's
carefully protected against interference from other threads. But that
protection doesn't help if a predicate function changes the object
it's working on, sending a PropertyChangeEvent which modifies the fact
that's being pattern-matched!

This is something like writing a Java equals() method that changes the
object and its hashCode() when you call it. Try to store such an
object in a HashMap!

Change canBeginProcessing to be a pure predicate function; call
setProcessedEntity (and beginProcessing) on the *right* side of the
rule, after you've made this decision.


(deffunction canBeginProcessing(?station)
 (if (and (neq ?station nil)) then
     ;; Get the entity that can be processed.
     (bind ?entity (call ?station beginProcessing))
     ;; Assign the entity to the current station.
     (call ?station setProcessedEntity ?entity)
     ;; Return true if there is an entity.
     (return (neq ?entity nil))
 else
     (return FALSE)))


I think Nicolas Fortin wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Dr. Friedman-Hill,
> 
> I've been curious and I've had another idea. Just before to call the 
> Rete.run() method in my Java program, I have checked the agenda activations. 
> It has strengthened my doubt about something wrong, since for the 
> troublesome rule (process-entity), there are two activations with the same 
> facts :
> 
> PROCESS:
> [Activation: PROCESS::process-entity  f-15, f-42 ; time=45 ; salience=0]
> [Activation: PROCESS::process-entity  f-15, f-42 ; time=45 ; salience=0]
> STATUS:
> For a total of 7 activations in all modules.
> 
> Is it really abnormal ?
> 
> Thanks in advance,
> 
> Nicolas 
> 
> --------------------------------------------------------------------
> 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  
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]
--------------------------------------------------------------------

Reply via email to