Multi-Agent Systems. Mehdi Dastani



Similar documents

J A D E T U TO R I A L

JADE: Java Agent Development Framework What is it? How can I use it?

Java Agent DEvelopment Framework (JADE)

JADE PROGRAMMER S GUIDE

FIPA Agent Management Specification

Agent Based Expert System for Online Assessment in Distributed Database Environment: Prototype Design and Implementation

FIPA Agent Management Specification

Técnicas Avanzadas de Inteligencia Artificial Dpt. Lenguajes y Sistemas Informáticos. FISS. UPV-EHU

Tutorial: Getting Started

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version

STORM. Simulation TOol for Real-time Multiprocessor scheduling. Designer Guide V3.3.1 September 2009

Transparent Redirection of Network Sockets 1

Scalability and Performance of JADE Message Transport System

FIPA agent based network distributed control system

Design and Implementation of Distributed Process Execution Environment

Transparent Redirection of Network Sockets 1

1. Stem. Configuration and Use of Stem

Constructing a Collaborative Multi-Agents System Tool for Real Time System Requirements

Interoperability of open-source VoIP and multi-agent systems

Manual. Programmer's Guide for Java API

Developing Multi-agent Systems with JADE

E) Modeling Insights: Patterns and Anti-patterns

Listeners. Formats. Free Form. Formatted

Web development... the server side (of the force)

A Scheme for Implementing Load Balancing of Web Server

To Java SE 8, and Beyond (Plan B)

Communication Protocol

MD Link Integration MDI Solutions Limited

MA-WA1920: Enterprise iphone and ipad Programming

EFFECTIVE QUERY RETRIEVAL SYSTEM IN MOBILE BUSINESS ENVIRONMENT

: provid.ir

Configuring Java IDoc Adapter (IDoc_AAE) in Process Integration. : SAP Labs India Pvt.Ltd

IRF2000 IWL3000 SRC1000 Application Note - Develop your own Apps with OSGi - getting started

MULEP-A Multi Level E-Procurement System with Distributed Agents

socketio Documentation

Chapter 2: Processes, Threads, and Agents

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

MetroPro Remote Access OMP-0476F. Zygo Corporation Laurel Brook Road P.O. Box 448 Middlefield, Connecticut 06455

J A D E T U TO R I A L

MPLAB Harmony System Service Libraries Help

Design Pattern for the Adaptive Scheduling of Real-Time Tasks with Multiple Versions in RTSJ

Glossary of Object Oriented Terms

Real Time Programming: Concepts

Java Interview Questions and Answers

How to develop your own app

Enterprise Service Bus

Realizing Enterprise Integration Patterns in WebSphere

JAVA API FOR XML WEB SERVICES (JAX-WS)

Windows PowerShell Cookbook

2- Electronic Mail (SMTP), File Transfer (FTP), & Remote Logging (TELNET)

StreamServe Persuasion SP4 Service Broker

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Integrated Migration Tool

FioranoMQ 9. High Availability Guide

2- Electronic Mail (SMTP), File Transfer (FTP), & Remote Logging (TELNET)

Building a Multi-Threaded Web Server

Java and IRC. What Is IRC? Nicks, Channels and Operators. Using IRC. What Is an IRC Bot? IRC Protocol

Tuple spaces and Object spaces. Distributed Object Systems 12. Tuple spaces and Object spaces. Communication. Tuple space. Mechanisms 2.

Introduction to MAS. (Multi-Agent Systems) P. Laroque. march P. Laroque () Multi-Agent Systems march / 136

HP Operations Orchestration Software

How To Write A Program In Java (Programming) On A Microsoft Macbook Or Ipad (For Pc) Or Ipa (For Mac) (For Microsoft) (Programmer) (Or Mac) Or Macbook (For

CS11 Java. Fall Lecture 7

AP Computer Science Java Subset

PIKA HMP 3.0 High Level API Programmer's Guide

SnapLogic Salesforce Snap Reference

Linux Driver Devices. Why, When, Which, How?

Office 365. Created: 06/04/2013 Revised: 08/20/2013. Outlook 365 Kindred Healthcare, Inc. All rights reserved. Logging In Page 1 of 15

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

Getting Started Guide

Crash Course in Java

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications

U.S. Navy Automated Software Testing

# Constructors $smtp = Net::SMTP->new('mailhost'); $smtp = Net::SMTP->new('mailhost', Timeout => 60);

Using J-ISIS in a Local Network

Programming Without a Call Stack: Event-driven Architectures

Release Notes LS Retail Data Director August 2011

ACR Triad Site Server Click Once Software System

PIKA GrandPrix 1.3 Programmer's Guide

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

A SECURITY ARCHITECTURE FOR AGENT-BASED MOBILE SYSTEMS. N. Borselius 1, N. Hur 1, M. Kaprynski 2 and C.J. Mitchell 1

A Tool for Evaluation and Optimization of Web Application Performance

Facebook Twitter YouTube Google Plus Website

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Capabilities of a Java Test Execution Framework by Erick Griffin

Fundamentals of Java Programming

Transcription:

Multi-Agent Systems 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: Distributed Agent Platform seen as a whole from the outside world spanning multiple machines enables interoperability through FIPA compliance Two levels concurrency model Inter-agent (pre-emptive, Java threads) Intra-agent (co-operative, Behaviour classes)

The architectural model A JADE-based application is composed of a collection of active components called Agents. Each agent has a unique name. Each agent is a peer since he can communicate in a bidirectional way with all other agents Each agent lives in a container (that provides its run time) and can migrate within the platform One container plays the role of main (where AMS, DF live)

Agent class and names A type of agent is created by extending the jade.core.agent class and redefining the setup() method. Each Agent instance is identified by an AID (jade.core.aid), composed of a unique name plus some addresses; the getaid() method of the Agent class Agent names are of the form <local-name>@<platform-name>. The complete name of an agent must be globally unique. The default platform name is <main-host>:<main-port>/jade. The platform name can be set using the name option Within a single JADE platform agents are referred through their names only. Given the name of an agent its AID can be created as AID id = new AID(localname, AID.ISLOCALNAME); AID id = new AID(name, AID.ISGUID);

Hello World: A Simple Example import jade.core.agent; public class HelloAgent extends Agent { protected void setup() { System.out.println("Hello World. "); System.out.println("My name is "+ getlocalname()); } } $> javac HelloAgent.java $> java jade.boot fred:helloagent This is JADE 3.0b1. Hello World. My name is fred

Starting Agent Execution Birth of a new agent The agent is given an identifier It is registered with the AMS It is put in the AP_ACTIVE state Its setup() method is executed The setup() method is therefore the point where any application-defined agent activity starts Initialise the agent Add tasks using the method addbehaviour() Scheduled as soon as the setup() method ends

The Behaviour class The actual job that an agent does is typically carried out within behaviours Behaviours are created by extending jade.core.behaviours.behaviour class To make an agent execute a task it is sufficient to create an instance of the corresponding Behaviour subclass and call the addbehaviour() method of the Agent class. Each Behaviour subclass must implement 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.

Hello World: A Simple Example import jade.core.agent; import jade.core.behaviours.*; public class myagent extends Agent { protected void setup() { addbehaviour( new mybehaviour( this ) ); } class mybehaviour extends SimpleBehaviour { public void action() { //... the real programming!! } private boolean finished = false; public boolean done() { return finished; } } // ----------- End mybehaviour } //end class myagent Hello World! My name is fred Hello World! My name is fred Hello World! My name is fred Hello World! My name is fred... loops until stopped with CTL-C...!

Hello World: A Simple Example import jade.core.agent; import jade.core.behaviours.*; public class myagent extends Agent { protected void setup() { addbehaviour( new mybehaviour( this ) ); } class mybehaviour extends SimpleBehaviour { int n=0; public void action() { ; n++; } public boolean done() { return n>=3; } } // ----------- End mybehaviour } //end class myagent Hello World! My name is fred Hello World! My name is fred Hello World! My name is fred

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

WakerBehaviour: A Simple Example public class MyAgent extends Agent { protected void setup() { System.out.println( Adding waker behaviour ); addbehaviour(new WakerBehaviour(this, 10000) { protected void handleelapsedtimeout() { // perform operation X } } ); } } Operation X is performed 10 seconds after the Adding waker behaviour printout appears.

TickerBehaviour: A Simple Example public class tickeragent extends Agent { Behaviour loop; protected void setup() { } } loop = new TickerBehaviour( this, 10000 ) { protected void ontick() { // perform operation X } }; addbehaviour( loop ); Operation X is performed periodically every 10 seconds.

Stopping Agent Execution Any behaviour can call the Agent.doDelete() method in order to stop agent execution. The Agent.takeDown() method is executed when the agent is going to be destroyed The agent is still registered with the AMS and can therefore send messages to other agents The takedown() method can be overridden to implement any necessary cleanup. Just after the takedown() method is completed, the agent will be de-registered and its thread destroyed

More about behaviours The onstart() method of the Behaviour class is invoked only once before the first execution of the action() method. The onend() method of the Behaviour class is invoked only once after the done() method returns true. The removebehaviour() method of the Agent class can be used to remove a behaviour from the agent pool of behaviours. The onend() method is not called. When the pool of active behaviours of an agent is empty, the agent enters the IDLE state and its thread goes to sleep

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(); } }

FIPA ACL Message Elements p e r f o r m a t i v e What action the message performs s e n d e r Initiator of the message r e c e i v e r Recipient of the message r e p l y - t o Recipient of the message reply c o n t e n t Content of the message l a n g u a g e Language used to express content e n c o d i n g Encoding used for content o n t o l o g y Ontology context for content p r o t o c o l Protocol message belongs to c o n v e r s a t i o n - i d Conversation message belongs to r e p l y - w i t h Reply with this expression i n - r e p l y - t o Action to which this is a reply r e p l y - b y Time to receive reply by

ACL Message Example (request :sender (:name dominicagent@whitestein.com:8080) :receiver (:name rexhotel@tcp://hotelrex.com:6600) :ontology personal-travel-assistant :language FIPA-SL :protocol fipa-request :content (action movenpickhotel@tcp://movenpick.com:6600 (book-hotel (:arrival 25/11/2000) (:departure 05/12/2000)... ))) 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)

Interacting with the DF Agent The DF is an agent, it communicates using ACL The ontology and language that the DF understands are specified by FIPA The jade.domain.dfservice class provides static utility methods that facilitate the interactions with the DF register(); modify(); deregister(); search(); The JADE DF also supports a subscription mechanism

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

Interacting with the DF Agent protected void setup() {... DFAgentDescription dfd = new DFAgentDescription(); dfd.setname(getaid()); ServiceDescription sd = new ServiceDescription(); sd.settype( book-selling ); sd.setname( JADE-book-trading ); dfd.addservices(sd); DFService.register(this, dfd);... } protected void takedown() { DFService.deregister(this); }

Agent Management System The authority in a JADE platform; all platform management actions (creating/killing agents, killing containers...) Other agents can request the AMS to perform these actions by using The fipa-request interaction protocol The SL language The JADE-Management ontology and related actions getams() => the AID of the AMS

The main graphical tools of JADE Management, control, monitoring, and debugging of a multi-agent platform RMA (Remote Monitoring Agent) Dummy Agent Sniffer Agent Introspector Agent Log Manager Agent DF (Directory Facilitator) GUI

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!