FIT L4 TECH
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Starting JADE - Knowledge Sharing Session - by Shashi - on 16th Jan 2009

2 posters

Go down

Starting JADE - Knowledge Sharing Session - by Shashi - on 16th Jan 2009 Empty Starting JADE - Knowledge Sharing Session - by Shashi - on 16th Jan 2009

Post by ransara Fri Jan 16, 2009 7:51 pm

hi,

This is a description of the contents discussed in the above session. Special thanks to Shashi who spent his time and effort on sharing his knowledge with us. Tkz a lot bro... Smile
Any change to the description (which is mentioned below) is welcome.

source files are shared in l4box
url: http://10.8.54.112/knowledge-sharing/Presentations/Starting%20JADE%20by%20Shashi%20on%2016th%20Jan%202009.zip

//***************************************//
//**** Knowledge Sharing Session ******//
//**** Starting JADE ******//
//**** by Shashi ******//
//**** on 16th Jan 2009 ******//
//***************************************//


What is JADE???
we need an environment to run the agents we develop.
normally there are many agents in this environment (multi agent environment).
so, we need a platform to keepup the communication between the agents and to manage the agents.
JADE is a middle ware which provides you the management facilities for the agents you develop

refer the book: to know about how jade is built (JADE is built under the FIPA std.s) and to know about ACL

JADE Architecture:
There are few basic concepts related to JADE.
1. containers:
All the agents u create has to be inside some thing/ some place in other words when u make an agent, u need to put it in to a place, which is called a container. JADE provides you containers to deploy and to run your agents.

2. Environment management:
To manage the environment, u need a console. so jade provides you a default agent AMS (Agent Management System) to manage the agents. It manages all the services in the environment. The container wher the AMS is in is called the main container. DF also provide vital services to the main container. With environment management, we can create an agent in one container and move it to another or do the operations on it.

3. Managing Connections
we can connect to this environment (the environment where the AMS and the agent you developed lie on) remotely (from another computer another container) through an open port on the initial computer. The connections between the agents in different computers/containers are managed by the AMS.

For example, in container 1 machine 1, we have one agent there, ams is also ther, ie: this is the main agent
in anothe rcontainer in another machine, we create another agent and that agent connects to the prev agent i described. all this process and the connection notifications are managed ny the AMS

The envt can either a single environment or distributed environment.
For example, one main agent and many other agents are called in a single platform. Many agernts running on several computers are said to be in a distributed environment.

Back to Agents:

For any agent you create in the environment, jade gives an unique id for this agent and this id is used to identify the agents uniquely
In addition to this unique id, an agent has a transport address. This is to find out where this agent is.
coz there can be two agents with same name in two different containers

There are three main features in agents:
1. having a behavour
2. need to communicate with each other, they have a platform
3. need an interface.

So jade should facillitate all these three thasks; and yes its does.

communication:
we have a runtime provided by jade to facilitate agent management and communication between them.
For example a1 sends a msg to a2; runtime takes the messege and passeses the msg from a1 to a2's queue. a2 reads its queue periodically.
This is one example for how jade supports agent behaviour.

behavouir: jade has behaviours. cycle behavious, oneshot bahaviour, tickle behavious...
cyclic-like a while loop
one shot - need to do it once
tickle- like a ticker
+ you can define your own custom behavious by extending the behavious class

interface: upto u to develop an interface to your agent.


How jade works:

boot class acts as the main class
jade.boot
you can use -gui to get the gui
With the GUI, you can see all the agents in the container, manage the agents, move the agents form one container to another, etc...
When GUI is initially running, you can see two agents, who are the default agents AMS and DF <- yellow pages handling


Now Hands ON !!!

btw, for an agent to work, it need an ontology.
but we are not going to develop an ontology right now, instead we use the default ontology provided.

configuring the eclipse:
add a new project in eclipse.
configure build path -> add external jars. -> add the jars in jade.
load the four sample classes provided (4 classes are provided by Shashi for demonstration purposes).
these files are shared in the l4box. (url is given in the top of the post)

go to
project propoertis -> run section,
clear the jade.boot and clear the arguments.
set main class as Main

run the file by right clicking on the
this create two agents, mother sgent and child agent and send a messege between them, which is the main thing we need to do.
this programatically create main containers and programaticaly make the envitomnet up and running.

Explaining the code:
getting the jade runtime and the main container to run our agents
runtime.instance
jaderuntime.createMainContainer

initMother
get the runtime, creta a mian container and make it up
then we call create mother agent.
here we can give a namen to the agent we are creating
there is an agent containe in initMother, this is because we areate another container other than the main container.

now we are goin to pu the agents to the containers,
we create child agent and mother agent
mother agent (test mother) is in main containr
child agent is in the other container we created.
agent.start run the setup methd in the respective agent.

now communication between agents:
have to overide two mtds to override
1. setup
2. takedown

setup, like the constructor, to up the agent in the envt.
takedown, like the finally class, to do at the and when all workj is done and finishing the agent.

Lets start with the testMother class.

listen:
to get the receiving messeges.
here the cyclic behavious is used to listen continuously.
JADE environment consider each behavoiur as a thread and put in to a pool and it executes this in the required time.
since this executes in a thread, the normal execution is not there.
for ex, Two behaviours b1 and b2
b1 - listening and doing some work based on the msg received.
b2 - and lets suppose after b1, there is a sequential behavoiur called b2 after that
here b2 is not executed after b1, only when the b2 behavior is required it is executed.
independant from the general behaviour.

sendToChild
sending msg to mother to child
we have a class called ACLMessege for this purpose,
here we can specify some thing like 'by refering this ontology read my messege'

ACL Messege options :inform, request or refuse the messege.
setConventionId: whn two communicting, there are other agents also there in the environment, but the two agents need to keep this communication private. so we define a msg templete and we read only the messeges which are in the format that we want, ohter messeges received are ignored. If one agent is listening on the messeges in the testAgent, the messeges in the test agent template are sent to him.

addReceiver:
to which agent we are sending this messege.
then send the messege.

Now lets have just a touch on the TestChild class:
it has the listen method to listen to the meseges comming.
in action method, we define you are listening only to the messeges which are coming to you in ttestAgent template only.
this is the flow and the rest is upto you to get your hands experienced with development on Java Agent Development Environmnet

Now install eclipse and start with your own code for your own agent...
ransara
ransara

Posts : 1
Join date : 2008-12-03

Back to top Go down

Starting JADE - Knowledge Sharing Session - by Shashi - on 16th Jan 2009 Empty Re: Starting JADE - Knowledge Sharing Session - by Shashi - on 16th Jan 2009

Post by sathya Sat Jan 17, 2009 4:27 pm

thanx ransara!
this is really helpful!!! specially for absenties like me Very Happy

sathya

Posts : 1
Join date : 2008-12-02
Age : 39
Location : weliweriya, SL

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum