Discussion:
[jade-develop] Tickerbehaviour as FSMbehaviour state
Merrick Bengis
2014-06-04 18:29:33 UTC
Permalink
Hi all,

I am creating a multi-agent system in which i want certain types of agents
to be able to perform different actions based on their state. One of the
actions i want an agent to perform needs to execute every X ms until a
certain result is reached that will cause it to transition to the next
state.

The FSMbehaviour has 4 states: A, B,C and D, with A needing to be the
Cyclic tickerbehaviour, and the others being oneshot behaviours.

Considering that Tickerbehaviours don't return a value onEnd, how would I
achieve this? Would it just be better to make A transition back to itself
unless the condition is met and just add a block() or sleep() in A?

Regards,
Merrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://avalon.cselt.it/pipermail/jade-develop/attachments/20140604/0352dd19/attachment.html>
Caire Giovanni
2014-06-05 20:08:55 UTC
Permalink
Hi,

There are different options. Below 2 of them:
1) When the result is reached call stop() on the TickerBehaviour object. This will make it terminate.
2) In state A use a ParallelBehaviour with termination policy WHEN_ANY and two child:
- The TickerBehaviour
- A SimpleBehaviour that terminates when the result is reached.

Bye,

Giovanni

Da: jade-develop-bounces at avalon.tilab.com [mailto:jade-develop-bounces at avalon.tilab.com] Per conto di Merrick Bengis
Inviato: mercoled? 4 giugno 2014 20:30
A: jade-develop at avalon.tilab.com
Oggetto: [jade-develop] Tickerbehaviour as FSMbehaviour state

Hi all,

I am creating a multi-agent system in which i want certain types of agents to be able to perform different actions based on their state. One of the actions i want an agent to perform needs to execute every X ms until a certain result is reached that will cause it to transition to the next state.

The FSMbehaviour has 4 states: A, B,C and D, with A needing to be the Cyclic tickerbehaviour, and the others being oneshot behaviours.

Considering that Tickerbehaviours don't return a value onEnd, how would I achieve this? Would it just be better to make A transition back to itself unless the condition is met and just add a block() or sleep() in A?

Regards,
Merrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://avalon.cselt.it/pipermail/jade-develop/attachments/20140605/d8ffb91a/attachment.html>
Merrick Bengis
2014-06-06 08:29:46 UTC
Permalink
Hi Giovanni,

Thank you for the response, i do have one question regarding the first
option you gave me however.

If i call the stop() method to terminate the tickerbehaviour, it has no
return type or value, so how would i use that to define a transition to the
next state? Would i have to create it as a default transition perhaps, or
is there something i'm overlooking?

Regards,
Merrick


On Thu, Jun 5, 2014 at 10:08 PM, Caire Giovanni <
Post by Caire Giovanni
Hi,
1) When the result is reached call stop() on the TickerBehaviour object.
This will make it terminate.
2) In state A use a ParallelBehaviour with termination policy WHEN_ANY
- The TickerBehaviour
- A SimpleBehaviour that terminates when the result is reached.
Bye,
Giovanni
jade-develop-bounces at avalon.tilab.com] *Per conto di *Merrick Bengis
*Inviato:* mercoled? 4 giugno 2014 20:30
*A:* jade-develop at avalon.tilab.com
*Oggetto:* [jade-develop] Tickerbehaviour as FSMbehaviour state
Hi all,
I am creating a multi-agent system in which i want certain types of agents
to be able to perform different actions based on their state. One of the
actions i want an agent to perform needs to execute every X ms until a
certain result is reached that will cause it to transition to the next
state.
The FSMbehaviour has 4 states: A, B,C and D, with A needing to be the
Cyclic tickerbehaviour, and the others being oneshot behaviours.
Considering that Tickerbehaviours don't return a value onEnd, how would I
achieve this? Would it just be better to make A transition back to itself
unless the condition is met and just add a block() or sleep() in A?
Regards,
Merrick
Questo messaggio e i suoi allegati sono indirizzati esclusivamente
alle persone indicate. La diffusione, copia o qualsiasi altra azione
derivante dalla conoscenza di queste informazioni sono rigorosamente
vietate. Qualora abbiate ricevuto questo documento per errore siete
cortesemente pregati di darne immediata comunicazione al mittente e di
provvedere alla sua distruzione, Grazie.
*This e-mail and any attachments** is **confidential and may contain
privileged information intended for the addressee(s) only. Dissemination,
copying, printing or use by anybody else is unauthorised. If you are not
the intended recipient, please delete this message and any attachments and
advise the sender by return e-mail, Thanks.*
*[image: rispetta l'ambiente]Rispetta l'ambiente. Non stampare questa mail
se non ? necessario.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://avalon.cselt.it/pipermail/jade-develop/attachments/20140606/a818b5a9/attachment-0001.html>
Caire Giovanni
2014-06-09 09:08:46 UTC
Permalink
Hi,

The return code of a behaviour is the value returned by the onEnd() method --> You should override the onEnd() method of your TickerBehaviour and return a suitable code.

Bye,

Giovanni

Da: Merrick Bengis [mailto:mbengis22 at gmail.com]
Inviato: venerd? 6 giugno 2014 10:30
A: Caire Giovanni
Cc: jade-develop at avalon.tilab.com
Oggetto: Re: [jade-develop] Tickerbehaviour as FSMbehaviour state

Hi Giovanni,

Thank you for the response, i do have one question regarding the first option you gave me however.

If i call the stop() method to terminate the tickerbehaviour, it has no return type or value, so how would i use that to define a transition to the next state? Would i have to create it as a default transition perhaps, or is there something i'm overlooking?

Regards,
Merrick

On Thu, Jun 5, 2014 at 10:08 PM, Caire Giovanni <giovanni.caire at telecomitalia.it<mailto:giovanni.caire at telecomitalia.it>> wrote:
Hi,

There are different options. Below 2 of them:
1) When the result is reached call stop() on the TickerBehaviour object. This will make it terminate.
2) In state A use a ParallelBehaviour with termination policy WHEN_ANY and two child:
- The TickerBehaviour
- A SimpleBehaviour that terminates when the result is reached.

Bye,

Giovanni

Da: jade-develop-bounces at avalon.tilab.com<mailto:jade-develop-bounces at avalon.tilab.com> [mailto:jade-develop-bounces at avalon.tilab.com<mailto:jade-develop-bounces at avalon.tilab.com>] Per conto di Merrick Bengis
Inviato: mercoled? 4 giugno 2014 20:30
A: jade-develop at avalon.tilab.com<mailto:jade-develop at avalon.tilab.com>
Oggetto: [jade-develop] Tickerbehaviour as FSMbehaviour state

Hi all,

I am creating a multi-agent system in which i want certain types of agents to be able to perform different actions based on their state. One of the actions i want an agent to perform needs to execute every X ms until a certain result is reached that will cause it to transition to the next state.

The FSMbehaviour has 4 states: A, B,C and D, with A needing to be the Cyclic tickerbehaviour, and the others being oneshot behaviours.

Considering that Tickerbehaviours don't return a value onEnd, how would I achieve this? Would it just be better to make A transition back to itself unless the condition is met and just add a block() or sleep() in A?

Regards,
Merrick
Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle persone indicate. La diffusione, copia o qualsiasi altra azione derivante dalla conoscenza di queste informazioni sono rigorosamente vietate. Qualora abbiate ricevuto questo documento per errore siete cortesemente pregati di darne immediata comunicazione al mittente e di provvedere alla sua distruzione, Grazie.

This e-mail and any attachments is confidential and may contain privileged information intended for the addressee(s) only. Dissemination, copying, printing or use by anybody else is unauthorised. If you are not the intended recipient, please delete this message and any attachments and advise the sender by return e-mail, Thanks.
Rispetta l'ambiente. Non stampare questa mail se non ? necessario.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://avalon.cselt.it/pipermail/jade-develop/attachments/20140609/47d6e7d6/attachment.html>
Merrick Bengis
2014-06-09 19:14:27 UTC
Permalink
Hi Giovanni,

thank you, i was unsure whether the onEnd would work the same for the
Tickerbehaviour as with the other behaviours.

I have now created my FSMBehaviour with a Parallelbehaviour as the first
state. The parallelbehaviour has 2 sub behaviours, namely: a
tickerbehaviour to do a comparison every X ms, and a simple behaviour that
i am using to keep track of the time lived for the agent (how many ms have
passed since it was created). The point of the simple behaviour is to check
for when an agent has "lived" for a certain amount of time without getting
a useful result out of the tickerbehaviours comparison. Once the agent has
been alive for too long the fsmbehaviour should transition to another state
which will spawn a replacement agent and then terminate the current one.

I am having problems in that it appears that the simplebehaviour only runs
the time lived check once even though it cannot possible have met the
done() methods requirements yet. Is there any reason why this is happening?
As far as i understand a simple behaviour can be used to perform a task
until a result specified in the done() method is reached and returns.

my simplebehaviour looks like this:

public class LivedChecker extends SimpleBehaviour{
public long startTime;
public long estimatedTime;
String AgentString;

public LivedChecker(DetectorAgent agent)
{
AgentString = agent.DetectorString;
startTime = System.nanoTime();
}

public LivedChecker(KillerAgent agent)
{
AgentString = agent.KillerString;
startTime = System.nanoTime();
}

@Override
public void action()
{
System.out.println("In Lived Checking!!! Agent: " + AgentString);
estimatedTime = System.nanoTime() - startTime;
}

@Override
public boolean done()
{
return estimatedTime >= 30000;
}
}

once the agent has been alive for 30 seconds i want it to return so that
the fsmbehaviour can transition state.

Regards,
Merrick


On Mon, Jun 9, 2014 at 11:08 AM, Caire Giovanni <
Post by Caire Giovanni
Hi,
The return code of a behaviour is the value returned by the onEnd() method
? You should override the onEnd() method of your TickerBehaviour and
return a suitable code.
Bye,
Giovanni
*Da:* Merrick Bengis [mailto:mbengis22 at gmail.com]
*Inviato:* venerd? 6 giugno 2014 10:30
*A:* Caire Giovanni
*Cc:* jade-develop at avalon.tilab.com
*Oggetto:* Re: [jade-develop] Tickerbehaviour as FSMbehaviour state
Hi Giovanni,
Thank you for the response, i do have one question regarding the first
option you gave me however.
If i call the stop() method to terminate the tickerbehaviour, it has no
return type or value, so how would i use that to define a transition to the
next state? Would i have to create it as a default transition perhaps, or
is there something i'm overlooking?
Regards,
Merrick
On Thu, Jun 5, 2014 at 10:08 PM, Caire Giovanni <
Hi,
1) When the result is reached call stop() on the TickerBehaviour object.
This will make it terminate.
2) In state A use a ParallelBehaviour with termination policy WHEN_ANY
- The TickerBehaviour
- A SimpleBehaviour that terminates when the result is reached.
Bye,
Giovanni
jade-develop-bounces at avalon.tilab.com] *Per conto di *Merrick Bengis
*Inviato:* mercoled? 4 giugno 2014 20:30
*A:* jade-develop at avalon.tilab.com
*Oggetto:* [jade-develop] Tickerbehaviour as FSMbehaviour state
Hi all,
I am creating a multi-agent system in which i want certain types of agents
to be able to perform different actions based on their state. One of the
actions i want an agent to perform needs to execute every X ms until a
certain result is reached that will cause it to transition to the next
state.
The FSMbehaviour has 4 states: A, B,C and D, with A needing to be the
Cyclic tickerbehaviour, and the others being oneshot behaviours.
Considering that Tickerbehaviours don't return a value onEnd, how would I
achieve this? Would it just be better to make A transition back to itself
unless the condition is met and just add a block() or sleep() in A?
Regards,
Merrick
Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle
persone indicate. La diffusione, copia o qualsiasi altra azione derivante
dalla conoscenza di queste informazioni sono rigorosamente vietate. Qualora
abbiate ricevuto questo documento per errore siete cortesemente pregati di
darne immediata comunicazione al mittente e di provvedere alla sua
distruzione, Grazie.
*This e-mail and any attachments is confidential and may contain
privileged information intended for the addressee(s) only. Dissemination,
copying, printing or use by anybody else is unauthorised. If you are not
the intended recipient, please delete this message and any attachments and
advise the sender by return e-mail, Thanks.*
*Rispetta l'ambiente. Non stampare questa mail se non ? necessario.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://avalon.cselt.it/pipermail/jade-develop/attachments/20140609/12589ed2/attachment.html>
Loading...