I think Sander Faas wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> 
> (do-backward-chaining permission-to-walk-to)
> 
> (defrule to-walk-to
>       ?goal <- (goal (state be-at) (argument ?place))
>       ?self <- (self (location ~?place))
>       (permission-to-walk-to)
>       =>
>       (printout t "I walk to " ?place "." crlf)
>       (modify ?self (location ?place))
>       (retract ?goal))
> 
...
> 
> class Agent
> {
...
>       //methods:
>       permissionNeeded(Action action)
>       {
>               sendMessageTo(boss, "need-permission-to", action);
>       }
> }
> 
> What is the best way to solve this thing? 

By far, the most efficient way is to use the Rete network itself to do
the filtering. Write a rule like this:

(defrule seek-permission
  ?perm <- (need-permission-to-walk-to)
  =>
  (retract ?perm)
  (bind ?master (call some function to get reference to agent))
  (call ?master permissionNeeded "-walk-to"))

Then this rule will automatically send a message requesting permission
from the master agent whenever necessary.

Probably you'll want to have only one generic version of this, so
instead of having a backward-chaining trigger
(need-permission-to-walk-to), you'll want
(need-permission walk ?location) instead; but you can work these
details out as you go.


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

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