1 introduction of java agent development environment (jade) presented by po-cheng huang

50
1 Introduction of Java Agent Development Environment (JADE) Presented by Po-Cheng Huang

Upload: gwendolyn-riley

Post on 28-Dec-2015

221 views

Category:

Documents


0 download

TRANSCRIPT

1

Introduction of Java Agent Development Environment (JADE)

Presented by Po-Cheng Huang

2

Outline

Introduction Foundation for Intelligent Physical Agents (FIPA) Java Agent Development Environment (JADE)

Running JADE Platform Install JDK 1.5 Install JADE Platform Run JADE Platform Run Agent on JADE Platform

3

Foundation for Intelligent Physical Agents (FIPA)

IEEE Computer Society standards organization A body for developing and setting computer

software standards for heterogeneous and interacting agents and agent-based systems.

Agent management Agent communication language (ACL) Integration agent and other computer software http://www.fipa.org/

A software agent A piece of software that acts for a user or other

program in a relationship of agency

5

JADE platform

JADE is a middleware that facilitates the development of Multi Agent Peer-to-Peer applications.

Full Java Runs on all JVM from J2EE to J2ME MIDP1.0 Downloadable from http://jade.tilab.com

6

7

JADE Platform

8

Directory Facilitator

9

Directory Facilitator

Provides a Yellow Pages service by means of which an agent can find other agents providing the services he requires in order to achieve his goals.

10

Agent Management System (AMS)

11

Agent Management System

Provides the naming serviceEnsures that each agent in the platform has

a unique nameRepresents the authority in the platform

To create/kill agents on remote containers by requesting that to the AMS

12

Message Transport System

Agent Communication Channel (ACC) Agent to Agent Agent Platform to Agent Platform

13

Remote Monitoring Agent

Provide the GUI to control agents’ lifecycle

14

Install JDK 1.5

http://java.sun.com/ Download J2SE Development Kit (JDK) 1.5

The Java Runtime Environment (JRE) Command-line development tools, such as

compilers and debuggers, that are necessary or useful for developing applets and applications

15

Install JDK 1.5 -- step 1

downloads

Web Site

16

Install JDK 1.5 -- step 2

Select Java SE

17

Install JDK 1.5 -- step 3

Download

18

Other Revisions of JDK

Previous Release Next Release

19

JADE Package

• JADE-doc•Document

•JADE-src•Source Code

•JADE-bin•Binary Code

•JADE-example•Example Code

20

Install JADE Platform

Batch file

Library

21

Install JADE Platform

Write batch file run_jade.bat

Include related library Base64.jar http.jar iiop.jar jade.jar jadeTools.jar

22

Batch file to start JADE platform

Set Library Pathset JADE=C:\jade\lib\base64.jar;C:\jade\lib\

http.jar;C:\jade\lib\iiop.jar;C:\jade\lib\jade.jar;C:\jade\lib\jadeTools.jar;./;

Execute Command java -classpath %JADE% jade.Boot -gui

Use Java to start jade platform Interface

23

Run JADE Platform

Run run_jade.bat

24

Connect Remote JADE Platform

25

Batch File to Connect the Remote JADE Platform

Set Library Pathset JADE=C:\jade\lib\base64.jar;C:\jade\lib\

http.jar;C:\jade\lib\iiop.jar;C:\jade\lib\jade.jar;C:\jade\lib\jadeTools.jar;./;

Set Connection Command java -classpath %JADE% jade.Boot -gui -

container -host 140.116.xxx.xxx

Add new containe Destination IP

26

Connect Remote JADE platform

Execute connect_remote_jade.batConnect Remote JADE platform

27

Example

Book Seller & Book BuyerSeller1

Seller2Buyer

Implement Agent with Eclipse (1)

28

Main Function of JADE

Implement Agent with Eclipse (2)

29

-gui Seller1 : BookSerllerAgent

Agent NameClass Name

Implement Agent with Eclipse (3)

30

-gui –container –host localhost Seller2 : BookSerllerAgent

Agent Name

Class Name

Run Agent on JADE Platform

31

Observe Agent Communication Language

32

Agent Communication Language

33

Agent Communication Language

sender of the message list of receivers communicative intention (or “performative”) content content language ontology some fields

34

Agent Communication Language

Receiving Messages

35

36

An Example of Sender

An Example of Receiver

39

BookSellerAgent

BookSellerAgent extends Agent import jade.core.Agent; Initial process

Setup() addBehaviour(new InitBeha())

Agent Behaviour import jade.core.behaviours.*;

InitBeha extends Behaviour class

BookSellerAgent Setup()

40

Service Registration• Service Name• Service Type

Add Behaviour

BookSellerAgent Takedown()

41

Service deregistration

class Behaviour

This abstract class provides an abstract base class for modelling agent tasks, and it sets the basis for behaviour scheduling as it allows for state transitions (i.e. starting, blocking and restarting a Java behaviour object).

42

43

class Behaviour (Cont.)

class SimpleBehaviour This abstract class models simple atomic behaviours. Its

reset() method does nothing by default, but it can be overridden by user defined subclasses.

class OneShotBehaviour This abstract class models atomic behaviours that must be executed only

once and cannot be blocked. So, its done() method always returns true.

class CyclicBehaviour This abstract class models atomic behaviours that must be executed

forever. So its done() method always returns false.

44

BookSellerAgent OneShotBehaviour()

45

BookSellerAgent CyclicBehaviour()

46

class Behaviour (Cont.)

class WakerBehaviourThis abstract class implements a one-shot

task that must be executed only once just after a given timeout is elapsed.

class TickerBehaviourThis abstract class implements a cyclic task

that must be executed periodically.

47

class Behaviour (Cont.)

class CompositeBehaviour This abstract class models behaviours that are made up by

composing a number of other behaviours (children). So the actual operations performed by executing this behaviour are not defined in the behaviour itself, but inside its children while the composite behaviour takes only care of children scheduling according to a given policy.

class SequentialBehaviour This class is a CompositeBehaviour that executes its sub-behaviours

sequentially and terminates when all sub-behaviours are done. Use this class when a complex task can be expressed as a sequence of atomic steps (e.g. do some computation, then receive a message, then do some other computation).

48

class Behaviour (Cont.)

class ParallelBehaviour This class is a CompositeBehaviour that executes its sub-behaviours

concurrently and terminates when a particular condition on its sub-behaviours is met. Proper constants to be indicated in the constructor of this class are provided to create a ParallelBehaviour that ends when all its sub-behaviours are done, when any one among its sub-behaviour terminates or when a user defined number N of its sub-behaviours have finished. Use this class when a complex task can be expressed as a collection of parallel alternative operations, with some kind of termination condition on the spawned subtasks.

49

class Behaviour (Cont.)

class FSMBehaviour This class is a CompositeBehaviour that executes its children according

to a Finite State Machine defined by the user. More in details each child represents the activity to be performed within a state of the FSM and the user can define the transitions between the states of the FSM. When the child corresponding to state Si completes, its termination value (as returned by the onEnd() method) is used to select the transition to fire and a new state Sj is reached. At next round the child corresponding to Sj will be executed. Some of the children of an FSMBehaviour can be registered as final states. The FSMBehaviour terminates after the completion of one of these children.

50

51

Reference

http://www.fipa.org/高師大共同科 --楊錦潭、高師大資教所 --蕭淳豐,”開發智慧型代理人軟體工程平台初探”