RE: [jade-develop] HELP: using inheritance when writing jade agents /matching messages


Subject: RE: [jade-develop] HELP: using inheritance when writing jade agents /matching messages
From: Bellifemine Fabio (Fabio.Bellifemine@TILAB.COM)
Date: Thu Sep 12 2002 - 09:12:17 MET DST


another possibility is to use the MessageTemplate and define one template for each behaviour.
Notice that the MessageTemplate class can be extended by redefining the method match, which allow to have application-specific templates.

-----Original Message-----
From: Robert Kessler [mailto:kessler@cs.utah.edu]
Sent: 11 September 2002 15:16
To: 'Felix Schmid'; jade-develop@sharon.cselt.it
Subject: RE: [jade-develop] HELP: using inheritance when writing jade
agents /matching messages

You are correct. When one behaviour receives a message it "eats" that
message. You don't really have direct control to say "ok, only these
messages go to agent X". One way to solve this is to make it so when
Agent A gets the message and realizes that it isn't for him, he does a
putback to put it back into the queue for some other message. With
JADE's round robin, you just don't know which agent will get to the
message first. If you are doing this, you need to be very careful and
make sure that SOME agent is going to not do the putback and consume the
message.

Our solution to this whole problem was to create a dispatcher. The
dispatcher is the SINGLE location where messages arrive. It then makes
a decision as to how it is distributed. We did not allow blocking
receives as that stops the whole agent from doing any processing. So,
by convention and by using the dispatcher we were able to cleanly code
up situations like you mention. Our dispatcher even allowed some parts
to see messages and "put them back in" - we used this for logging, while
others were "default" behaviours and they always consumed the message.

So, bottom line, to solve your problem now, use the put back function.

Bob.

-----Original Message-----
From: jade-develop-admin@sharon.cselt.it
[mailto:jade-develop-admin@sharon.cselt.it] On Behalf Of Felix Schmid
Sent: Wednesday, September 11, 2002 6:23 AM
To: jade-develop@sharon.cselt.it
Subject: [jade-develop] HELP: using inheritance when writing jade agents
/ matching messages

Hello,

I asked this question already a couple of weeks ago, but since the
answers
I got were not exactly what I was looking for I will describe the
problem
once more:

I have some agent, say of class A. This agent has a CyclicBehaviour
waiting
for REQUEST-messages (via receive()). Upon receiving a message with
matching envelope it checks the content of the message. Agent A is only
interested in REQUESTS for specific actions.

So far, so good. No I want to expand the capabilities of that Agent. I
don't want to do this in class A but instead I am deriving a new class B

from class A, following basic OO design practice. The new agent (of
class
B) has another CyclicBehaviour, also listening to REQUEST messages, but
with other actions as the one in class A (same envelope, different
content
as the behaviour of class A).

It seems to me that this doesn't work. An incoming REQUEST message is
delivered only to one of the two behaviours (either that of class A or
class B), not both.
Does this mean, that

        - if some agent matches REQUESTS or INFORMS or whatever, no
subclasses of
that agent can match messages of that envelope.

        - subclassing is not a thing to do in agent programming (would
sound very
strange to me).

        - I have to give the base class (base agent) a generic behaviour
to match
REQUEST messages, with the capability to add 'Listeners' to that
behaviour
so that
         I can match messages with REQUEST envelope in derived classes.

Is there some other way to do the job? It should be a common problem
when
writing agents (inheritance is a basic feature of java), so I am sure
someone has encountered it already and knows how to handle it.

The problem should also arise when an agent has two behaviours
interested
in the same message envelope, again with different content.

regards,
felix

_______________________________________________
jade-develop mailing list
jade-develop@sharon.cselt.it
http://sharon.cselt.it/mailman/listinfo/jade-develop
UNSUBSCRIBE INSTRUCTIONS AT http://jade.cselt.it/mailing.htm#unsubscribe

_______________________________________________
jade-develop mailing list
jade-develop@sharon.cselt.it
http://sharon.cselt.it/mailman/listinfo/jade-develop
UNSUBSCRIBE INSTRUCTIONS AT http://jade.cselt.it/mailing.htm#unsubscribe



This archive was generated by hypermail 2a22 : Thu Sep 12 2002 - 09:13:20 MET DST