MaDKit forum

Welcome All !
Please, use explicit topic names when creating new threads. Thanks.

You are not logged in.

#1 2014-05-04 17:46:18

jo
Member
Registered: 2014-02-23
Posts: 10

An agent with a different behaviour

Hi,
I launched a program many times without changing any code. Sometimes a message sent by an agent reaches to the other agent, and sometimes it don't reaches it . What's the explication of such a behaviour?

thanks.

Offline

#2 2014-05-04 23:09:48

fmichel
Administrator
From: Montpellier
Registered: 2009-03-24
Posts: 172
Website

Re: An agent with a different behaviour

Hi,

How are the agents launched ?
Because they are autonomous, if you want to be sure that one agent is in place (having a particular group/role) is either :
- check, and wait if necessary, that it is really in place (getAgentsWithRole)
- launch the agent from the agent that will reach it (by default launch returns when the activate method of the launched agent is done)

Offline

#3 2014-05-07 19:16:40

jo
Member
Registered: 2014-02-23
Posts: 10

Re: An agent with a different behaviour

Hi,

Sorry, I don't unserstand your last sentence. How to launch the agent from the agent that will reach it?

Is the CPU time has any relation with the problem ?

The two agents run in parallel, but one is launched after the other.

I launched the agents many times without changing the code, I remark that each time, the order of information printed by "logger.info" or "System.println.out"  changes.

Thanks

Last edited by jo (2014-05-07 19:44:03)

Offline

#4 2014-05-08 11:28:01

fmichel
Administrator
From: Montpellier
Registered: 2009-03-24
Posts: 172
Website

Re: An agent with a different behaviour

Hi,

I meant :

lanchAgent(new MyAgent(), true);//returns when its activate ends, no timeout
sendMessage(c,g,r, new Message());//here I am sure that the agent has ended its activate method, and thus that it should be reachable because it took its position in it s activate.

Offline

#5 2014-05-08 11:43:50

jo
Member
Registered: 2014-02-23
Posts: 10

Re: An agent with a different behaviour

Thanks
The problem is solved, I had a mistake in the defintion of the agents'roles.

Last edited by jo (2014-05-09 16:12:30)

Offline

Board footer