Introduction to JADE presenter: Ji-Yu Li

Preview:

DESCRIPTION

Introduction to JADE presenter: Ji-Yu Li. 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. Outline. Introduction - PowerPoint PPT Presentation

Citation preview

1

Introduction to JADE

presenter: Ji-Yu Li

2

OutlineOutline

IntroductionFoundation for Intelligent Physical Agents (FIPA)

Java Agent Development Environment (JADE)

Running JADE PlatformInstall JDK 1.5

Install JADE Platform

Run JADE Platform

Run Agent on JADE Platform

3

OutlineOutline

IntroductionFoundation for Intelligent Physical Agents (FIPA)

Java Agent Development Environment (JADE)

Running JADE PlatformInstall JDK 1.5

Install JADE Platform

Run JADE Platform

Run Agent on JADE Platform

4

Foundation for Intelligent Physical Agents (FIPA)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 managementAgent communication language (ACL)Integration agent and other computer softwarehttp://www.fipa.org/

A software agentA piece of software that acts for a user or other program in a relationship of agency

6

OutlineOutline

IntroductionFoundation for Intelligent Physical Agents (FIPA)

Java Agent Development Environment (JADE)

Running JADE PlatformInstall JDK 1.5

Install JADE Platform

Run JADE Platform

Run Agent on JADE Platform

7

JADEJADEJADE (Java Agent Development Framework)

Framework aimed at developing multi-agent systems and applications conforming to FIPA standards for intelligent agents.

8

JADEJADEThe agent platform can be split among several hosts. Only one Java application(Main container) is executed on each host.

9

JADEJADE

Support to the execution of multiple, parallel and concurrent agent activities via the behaviour model.

10

JADE platformJADE 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

11 11

12

Containers and PlatformsContainers and Platforms

13

Containers and PlatformsContainers and Platforms

Each running instance of the JADE runtime environment is called a Container as it can contain several agents.

14

Containers and PlatformsContainers and Platforms

The set of active containers is called a Platform.

15

Containers and PlatformsContainers and Platforms

A single special Main container must always be active in a platform and all other containers register with it as soon as they start.

16

JADEJADE

17

JADEJADE

Main container

18

JADEJADE

AMS (Agent Management System) Provides the naming service and represents the authority in the platform.

DF (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.

RMA(Remote Management Agent)Acting as graphical console for platform management and control.

19

Agent Management System (AMS)Agent Management System (AMS)

20

Agent Management SystemAgent Management System

Provides the naming serviceEnsures that each agent in the platform has a unique name

Represents the authority in the platformTo create/kill agents on remote containers by requesting that to the AMS

21

Directory FacilitatorDirectory Facilitator

22

Directory FacilitatorDirectory 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.

23

DF AgentDF Agent

24

Remote Monitoring AgentRemote Monitoring Agent

Provide the GUI to control agents’ lifecycle

25

Message Transport SystemMessage Transport System

Agent Communication Channel (ACC)

Agent to Agent

Agent Platform to Agent Platform

26

JADEJADE

27

JADEJADE

Agent identifier <nickname>@<platform_name>

nickname platform_name

28

OutlineOutline

IntroductionFoundation for Intelligent Physical Agents (FIPA)

Java Agent Development Environment (JADE)

Running JADE PlatformInstall JDK 1.5

Install JADE Platform

Run JADE Platform

Run Agent on JADE Platform

29

Install JDK 1.5Install 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

30 30

Install JDK 1.5 -- step 1Install JDK 1.5 -- step 1

downloads

Web Site

31 31

Install JDK 1.5 -- step 2Install JDK 1.5 -- step 2

Select Java SE

32 32

Install JDK 1.5 -- step 3Install JDK 1.5 -- step 3

Download

33

OutlineOutline

IntroductionFoundation for Intelligent Physical Agents (FIPA)

Java Agent Development Environment (JADE)

Running JADE PlatformInstall JDK 1.5

Install JADE Platform

Run JADE Platform

Run Agent on JADE Platform

34

JADEJADE

http://jade.tilab.com/

35

JADE PackageJADE Package

•JADE-doc•Document

•JADE-src•Source Code

•JADE-bin•Binary Code

•JADE-example•Example Code

36

Download eclipseDownload eclipse

Eclipse - an open development platformEclipse is an open source community whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the lifecycle.

http://www.eclipse.org/downloads/

37

Download eclipseDownload eclipse

38

OutlineOutline

IntroductionFoundation for Intelligent Physical Agents (FIPA)

Java Agent Development Environment (JADE)

Running JADE PlatformInstall JDK 1.5

Install JADE Platform

Run JADE Platform

Run Agent on JADE Platform

39

40

41

42

43

44

45

46

jade.Boot

1

2

3

47

-gui

1

2

3

48

49

OutlineOutline

IntroductionFoundation for Intelligent Physical Agents (FIPA)

Java Agent Development Environment (JADE)

Running JADE PlatformInstall JDK 1.5

Install JADE Platform

Run JADE Platform

Run Agent on JADE Platform

50

ImplementationImplementation

1. Import jade.core.Agent Library

2. setup() 初始化 agent ,向 AMS 註冊,此時狀態為ACTIVE

3. addBehaviour() 加入 behaviours 到排程佇列,傳入的參數為一個 Behaviour class

4. action() 定義 behaviour 中的行為

5. doDelete() 結束此 agent

51

ImplementationImplementation

import jade.core.Agent;import jade.core.behaviours.OneShotBehaviour;

public class HelloAgent extends Agent{ protected void setup() { addBehaviour(new InitBeha()); }

class InitBeha extends OneShotBehaviour { public void action() { System.out.println(“Hello!"); doDelete(); } }}

52

53

54

55

-container -host <IP> <agent_name>:<class_name>

56

57

End

58

Introduction to Agent

presenter: Ji-Yu Li

59

Outline Outline

Behaviour

Agent Communication

Example

Sniffer Agent

Example 2

60

Behaviour Behaviour

The setup() method should add at least one behaviour to the agent.

Every JADE agent is compose of a single execution thread and all its tasks are modeled and can be implemented as Behaviour objects.

addBehavior(Behaviour) & removeBehaviour(Behaviour) allow to manage the ready tasks queue of an agent.

61

Behaviour Behaviour

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.

62 62

63

ImplementationImplementation

OneShotBehaviouragent 只會執行一次

CyclicBehaviouragent 的會以輪詢的方式來執行

import jade.core.behaviours.OneShotBehaviour

import jade.core.behaviours.CyclicBehaviour

64

65

SimpleBehaviourSimpleBehaviour

class SimpleBehaviourclass 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 CyclicBehaviourThis abstract class models atomic behaviours that must be executed forever. So its done() method always returns false.

66

CompositeBehaviourCompositeBehaviour

class CompositeBehaviourclass SequentialBehaviour

This class is a CompositeBehaviour that executes its sub-behaviours sequentially and terminates when all sub-behaviours are done.

class ParallelBehaviourThis class is a CompositeBehaviour that executes its sub-behaviours concurrently and terminates when a particular condition on its sub-behaviours is met.

class FSMBehaviourThis class is a CompositeBehaviour that executes its children according to a Finite State Machine defined by the user.

67

Outline Outline

Behaviour

Agent Communication

Example

Sniffer Agent

Example 2

68

Agent CommunicationAgent Communication

69

Agent CommunicationAgent Communication

sender of the message

list of receivers

communicative intention (or “performative”)

content

content language

ontology

some fields

70

Agent CommunicationAgent Communication

Receiving Messages

71

Outline Outline

Behaviour

Agent Communication

Example

Sniffer Agent

Example 2

72

Example Example

寫兩支 Agent 於 JADE 上 :SenderAgent

OneShotBehaviour

用 ACLMessage 傳送字串給 ReceiverAgent

ReceiverAgentCyclicBehaviour

接收由 SenderAgent 傳送之字串並印出

73

ExampleExample

74

SenderSender

75

ReceiverReceiver

76

Exmaple Exmaple

77

Outline Outline

Behaviour

Agent Communication

Example

Sniffer Agent

Example 2

78

Sniffer Sniffer

79

Sniffer Sniffer

80

Sniffer Sniffer

81

Outline Outline

Behaviour

Agent Communication

Example

Sniffer Agent

Example 2

82

Example 2 Example 2

寫三支 agent

•Sender 送給 HelloAgent 字串” Hello” , HelloAgent 會在執行畫面上印出 sender 的名稱並回傳 Hi

•接著 SenderAgent 再傳送數字給 MathAgent , MathAgen 收到後再回傳從 1加到該數字的總和,並在SenderAgent 端執行畫面印出。

83

Arguments Arguments

84

SenderAgent SenderAgent

85

SenderAgent SenderAgent

86

SenderAgentSenderAgent

87

HelloAgent HelloAgent

寫三支 agent

•Sender 送給 HelloAgent 字串” Hello” , HelloAgent 會在執行畫面上印出 sender 的名稱並回傳 Hi

•接著 SenderAgent 再傳送數字給 MathAgent , MathAgen 收到後再回傳從 1加到該數字的總和,並在SenderAgent 端執行畫面印出。

88

HelloAgentHelloAgent

89

MathAgent MathAgent

寫三支 agent

•Sender 送給 HelloAgent 字串” Hello” , HelloAgent 會在執行畫面上印出 sender 的名稱並回傳 Hi

•接著 SenderAgent 再傳送數字給 MathAgent , MathAgen 收到後再回傳從 1加到該數字的總和,並在SenderAgent 端執行畫面印出。

※一樣要 do sniffer 觀察這三支 agent

90

MathAgentMathAgent

91

Results Results

SenderAgent

HelloAgent

MathAgent

92

ResultsResults

93

Sniffer AgentSniffer Agent

94

HomeworkHomework

寫兩支 Agent 互相溝通

(a) 輸入地點,查詢今日天氣預報

(b) 猜數字遊戲

95

End

Recommended