Hello,
Suppose I have two agents: a master and a slave. The slave must ask
permission to the boss for every action it takes. I specified this in Jess
in the following way:
;; --- test.clp ---
(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))
So far it works: Jess asserts a (need-permission-to-walk-to) fact. Now I
would like the slave agent to send a message to the boss for every
(need-permission-to-...) fact it has in its knowledge base. In other words:
every time when a fact with certain characteristics is asserted, I want the
agent to be notified.
The agent looks something like this (much simplified):
class Agent
{
//attributes:
Rete m_rete;
//constructor:
public Agent()
{
m_rete = new Rete();
m_rete.executeCommand("(batch test.clp)");
}
//methods:
permissionNeeded(Action action)
{
sendMessageTo(boss, "need-permission-to", action);
}
}
What is the best way to solve this thing? Should I add a JessEventListener
to the slave agent and filter the (need-permission-to-...) facts in Java? Or
should I perform call-functions from within Jess to methods of my agent
(which I have not mastered yet, I am still in the experimental phase with
Jess)? Or is there a more appropriate way? Thanks in advance.
Sander Faas
student
University of Twente
The Netherlands
--------------------------------------------------------------------
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]
--------------------------------------------------------------------