500 likes | 707 Views
Introduction of Java Agent Development Environment (JADE). Presented by Po-Cheng Huang. 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
E N D
Introduction of Java Agent Development Environment (JADE) Presented by Po-Cheng Huang
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
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
JADE platform • JADE is a middleware that facilitates the development ofMulti Agent Peer-to-Peer applications. • Full Java • Runs on all JVM from J2EE to J2ME MIDP1.0 • Downloadable from http://jade.tilab.com
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.
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
Message Transport System • Agent Communication Channel (ACC) • Agent to Agent • Agent Platform to Agent Platform
Remote Monitoring Agent • Provide the GUI to control agents’ lifecycle
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
Install JDK 1.5 -- step 1 Web Site downloads
Install JDK 1.5 -- step 2 Select Java SE
Install JDK 1.5 -- step 3 Download
Other Revisions of JDK Next Release Previous Release
JADE Package • JADE-doc • Document • JADE-src • Source Code • JADE-bin • Binary Code • JADE-example • Example Code
Install JADE Platform Library Batch file
Install JADE Platform • Write batch file • run_jade.bat • Include related library • Base64.jar • http.jar • iiop.jar • jade.jar • jadeTools.jar
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:\jade\lib\jadeTools.jar;./; • Execute Command • java -classpath %JADE% jade.Boot -gui Use Java to start jade platform Interface
Run JADE Platform • Run run_jade.bat
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:\jade\lib\jadeTools.jar;./; • Set Connection Command • java -classpath %JADE% jade.Boot -gui-container-host 140.116.xxx.xxx Add new containe Destination IP
Connect Remote JADE platform • Execute connect_remote_jade.bat • Connect Remote JADE platform
Example • Book Seller & Book Buyer Seller1 Buyer Seller2
Implement Agent with Eclipse (1) Main Function of JADE
Implement Agent with Eclipse (2) -gui Seller1 : BookSerllerAgent Class Name Agent Name
Implement Agent with Eclipse (3) -gui –container –host localhost Seller2 : BookSerllerAgent Class Name Agent Name
Agent Communication Language • sender of the message • list of receivers • communicative intention (or “performative”) • content • content language • ontology • some fields
Agent Communication Language • Receiving Messages
BookSellerAgent • BookSellerAgent extends Agent • import jade.core.Agent; • Initial process • Setup() • addBehaviour(new InitBeha()) • Agent Behaviour • import jade.core.behaviours.*; • InitBehaextends Behaviour class
BookSellerAgent Setup() • Service Registration • Service Name • Service Type Add Behaviour
BookSellerAgent Takedown() Service deregistration
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).
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.
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.
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).
class Behaviour (Cont.) • 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. 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.
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.
Reference • http://www.fipa.org/ • 高師大共同科--楊錦潭、高師大資教所--蕭淳豐,”開發智慧型代理人軟體工程平台初探”