没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
JADE Programmer’s GUIDE
1
JADE PROGRAMMER’S GUIDE
USAGE
RESTRICTED ACCORDING TO LICENSE AGREEMENT.
last update:18-June-2007. JADE 3.5
Authors: Fabio Bellifemine, Giovanni Caire, Tiziana Trucco (TILAB, formerly CSELT)
Giovanni Rimassa (University of Parma)
Copyright (C) 2000 CSELT S.p.A.
Copyright (C) 2001 TILab S.p.A.
Copyright (C) 2002 TILab S.p.A.
Copyright (C) 2003 TILab S.p.A.
Copyright (C) 2004 TILab S.p.A.
Copyright (C) 2005 Telecom Italia S.p.A.
Copyright (C) 2006 Telecom Italia S.p.A.
Copyright (C) 2007 Telecom Italia S.p.A.
JADE - Java Agent DEvelopment Framework is a framework to develop multi-agent systems in compliance with
the FIPA specifications. JADE successfully passed the 1
st
FIPA interoperability test in Seoul (Jan. 99) and the 2
nd
FIPA
interoperability test in London (Apr. 01).
Copyright (C) 2000 CSELT S.p.A. (C) 2001 TILab S.p.A. (C) 2002 TILab S.p.A. (C) 2003 TILab S.p.A.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
Public License as published by the Free Software Foundation, version 2.1 of the License.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.
JADE Programmer’s GUIDE
2
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write
to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
TABLE OF CONTENTS
1 INTRODUCTION 4
2 JADE FEATURES 6
3 CREATING MULTI-AGENT SYSTEMS WITH JADE 7
3.1 The Agent Platform 7
3.1.1 FIPA-Agent-Management ontology 8
3.1.1.1 Basic concepts of the ontology 9
3.1.2 Simplified API to access DF and AMS services 9
3.1.2.1 DFService 9
3.1.2.2 AMSService 10
3.2 The Agent class 10
3.2.1 Agent life cycle 11
3.2.1.1 Starting the agent execution 12
3.2.1.2 Stopping agent execution 12
3.2.2 Inter-agent communication. 13
3.2.2.1 Accessing the private queue of messages. 13
3.2.3 Agents with a graphical user interface (GUI). 13
3.2.3.1 Java GUI concurrency model 13
3.2.3.2 Performing an ACL message exchange in response to a GUI event. 14
3.2.3.3 Modifying the GUI when an ACL message is received. 16
3.2.3.4 Support for building GUI enabled agents in JADE. 17
3.2.4 Agent with parameters and launching agents 20
3.3 Agent Communication Language (ACL) Messages 21
3.3.1 Support to reply to a message 21
3.3.2 Support for Java serialisation and transmission of a sequence of bytes 21
3.3.3 The ACL Codec 22
3.3.4 The MessageTemplate class 22
3.3.5 Topic-based communication 23
3.4 The agent tasks. Implementing Agent behaviours 24
3.4.1 class Behaviour 27
3.4.2 class SimpleBehaviour 28
3.4.3 class OneShotBehaviour 28
3.4.4 class CyclicBehaviour 28
3.4.5 class CompositeBehaviour 28
3.4.6 class SequentialBehaviour 29
3.4.7 class ParallelBehaviour 29
3.4.8 class FSMBehaviour 29
3.4.9 class WakerBehaviour 30
3.4.10 class TickerBehaviour 30
3.4.11 Examples 30
3.4.12 Executing Behaviours in a dedicated Java Thread 33
JADE Programmer’s GUIDE
3
3.5 Interaction Protocols 35
3.5.1 AchieveRE (Achieve Rational Effect) 35
3.5.1.1 AchieveREInitiator 36
3.5.1.2 SimpleAchieveREInitiator 37
3.5.1.3 AchieveREResponder 38
3.5.1.4 SimpleAchiveREResponder 38
3.5.1.5 Example of using these two generic classes for implementing a specific FIPA protocol
39
3.5.2 FIPA-Contract-Net 39
3.5.2.1 ContractNetInitiator 40
3.5.2.2 ContractNetResponder 41
3.5.3 FIPA-Propose 41
3.5.3.1 ProposeInitiator 41
3.5.3.2 ProposeResponder 42
3.5.4 FIPA-Subscribe 42
3.5.4.1 Subscription Initiator 43
3.5.4.2 Subscription Responder 44
3.5.4.2.1 Subscription 44
3.5.4.2.2 Subscription Manager 44
3.5.5 Generic states of interaction protocols 45
3.5.5.1 HandlerSelector class 45
3.5.5.2 MsgReceiver class 45
3.6 Application-defined content languages and ontologies 45
3.7 Support for Agent Mobility 45
3.7.1 JADE API for agent mobility. 46
3.7.2 JADE Mobility Ontology. 46
3.7.3 Accessing the AMS for agent mobility. 48
3.8 Using JADE from external Java applications 51
4 A SAMPLE AGENT SYSTEM52
5 LIST OF ACRONYMS AND ABBREVIATED TERMS 53
JADE Programmer’s GUIDE
4
1 INTRODUCTION
This programmer's guide is complemented by the administrator's guide and the HTML
documentation available in the directory jade/doc. If and where conflict arises between what is
reported in the HTML documentation and this guide, preference should be given to the HTML
documentation that is updated more frequently.
JADE (Java Agent Development Framework) is a software development framework aimed
at developing multi-agent systems and applications conforming to FIPA standards for intelligent
agents. It includes two main products: a FIPA-compliant agent platform and a package to develop
Java agents. JADE has been fully coded in Java and an agent programmer, in order to exploit the
framework, should code his/her agents in Java, following the implementation guidelines
described in this programmer's guide.
This guide supposes the reader to be familiar with the FIPA standards
1
, at least with the
Agent Management specifications (FIPA no. 23), the Agent Communication Language, and the
ACL Message Structure (FIPA no. 61).
JADE is written in Java language and is made of various Java packages, giving application
programmers both ready-made pieces of functionality and abstract interfaces for custom,
application dependent tasks. Java was the programming language of choice because of its many
attractive features, particularly geared towards object-oriented programming in distributed
heterogeneous environments; some of these features are Object Serialization, Reflection API and
Remote Method Invocation (RMI).
JADE is composed of the following main packages.
jade.core implements the kernel of the system. It includes the Agent class that must be
extended by application programmers; besides, a
Behaviour class hierarchy is contained in
jade.core.behaviours sub-package. Behaviours implement the tasks, or intentions, of an
agent. They are logical activity units that can be composed in various ways to achieve complex
execution patterns and that can be concurrently executed. Application programmers define agent
operations writing behaviours and agent execution paths interconnecting them.
The
jade.lang.acl sub-package is provided to process Agent Communication Language
according to FIPA standard specifications.
The
jade.content package contains a set of classes to support user-defined ontologies
and content-languages. A separate tutorial describes how to use the JADE support to message
content. In particular
jade.content.lang.sl contains the SL codec
2
, both the parser and the
encoder.
The
jade.domain package contains all those Java classes that represent the Agent
Management entities defined by the FIPA standard, in particular the AMS and DF agents, that
provide life-cycle, white and yellow page services. The subpackage
jade.domain.FIPAAgentManagement contains the FIPA-Agent-Management Ontology and
all the classes representing its concepts. The subpackage
jade.domain.JADEAgentManagement contains, instead, the JADE extensions for Agent-
Management (e.g. for sniffing messages, controlling the life-cycle of agents, …), including the
1
See http://www.fipa.org/
2
refer to FIPA document no. 8 for the specifications of the SL content language.
JADE Programmer’s GUIDE
5
Ontology and all the classes representing its concepts. The subpackage jade.domain.introspection
contains the concepts used for the domain of discourse between the JADE tools (e.g. the Sniffer
and the Introspector) and the JADE kernel. The subpackage jade.domain.mobility contains all
concepts used to communicate about mobility.
The
jade.gui package contains a set of generic classes useful to create GUIs to display and
edit Agent-Identifiers, Agent Descriptions, ACLMessages, …
The
jade.mtp package contains a Java interface that every Message Transport Protocol
should implement in order to be readily integrated with the JADE framework, and the
implementation of a set of these protocols.
jade.proto is the package that contains classes to model standard interaction protocols
(i.e. fipa-request, fipa-query, fipa-contract-net, fipa-subscribe and soon others defined by FIPA),
as well as classes to help application programmers to create protocols of their own.
The
FIPA package contains the IDL module defined by FIPA for IIOP-based message
transport.
Finally, the
jade.wrapper package provides wrappers of the JADE higher-level
functionalities that allows the usage of JADE as a library, where external Java applications launch
JADE agents and agent containers (see also section 3.8).
JADE comes bundled with some tools that simplify platform administration and application
development. Each tool is contained in a separate sub-package of
jade.tools. Currently, the
following tools are available:
¾ Remote Management Agent, RMA for short, acting as a graphical console for platform
management and control. A first instance of an RMA can be started with a command
line option ("-gui") , but then more than one GUI can be activated. JADE maintains
coherence among multiple RMAs by simply multicasting events to all of them.
Moreover, the RMA console is able to start other JADE tools.
¾ The Dummy Agent is a monitoring and debugging tool, made of a graphical user
interface and an underlying JADE agent. Using the GUI it is possible to compose
ACL messages and send them to other agents; it is also possible to display the list of
all the ACL messages sent or received, completed with timestamp information in
order to allow agent conversation recording and rehearsal.
¾ The Sniffer is an agent that can intercept ACL messages while they are in flight, and
displays them graphically using a notation similar to UML sequence diagrams. It is
useful for debugging your agent societies by observing how they exchange ACL
messages.
¾ The Introspector is an agent that allows to monitor the life cycle of an agent, its
exchanged ACL messages and the behaviours in execution.
¾ The DF GUI is a complete graphical user interface that is used by the default
Directory Facilitator (DF) of JADE and that can also be used by every other DF that
the user might need. In such a way, the user might create a complex network of
domains and sub-domains of yellow pages. This GUI allows in a simple and intuitive
way to control the knowledge base of a DF, to federate a DF with other DF's, and to
remotely control (register/deregister/modify/search) the knowledge base of the parent
DF's and also the children DF's (implementing the network of domains and sub-
domains).
¾ The LogManagerAgent is an agent that allows setting at runtime logging information,
such as the log level, for both JADE and application specific classes that use Java
Logging.
剩余52页未读,继续阅读
sdlcjx
- 粉丝: 5
- 资源: 46
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0