0% found this document useful (0 votes)
74 views11 pages

JADE (Week 1)

The document provides an overview of agent-oriented programming (AOP) and the JADE framework. AOP uses autonomous software agents as its main concept, where agents can determine when to perform behaviors and interact without external control. The JADE framework allows for the creation of agent-based applications by providing a runtime environment (container) for agents. The main JADE container manages agent registration and provides special agents for naming (AMS) and service discovery (DF).

Uploaded by

reb20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views11 pages

JADE (Week 1)

The document provides an overview of agent-oriented programming (AOP) and the JADE framework. AOP uses autonomous software agents as its main concept, where agents can determine when to perform behaviors and interact without external control. The JADE framework allows for the creation of agent-based applications by providing a runtime environment (container) for agents. The main JADE container manages agent registration and provides special agents for naming (AMS) and service discovery (DF).

Uploaded by

reb20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

**** Week 1 ****

Agent-Oriented Programming (AOP) Paradigm


Agent-Oriented Programming (AOP) is a programming paradigm that is based on some theoretical
concepts in artificial intelligence. AOP paradigm is different from the known paradigms like
sequential, procedural, OOP, and more.
The main concept that AOP uses is the concept of agents. AOP creates applications that are a
collection of components called software agents.
AOP has some differences from the previously used programming paradigms like Object-Oriented
Programming (OOP).
In OOP, the application were based on some components called objects. Each object has its own
data and behavior and the object was completely controlled by the programmer. The
programmer decides when an object is created, what the object can do, when the object can do
a given behavior, when to interact with other objects and how, and so on.
Agents in AOP has a degree of autonomy. They can know the when to do a given behavior and
how and when to interact with other agents without external interaction.

Note:
Programming paradigm is a way or style of programming. Some languages are adopted to work
in some paradigms.
Some of the known programming paradigms are:
• Imperative.
• Declarative.
• Structured.
• Procedural.
• Object-Oriented.
• Event-Driven.
• Logic.
One language may support multiple programming paradigms and called multi-paradigm
languages.

What is agent?
An agent or specifically a software agent is a term has its roots in AI and means a software entity
that can do intelligent actions continuously and autonomously on behalf of the user in an
environment in which other agents exist.
The goal of creating an agent is to work on behalf of the user. So as much as the user can work
the agent should be. Because the user can make decisions and do intelligent actions, the agent
should also make decisions and do intelligent actions. The user can adapt with its environment
easily even after changing it, so also the agent should adapt with its environment.
[[EXPLAIN THE MEANING OF ENVIRONMENT BY EXAMPLE]]
There are other characteristics that should be found in the agent to be efficient to work on behalf
of the user.
Software agents should have a number of properties like:
• Mobile: Agents in general should be mobile and move from its location to other locations
in its environment. Software agents can exchange data with the other nodes in its
environment or network.
• Autonomous: Agents can independently do tasks.
• Rational: Agents should know how to think and know how to achieve their tasks in the
right way.
• Reactive: Agents monitors their environment and respond to changes that occur in the
environment.
• Proactive: Agents don`t act only in responding to their environment but can be initiative.
• Social: Agents can cooperate with humans and other agents in order to achieve tasks.
Agents should know about other agents in its environment and their capabilities and how
to negotiate with them.
• Self-learning: Agents can learn from the surrounded environment to improve themselves
and adapt to the environment.

Multi-Agent System (MAS)


A multi-agent system is a system that consists of a number of agents working on behalf of the
user that can interact and cooperate with each other to complete tasks as much as people do.

Agent Frameworks
A software agent can live within its environment and can`t live outside it. The environment that
hosts the agents is called an agent framework.
Examples of agent frameworks:
• JACK.
• Agent Factory.
• Agent Builder.
• JADE.
• IMPACT.
• ZEUS.

The framework used in the course for developing software agents is JADE.

JADE

JADE Brief History


JADE stands for Java Agent DEvelopment framework is a framework for developing multi-agent
systems. JADE is one of the most popular multi-agent frameworks if not being the most popular.
JADE is completely developed using Java.
• JADE development started in 1998 by Telecom Italia LAB (TILAB).
• The first open source JADE version was released in 2000.
• In May 2003 Telecom Italia Lab and Motorola Inc. made a collaboration agreement for
better industrial involvement for JADE.
JADE Documentation
• JADE Book: Bellifemine, Fabio Luigi, Giovanni Caire, and Dominic Greenwood. Developing
multi-agent systems with JADE. Vol. 7. John Wiley & Sons, 2007.
• JADE Website:
o http://jade.tilab.com/
o http://jade.tilab.com/doc/tutorials/JADEProgramming-Tutorial-for-
beginners.pdf

JADE Architecture
JADE is used to create a runtime environment where agents can live. The JADE runtime
environment is called a Container. JADE Container is called so because it can contain multiple
agents.
The JADE Container is a Java process that provides all services for hosting and executing agents
inside the JADE Container.
JADE >> Runtime Environment >> Container >> Java Process
The following figure represents the main architectural elements in JADE and the relationship
among them.

JADE can have multiple containers as shown in the figure. For sure each container will have its
agents. The set of all active containers is called a Platform.
But there is a special JADE Container called the Main Container. The platform can have only one
Main Container which is regarded the default JADE Container. The JADE Main Container is the first
container to be launched.

JADE Main Container Special Characteristics


The JADE Main Container has some special characteristics compared to other Containers:
• It is the first container to be launched.
• It is the entry point to creating JADE agents.
• Other JADE Containers must register themselves in the JADE Main Container.
• All JADE agents must register themselves in the JADE Main Container.
• JADE Main Container has two special agents called DF and AMS.
JADE Main Container Special Responsibilities
JADE Main Container has some special responsibilities:
• Managing the Container Table (CT): The CT is the registry of the other JADE Containers.
• Managing the Global Agent Descriptor Table (GADT): The GADT is the registry for all
agents in any JADE Container holding information about agent's status and location.
• Hosting the Agent Management System (AMS): The AMS is a special JADE agent that is
responsible for providing the following services:
o White Pages service (i.e. naming service): This service assigns each agent a
globally unique name called Agent Identifier (AID).
o Agent authorization service: This service provided by AMS assigns the agents the
authorizations they need to function like creating or killing other agents.
• Hosting the Directory Facilitator (DF): The DF is a special agent that is responsible for
providing the following services:
o Yellow Pages service: it allows agents to publish description about one or more
services they provide to allow other agents to discover the use these services.

JADE Main Container Drawbacks


• System Bottleneck.
• System Single Point of Failure.

JADE Main Container System Bottleneck


Note that the white and yellow pages services are mainly used to allow cooperation among agents
helping an agent to know which agents provide a specific service and the ID of such agents.
Because these services are located into the JADE Main Container, each time an agent needs to
call a service in another agent it must query the JADE Main Container for agents having that
service.
With a large number of agents asking for services in other agents there will be a massive number
of queries sent to the JADE Main Container causing a system bottleneck.

LADT
To overcome such problem, there will be a Local Agent Descriptor Table (LADT) in each container.
So when an agent wants to find a service, it searches for such service in its Container LADT. If the
service found it will use it and if not it will query the JADE Main Container for an agent outside its
local Container providing that service.
Explanatory example:
GADT Cache
To decrease the number of JADE Main Container queries for a specific service, the containers will
also have a local GADT.
After the agent queried the Main Container for a service, the Main Container will reply by the
agents providing such service in addition to information helping to access such agent.
If the agent wants to use that service another time, it needs to call the Main Container again for
information about agents providing such a service.
To avoid requesting information requested earlier, the containers other than the Main Container
will have a local GADT cache. This cache will contain information about the services used
previously. If the agent wants to use a previously used service, it will query the local GADT. If it
want to use a new service, it will query the Main Container GADT and caches the received
information. This helps in reducing the number of calls sent to the JADE Main Container.
Explanatory example:
Dynamic System
Because the JADE systems are dynamic, it is possible for an agent to be killed and that may cause
problems in cached information in GADT. Suppose that information about Agent3 Srvc1 was
cached in Caontainer1 GADT cache and Agent3 was killed, then there is wrong information stored
in the Container1 GADT cache. To overcome that problem, updates should be sent about cached
data.

JADE Main Container Single Point of Failure


There is another problem in the JADE Main Container. The Main Container is a single-point of
failure within the system. If the JADE Main Container failed the whole system will fail.

Multiple Main Containers


It is possible to start more than one JADE Main Container but each Main Container will represent
a different platform in which normal containers will live as shown in the JADE architecture
diagram.

Downloading JADE
JADE can be downloaded from its official site http://jade.tilab.com/download/jade.
JADE distribution contains five archive files:
1. jadeBin.zip: Pre-compiled JADE Java archive (JAR) files.
2. jadeDoc.zip: JADE offline documentation.
3. jadeExamples.zip: Java source code of various examples.
4. jadeSrc.zip: Java source code.
5. jadeAll.zip: Contains all the above four archive files.

Important JADE Files


• jade/doc/index.html: Inside the jadeDoc.zip. An HTML page regarded the entry point to
access the offline JADE documentation.
• jade/lib/jade.jar: Inside jade.Bin.zip. Pre-compiled JADE Java archive (JAR).

Preparing JADE Environment

CLASSPATH Environment Variable


For running a used-defined Java class, Java must know where that class is located. One way for
locating java classes is via the CLASSPATH system environment variable. The CLASSPATH variable
tells Java the paths in which the used-defined classes are located.
Setting the CLASSPATH Environment Variable
Because all JADE classes are located into the Java archive (JAR) file, we need to make the
CLASSPATH set to the JADE JAR file path.
The default value of the CLASSPATH is '.' meaning that it is set to the current directory.
Assuming that the JADE JAR file was located into that path 'C:\jade\lib\jade.jar'.
The CLASSPATH environment variable can be set by different ways:
• GUI
• CMD

GUI
1.From the desktop, right click the My Computer icon.
2.Choose Properties from the context menu.
3.Click the Advanced tab (Advanced system settings link in Vista).
4.Click Environment Variables. In the section System Variables, find the CLASSPATH
environment variable and select it. Click Edit. If the CLASSPATH environment variable does
not exist, click New
5. In the Edit System Variable (or New System Variable) window, specify the value of the
CLASSPATH environment variable. Click OK. Close all remaining windows by clicking OK.
https://docs.oracle.com/javase/tutorial/essential/environment/paths.html

CMD
Values of the environment variables can be changed in three scopes:
• Shell/Window.
• User.
• System/Machine/Global.

You can check if the CLASSPATH variable exists or not by dumping all environment variables using
the set command. This command prints all environment variables in addition to their values.
C:> set

Difference between CMD set and setx commands


set modifies the current shell (window) environment variables and any modifications over the
environment variables will be removed as soon as the window is closed.

setx modifies the value permanently and the change take effect for future shells not the shells
already running. You need to exit the close shell and reopen it again to see the changes.
setx by default changes the environment variables for the current user. To make setx changes the
environment variables values for the system, use the /M option.
For example:
setx /M PATH 'VALUE'

To print only the value of the CLASSPATH environment variable, use the echo command:
C:> echo %CLASSPATH%
If the output was %CLASSPATH% in Windows, then that environment variable doesn`t exist.

To set the CLASSPATH environment variable:


C:> set CLASSPATH 'C:\jade\lib\jade.jar'

But there is a problem in setting the CLASSPATH environment variable by changing the CLASSPATH
environment variable value.
Assuming that you need to run Class1 and it was located in PATH1, then you need to add that
path to the CLASSPATH environment variable.
To run another class Class1 located in PATH2, you also need to add that path to the CLASSPATH
environment variable.
Now, two classes of the same name Class1 are located in different paths PATH1 and PATH2 added
into the CLASSPATH environment variable. There might be confliction about which Class1 you
mean.
To solve that problem, you need to remove the PATH1 value from the CLASSPATH environment
variable to be able to use the new version of the Class1 into the PATH2.
For example:
C:> set CLASSPATH 'PATH2'
To run the Class1 in PATH1, you need to change the path again.
C:> set CLASSPATH 'PATH1'

So you will end running one class and breaking another class.

classpath Option
Another way to specifying the CLASSPATH variable value is using the java/javac -classpath (-cp)
option.
This option assigns a temp value of the CLASSPATH environment variable. After the running of the
class stops, that value is removed from the CLASSPATH environment variable.
Example, to run the previous Java class without changing the CLASSPATH environment variable
value, use this command:
C:> java -cp 'PATH2' Class1
This command runs Class1 in PATH2 and after run the CLASSPATH environment variable stays
unchanged.

Running JADE for the First Time


Assuming JADE JAR file was located in this path 'C:\jade\lib\jade.jar', to run the JADE Main
Container via the JADE GUI use this command:
C:> java -cp 'C:\jade\lib\jade.jar' jade.Boot -gui

Where jade in jade.Boot is the package name and Boot is the class name within that package.
The -gui option has the effect of running the JADE graphical user interface.
This GUI is provided by an agent called Remote Monitoring Agent (RMA). That agent allows the
administrator to manipulate and monitor the running platform.

JADE GUI Overview

JADE creates its own network that differs slightly from the normal networks discussed earlier.

Review about Computer Networks


In the computer networks course we knew that networks are used to exchange data between
devices. The network was consisting of end-user devices connected by intermediate devices.
It is important to understand the basic network concepts like IP, subnet mask, port number,
socket, OSI, and TCP.
For creating a connection from PC1 to PC2, PC1 must know the socket that it will use for that
connection. The socket consists of IP address and a port number.

Open System Interconnection (OSI) Reference Model


There was an OSI 7-layers reference model working as a framework responsible for modelling
how data is exchanged between network nodes.

Transport Layer
There was a layer responsible for creating connections which is the transport layer number 4 in
OSI. This layer has two common protocols called UDP and TCP. To create a connection, the TCP is
used.

JADE Network Overview

JADE Agent GUID


GUID = Global Unique IDentifier
Nodes in the JADE network are not a set of devices but rather a set of agents. So JADE networks
consist of agents with each agent having its own unique address for making connections.
The agent address has the following form:
<local-name>@<platform-name>
<agent-name>@<user-name>/<IP-address>:<port-number>
Where IP-address:port-number consists the socket.
The address can be create via either machine user name or machine IP address. For example:
test@ahmed:1099
[email protected]:1099

The following figure represents the main JADE GUI with the RMA address shown in the bar:
JADE Agents Connections
Connections between agents in JADE network can be:
1. Inter-platform: Connections between agents in the same platform.
2. Intra-platform: Connections between agents in different platforms.
Monitoring JADE Environment via the RMA GUI
There are different monitoring options provided by the RMA GUI to allow the administrator to
control the JADE platforms and agents. For example, the JADE RMA GUI provides the following
options to control agents:
• Create.
• Kill.
• Suspend.
• Resume.
• Clone.
• Sending messages.

Killing Agent
We can try killing the RMA agent using the RMA GUI monitoring options. Just highlight the RMA
agent and click the Kill icon or right-click the agent and click the Kill option in the options menu.
You will note that the GUI was terminated because the agent responsible for the GUI was killed.

JADE Booting Options


There are a number of options that can be added to the normal JADE booting command like
creating a container:
C:> java jade.Boot -container -host Dell
C:> java jade.Boot -container -host 192.168.1.10
This command creates a new container on the host specified by its name or IP address.
Some arguments can be passed to an agent:
C:> java jade.Boot foo:FooAgent(1,arg2,argument3)
This passes three arguments separated by commas to the FooAgent agent.
http://jade.tilab.com/documentation/tutorials-guides/how-to-configure-your-agent/

After learning how to launch JADE, next is to learn how to program JADE applications in Java.
What was done is just importing a Java library and next is to know about the following:
• Packages in that library.
• Classes in each package.
• Methods and attributes in each class.

You might also like