Transcript Document

Introduction of Java Agent
Development Environment (JADE)
Presented by Po-Cheng Huang
1
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
2
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
3
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
5
6
JADE Platform
7
Directory Facilitator
8
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.
9
Agent Management System (AMS)
10
Agent Management System

Provides the naming service


Ensures that each agent in the platform has
a unique name
Represents the authority in the platform

To create/kill agents on remote containers
by requesting that to the AMS
11
Message Transport System

Agent Communication Channel (ACC)
 Agent to Agent
 Agent Platform to Agent Platform
12
Remote Monitoring Agent

Provide the GUI to control agents’ lifecycle
13
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

14
Install JDK 1.5 -- step 1
Web Site
downloads
15
Install JDK 1.5 -- step 2
Select Java SE
16
Install JDK 1.5 -- step 3
Download
17
Other Revisions of JDK
Next Release
Previous Release
18
JADE Package
• JADE-doc
•Document
•JADE-src
•Source Code
•JADE-bin
•Binary Code
•JADE-example
•Example Code
19
Install JADE Platform
Library
Batch file
20
Install JADE Platform

Write batch file


run_jade.bat
Include related library





Base64.jar
http.jar
iiop.jar
jade.jar
jadeTools.jar
21
Batch file to start JADE platform

Set Library Path


set
JADE=C:\jade\lib\base64.jar;C:\jade\lib\http.
jar;C:\jade\lib\iiop.jar;C:\jade\lib\jade.jar;C:\j
ade\lib\jadeTools.jar;./;
Execute Command

java -classpath %JADE% jade.Boot -gui
Use Java to start jade platform
Interface
22
Run JADE Platform

Run run_jade.bat
23
Connect Remote JADE Platform
24
Batch File to Connect the Remote
JADE Platform

Set Library Path


set
JADE=C:\jade\lib\base64.jar;C:\jade\lib\http.
jar;C:\jade\lib\iiop.jar;C:\jade\lib\jade.jar;C:\j
ade\lib\jadeTools.jar;./;
Set Connection Command

java -classpath %JADE% jade.Boot -gui container -host 140.116.xxx.xxx
Add new containe
Destination IP
25
Connect Remote JADE platform

Execute connect_remote_jade.bat

Connect Remote JADE platform
26
Example

Book Seller & Book Buyer
Seller1
Buyer
Seller2
27
Implement Agent with Eclipse (1)
Main Function of JADE
28
Implement Agent with Eclipse (2)
-gui Seller1 : BookSerllerAgent
Class Name
Agent Name
29
Implement Agent with Eclipse (3)
-gui –container –host localhost Seller2 : BookSerllerAgent
Class Name
Agent Name
30
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
BookSellerAgent

BookSellerAgent extends Agent
 import jade.core.Agent;
 Initial process


Setup()
 addBehaviour(new InitBeha())
Agent Behaviour
 import jade.core.behaviours.*;

InitBeha extends Behaviour class
39
BookSellerAgent Setup()
Service Registration
• Service Name
• Service Type
Add Behaviour
40
BookSellerAgent Takedown()
Service deregistration
41
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 WakerBehaviour


This abstract class implements a one-shot
task that must be executed only once just
after a given timeout is elapsed.
class TickerBehaviour

This 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 subbehaviours 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
Reference
http://www.fipa.org/
 高師大共同科--楊錦潭、高師大資教所-蕭淳豐,”開發智慧型代理人軟體工程平
台初探”

51