Behaviours

The following examples introduce the user to the concept of agent behaviour showing the agent computational model supported by Jade. In detail, they show the use of the behaviour class hierarchy provided by the framework ( for further information, see the Jade programmer's guide ).

 

ComplexBehaviourAgent
Description:
An agent with a behaviour made of many  steps with some steps that have sub-steps themselves. This example shows how jade.core.behaviours.SequentialBehaviour class allows the construction of aggregate behaviours starting from simple ones, even with recursive aggregations. The figure shows the nested structure of the behaviours of this example agent. Besides, it shows the cooperative multitasking presently used for intra-agent behaviour scheduling.            
Jade classes used:
SequentialBehaviour, OneShotBehaviour
Source
\src\examples\behaviours\ComplexBehaviourAgent.java

 

WakerAgent
Description:
This example shows the usage of the WakerBehaviour.  The agent has 2 WakerBehaviours. The first behaviour wakes up after the given timeout (i.e.10 seconds). The second behaviour wakes up at the given date and time. When they wake up, the method handleElapsedTimeout() is  executed. Notice that in the first behaviour, the execution of the  method reset(t) makes repetitive the behaviour itself; that is it wakes up every t milliseconds.
Jade classes used:
WakerBehaviour
Source
\src\examples\behaviours\WakerAgent.java

 

FSMAgent
Description:
This code shows how to implement a  Finite State Machine using the SimpleBehaviourClass. More in details the agent has two behaviours: the first one is composed of three machine states (1.1, 1.2, 1.3), the second presents four states (2.1, 2.2, 2.3, 2.4). In each state the agent perfoms a specific operation ( displaying a message onto the screen). Notice that the second behaviour terminates reaching the fourth state by setting true the variable returned by the done() method.
Jade classes used:
SimpleBehaviour
Source
\src\examples\behaviours\FSMAgent.java

 

TestReceiverBehaviourAgent
Description:
This agent shows the usage of the ReceiverBehaviour, the WakerBehaviour, and the SimpleBehaviour. The WakerBehaviour sends to its agent a message  every ten seconds. One of the ReceiverBehaviours waits for a particular kind of message: it blocks after fourthy seconds if no message arrives. There is no specification for the messagges the other Receiver has to wait for, so it will accept any message equal to the one sent. The  SimpleBehaviour  verifies whether the two Receivers got the right messages. For the first one, an error message is displayed if an unespected message is received; for the second one an error message is displayed if the message sent is different from the one received. If exceptions are discovered, the relative Behaviour is deleted.The agent terminates only when the two ReceiverBehaviours have setted a variable true to notify they have finished their job. If this is not the case it doesn't terminate and blocks for two seconds ( see the time diagram).
Jade classes used:
ReceiverBehaviour, ACLMessage, WakerBehaviour, SimpleBehaviour
Source
\src\examples\behaviours\TestReceiverBehaviourAgent.java

 

 


JADE is a trademark of TILAB (formerly CSELT). 
JADE
has been developed jointly by TILAB (formerly CSELT) and the Computer Engineering Group of the University of Parma