1 Introduction to JADE presenter: Syuan-Hao Li
Dec 20, 2015
2
OutlineOutline
IntroductionJava Virtual Machine
Foundation for Intelligent Physical Agents (FIPA)
Java Agent Development Environment (JADE)
Running JADE PlatformInstall JDK 1.6
Install JADE Platform
Run JADE Platform
Run Agent on JADE Platform
3
OutlineOutline
IntroductionJava Virtual Machine
Foundation for Intelligent Physical Agents (FIPA)
Java Agent Development Environment (JADE)
Running JADE PlatformInstall JDK 1.6
Install JADE Platform
Run JADE Platform
Run Agent on JADE Platform
4
Java Virtual Machine
An abstract computing machine.
The JVM knows nothing of the Java PL, only of a particular binary format, the class file format.
A class file contains JVM instructions (or byte codes) and a symbol table, as well as other ancillary information.
5
Java Byte Codes
Rather than generating an executable machine instructions, a Java compiler outputs what are known as Java byte codes.
Java byte codes are instructions written for a Java Virtual Machine that does not really exist.
Java interpreter executes the byte code by emulating the JVM on whatever platform you happen to be using.
7
Example
HelloWorld.java
import javax.swing.JOptionPane;
public class HelloWorld{ public static void Print() { JOptionPane.showMessageDialog(null, "Hello! World!"); }
public static void main(String[] args) { System.out.println("Hello! World!"); Print(); }}
Import library
Must be the same to the file name
Entry point
8
Homework
Write a java programQuery the information of a web site (ex. Stock, Weather forecast ) by user input.
ReferenceJava API Docs http://java.sun.com/javase/6/docs/api/
良葛格 java 學習筆記http://caterpillar.onlyfun.net/Gossip/JavaGossip-V1/JavaGossip.htm
9
OutlineOutline
IntroductionJava Virtual Machine
Foundation for Intelligent Physical Agents (FIPA)
Java Agent Development Environment (JADE)
Running JADE PlatformInstall JDK 1.6
Install JADE Platform
Run JADE Platform
Run Agent on JADE Platform
10
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
11
OutlineOutline
IntroductionJava Virtual Machine
Foundation for Intelligent Physical Agents (FIPA)
Java Agent Development Environment (JADE)
Running JADE PlatformInstall JDK 1.6
Install JADE Platform
Run JADE Platform
Run Agent on JADE Platform
12
JADEJADEJADE (Java Agent Development Framework)
Framework aimed at developing multi-agent systems and applications conforming to FIPA standards for intelligent agents.
13
JADEJADEThe agent platform can be split among several hosts. Only one Java application(Main container) is executed on each host.
14
JADEJADE
Support to the execution of multiple, parallel and concurrent agent activities via the behaviour model.
15
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
18
Containers and PlatformsContainers and Platforms
Each running instance of the JADE runtime environment is called a Container as it can contain several agents.
19
Containers and PlatformsContainers and Platforms
The set of active containers is called a Platform.
20
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.
23
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.
25
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
27
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.
30
Message Transport SystemMessage Transport System
Agent Communication Channel (ACC)
Agent to Agent
Agent Platform to Agent Platform
33
OutlineOutline
IntroductionJava Virtual Machine
Foundation for Intelligent Physical Agents (FIPA)
Java Agent Development Environment (JADE)
Running JADE PlatformInstall JDK 1.6
Install JADE Platform
Run JADE Platform
Run Agent on JADE Platform
34
Install JDK 1.6Install JDK 1.6
http://java.sun.com/ Download J2SE Development Kit (JDK) 1.6
The Java Runtime Environment (JRE)
Command-line development tools, such as compilers and debuggers, that are necessary or useful for developing applets and applications
39
OutlineOutline
IntroductionJava Virtual Machine
Foundation for Intelligent Physical Agents (FIPA)
Java Agent Development Environment (JADE)
Running JADE PlatformInstall JDK 1.6
Install JADE Platform
Run JADE Platform
Run Agent on JADE Platform
41
JADE PackageJADE Package
•JADE-doc•Document
•JADE-src•Source Code
•JADE-bin•Binary Code
•JADE-example•Example Code
42
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/
44
OutlineOutline
IntroductionJava Virtual Machine
Foundation for Intelligent Physical Agents (FIPA)
Java Agent Development Environment (JADE)
Running JADE PlatformInstall JDK 1.6
Install JADE Platform
Run JADE Platform
Run Agent on JADE Platform
56
Arguments Options
-host <host name>Host where RMI registry for the platform is located
-port <port number>The port where RMI registry for the platform resides
-containerIf specified, a new Agent Container is added to an existing platform. Otherwise a new Agent Platform is created
-confShows the gui to set the configuration properties to start JADE.
-guiIf specified, a new Remote Management Agent is created.
-versionIf specified, current JADE version number and build date is printed.
57
OutlineOutline
IntroductionJava Virtual Machine
Foundation for Intelligent Physical Agents (FIPA)
Java Agent Development Environment (JADE)
Running JADE PlatformInstall JDK 1.6
Install JADE Platform
Run JADE Platform
Run Agent on JADE Platform
58
ImplementationImplementation
1. Import jade.core.Agent Library
2. setup() Initialize and register this agent to AMS, the current state is ACTIVE.
3. addBehaviour() Add behaviours to queue, the parameter is a behaviour class.
4. action() Define action of behaviour.
5. doDelete() Shut down the agent.
59
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(); } }}
68
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.
69
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.
71
ImplementationImplementation
OneShotBehaviourAgent execute only once.
CyclicBehaviourAgent execute by polling.
import jade.core.behaviours.OneShotBehaviour
import jade.core.behaviours.CyclicBehaviour
73
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.
74
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.
77
Agent CommunicationAgent Communication
sender of the message
list of receivers
communicative intention (or “performative”)
content
content language
ontology
some fields
80
Example Example
Write two agent in JADE Platform:SenderAgent
OneShotBehaviour
Send string to ReceiverAgent by using ACLMessage.
ReceiverAgentCyclicBehaviour
Receive and print the string from SenderAgent.
101
HomeworkHomework
Game: Three In A Row (3X3)
Five In A Row (9X9)
Write two or three Agent (A,B+C or A,B,C)Agent A : User
Input the position (X,Y) in chess board.
Agent B : Chess boardStore position of chess and judge who win.
Agent C : AI