Introduction to JADE presenter: Syuan-Hao Li
Outline Introduction Running JADE Platform Java Virtual Machine Foundation for Intelligent Physical Agents (FIPA) Java Agent Development Environment (JADE) Running JADE Platform Install JDK 1.6 Install JADE Platform Run JADE Platform Run Agent on JADE Platform
Outline Introduction Running JADE Platform Java Virtual Machine Foundation for Intelligent Physical Agents (FIPA) Java Agent Development Environment (JADE) Running JADE Platform Install JDK 1.6 Install JADE Platform Run JADE Platform Run Agent on JADE Platform
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.
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.
Comparison Java Virtual Machine
Must be the same to the file name 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
Homework Write a java program Reference Query the information of a web site (ex. Stock, Weather forecast ) by user input. Reference Java API Docs http://java.sun.com/javase/6/docs/api/ 良葛格 java 學習筆記http://caterpillar.onlyfun.net/Gossip/JavaGossip-V1/JavaGossip.htm
Outline Introduction Running JADE Platform Java Virtual Machine Foundation for Intelligent Physical Agents (FIPA) Java Agent Development Environment (JADE) Running JADE Platform Install JDK 1.6 Install JADE Platform Run JADE Platform Run Agent on JADE Platform
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
Outline Introduction Running JADE Platform Java Virtual Machine Foundation for Intelligent Physical Agents (FIPA) Java Agent Development Environment (JADE) Running JADE Platform Install JDK 1.6 Install JADE Platform Run JADE Platform Run Agent on JADE Platform
JADE JADE (Java Agent Development Framework) Framework aimed at developing multi-agent systems and applications conforming to FIPA standards for intelligent agents.
JADE The agent platform can be split among several hosts. Only one Java application(Main container) is executed on each host.
JADE Support to the execution of multiple, parallel and concurrent agent activities via the behaviour model.
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
Containers and Platforms
Containers and Platforms Each running instance of the JADE runtime environment is called a Container as it can contain several agents.
Containers and Platforms The set of active containers is called a Platform.
Containers 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.
JADE
JADE Main container
JADE AMS (Agent Management System) DF (Directory Facilitator) 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.
Agent Management System (AMS)
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
Directory Facilitator
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.
DF Agent
Remote Monitoring Agent Provide the GUI to control agents’ lifecycle
Message Transport System Agent Communication Channel (ACC) Agent to Agent Agent Platform to Agent Platform
JADE
JADE Agent identifier <nickname>@<platform_name> nickname
Outline Introduction Running JADE Platform Java Virtual Machine Foundation for Intelligent Physical Agents (FIPA) Java Agent Development Environment (JADE) Running JADE Platform Install JDK 1.6 Install JADE Platform Run JADE Platform Run Agent on JADE Platform
Install 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
Install JDK 1.6 -- step 1 Web Site downloads
Install JDK 1.6 -- step 2 Download
Install JDK 1.6 -- step 3 Your platform 37
Install JDK 1.6 -- step 4 Download 38
Outline Introduction Running JADE Platform Java Virtual Machine Foundation for Intelligent Physical Agents (FIPA) Java Agent Development Environment (JADE) Running JADE Platform Install JDK 1.6 Install JADE Platform Run JADE Platform Run Agent on JADE Platform
JADE http://jade.tilab.com/
JADE Package JADE-doc Document JADE-src Source Code JADE-bin Binary Code JADE-example Example Code
Download eclipse Eclipse - an open development platform Eclipse 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/
Download eclipse
Outline Introduction Running JADE Platform Java Virtual Machine Foundation for Intelligent Physical Agents (FIPA) Java Agent Development Environment (JADE) Running JADE Platform Install JDK 1.6 Install JADE Platform Run JADE Platform Run Agent on JADE Platform
2 1 3 jade.Boot
1 -gui 2 3
1 -help 2 3
Arguments Options -host <host name> -port <port number> Host where RMI registry for the platform is located -port <port number> The port where RMI registry for the platform resides -container If specified, a new Agent Container is added to an existing platform. Otherwise a new Agent Platform is created -conf Shows the gui to set the configuration properties to start JADE. -gui If specified, a new Remote Management Agent is created. -version If specified, current JADE version number and build date is printed.
Outline Introduction Running JADE Platform Java Virtual Machine Foundation for Intelligent Physical Agents (FIPA) Java Agent Development Environment (JADE) Running JADE Platform Install JDK 1.6 Install JADE Platform Run JADE Platform Run Agent on JADE Platform
Implementation Import jade.core.Agent Library setup() Initialize and register this agent to AMS, the current state is ACTIVE. addBehaviour() Add behaviours to queue, the parameter is a behaviour class. action() Define action of behaviour. doDelete() Shut down the agent.
Implementation 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();
-container -host <IP> <agent_name>:<class_name>
End
Introduction to Agent presenter: Syuan-Hao Li
Outline Behaviour Agent Communication Example Sniffer Agent Example 2
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.
Behaviour class WakerBehaviour class TickerBehaviour 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.
Implementation OneShotBehaviour CyclicBehaviour Agent execute only once. CyclicBehaviour Agent execute by polling. import jade.core.behaviours.OneShotBehaviour import jade.core.behaviours.CyclicBehaviour
SimpleBehaviour class SimpleBehaviour 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.
CompositeBehaviour class CompositeBehaviour class SequentialBehaviour This class is a CompositeBehaviour that executes its sub-behaviours sequentially and terminates when all sub-behaviours are done. 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. class FSMBehaviour This class is a CompositeBehaviour that executes its children according to a Finite State Machine defined by the user.
Outline Behaviour Agent Communication Example Sniffer Agent Example 2
Agent Communication
Agent Communication sender of the message list of receivers communicative intention (or “performative”) content content language ontology some fields
Agent Communication Receiving Messages
Outline Behaviour Agent Communication Example Sniffer Agent Example 2
Example Write two agent in JADE Platform: SenderAgent ReceiverAgent OneShotBehaviour Send string to ReceiverAgent by using ACLMessage. ReceiverAgent CyclicBehaviour Receive and print the string from SenderAgent.
Sender
Receiver
Exmaple
Outline Behaviour Agent Communication Example Sniffer Agent Example 2
Sniffer
Sniffer
Sniffer
Outline Behaviour Agent Communication Example Sniffer Agent Example 2
Example 2
Arguments
SenderAgent
SenderAgent
SenderAgent
HelloAgent
HelloAgent
MathAgent
MathAgent
Results SenderAgent HelloAgent MathAgent
Results
Sniffer Agent
Homework Game: Write two or three Agent (A,B+C or A,B,C) 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 board Store position of chess and judge who win. Agent C : AI
End