Académique Documents
Professionnel Documents
Culture Documents
Mehdi Dastani
What is JADE?
JADE (Java Agent DEvelopment framework) is a FIPA compliant agent platform and a Java framework for the development of MAS. The Jade platform is based on a middleware that facilitates the development of distributed multi-agent applications based on a peerto-peer communication architecture. The environment can evolve dynamically with agents that appear and disappear in the system according to the needs and the requirements of the context. JADE Project started in July 1998 as joint development of Telecom Italia Lab and Parma University. JADE is the Leading Open Source FIPA compliant agent platform. Currently JADE development is driven by a board composed of five industrial partners:TILAB, Motorola, Whitestein Technologies AG, Profactor GmbH, and France Telecom R&D.
JADE
An agent platform that implements the basic services and infrastructure of a distributed multi-agent application: agent life-cycle, agent mobility, and agent security white & yellow-page services peer-to-peer message transport & parsing; also multi-party communication scheduling of multiple agent tasks set of graphical tools to support monitoring, logging, and debugging Some relevant features:
public void action(): what the behaviour actually does public boolean done(): Whether the behaviour is finished
An agent can execute several behaviours in parallel, however, behaviour scheduling is not preemptive, but cooperative and everything occurs within a single Java Thread Behaviour switch occurs only when the action() method of the currently scheduled behaviour returns.
Behaviour types
One shot behaviours. Cyclic behaviours. Complex behaviours. WakerBehaviour The action() and done() method are already implemented so that the handleElapsedTimeout() method (to be implemented by subclasses) is executed after a given timeout After that execution the behaviour completes. TickerBehaviour The action() and done() method are already implemented so that the onTick() (to be implemented by subclasses) method is executed periodically with a given period The behaviour runs forever unless its stop() method is executed
Operation X is performed 10 seconds after the Adding waker behaviour printout appears.
Just after the takeDown() method is completed, the agent will be de-registered and its thread destroyed
ACLMessage
Based on asynchronous message passing Message format defined by the ACL language (FIPA) Messages exchanged by agents are instances of the jade.lang.acl.ACLMessage Sending a message = creating an ACLMessage object and calling the send() method of the Agent class Reading messages from the private message queue is accomplished through the receive() method Provide accessor methods to get and set all the fields defined by the ACL language : get/setPerformative(), get/setSender(), add/getAllReceiver(), get/setLanguage(), get/setOntology(), get/setContent()
Blocking or selecting
The block() method of the Behaviour class removes a behaviour from the agent pool of behaviours and puts it in a blocked state. Each time a message is received all blocked behaviours are inserted back in the agent pool and have a chance to read and process the message. It is possible to read only messages with certain characteristics specifying a jade.lang.acl.MessageTemplate parameter in the receive() method. The Agent class also provides the blockingReceive() method; there are overloaded versions that accept a MessageTemplate and/or a timeout.
Blocking or selecting
public void action() { ACLMessage msg = myAgent.receive(); if (msg != null) { // Message received. Process it ... } else { block(); } }
Any language can be used as a Content Language, e.g.: KIF, Prolog, SQL, Serialized Objects, Binary Large Objects FIPA-SL, FIPA-CCL, FIPA-RDF, FIPA-KIF
Sending/receiving Message
ACLMessage msg = receive(); ACLMessage reply = new ACLMessage( ACLMessage.INFORM ); reply.setContent( "Pong" ); reply.addReceiver( msg.getSender() ); send(reply);
public void action() { ACLMessage msg = receive(); if (msg!=null) { ...; ACLMessage reply = msg.createReply(); reply.setPerformative(ACLMessage.INFORM ); reply.setContent(" Pong" ); reply.send(); } block(); }
DF (Directory Facilitator)
DFDescription format
When an agent registers with the DF it must provide a description
The agent AID A collection of service descriptions (class ServiceDescription):
The service type (e.g. Weather forecast) The service name (e.g. Meteo-1) The languages, ontologies and interaction protocols that must be known to exploit the service A collection of service-specific properties in the form key-value pair
When an agent searches/subscribes to the DF it must specify another DFAgentDescription that is used as a template
Advantages
No need to implement the Agent Platform AMS, DF executed at start-up No need to implement agent-management ontology and functionalities An agent is registered with the Agent Platform within its constructor, it is given a name and an address The DFService class provides a simplified interface to access the services of the DF (registration, searching, lease-renewal, ) No need to implement Message Transport and Parsing Automatically (and possibly efficiently) done by the framework when sending/receiving messages Interaction Protocols must only be extended via handle methods Standard FIPA !