'intercepting' action results

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

'intercepting' action results

Alan Gordon White
Simple problem here... I want to be able to record and work with the  
results of every activity executed by an agent, before the associated  
intention is updated.

Basically I have a reactive replanning approach implemented - if an  
action has a false result, it attempts to find a replacement plan to  
achieve the intention goal and - if so - inserts that plan after the  
action in the IM, setting the action result itself to 'true' such that  
the intention will continue.  The semantics aren't too important -  
basically I need to slot in this code between execution and the  
contents of the resultant feedback action being read.

At the moment I've been using an extension of CentralizedAgArch  
(combined with a slightly modified 'run' class to instantiated it),  
which has the following code;

@Override
        public void reasoningCycleStarting() {
                if(getTS().getAg()==null) {
                        super.reasoningCycleStarting();
                        return;
                }
                if(logger == null) {
                        logger = Logger.getLogger( getTS().getUserAgArch().getAgName() +
                                                                                ":" + getClass().getSimpleName());
                }
                logger.setLevel(UniversalConstants.ARCH_LOGGER_LEVEL);
                if(getTS()!=null && getTS().getAg()!=null) {
                        logger.severe("Start RS:" + getTS().getC());
                        List<ActionExec> faSet = new ArrayList<ActionExec>();
                        faSet.addAll(getTS().getC().getFeedbackActions());


                        for(ActionExec ae: faSet) {
                                logger.severe(ae.getActionTerm() + "result obtained from FAs");
                                result(ae); //does some special handling here
                        }


                        faSet.clear();
                        faSet.addAll(getTS().getC().getFeedbackActionsWrapper());
                        for(ActionExec ae: faSet) {
                                if(!faSet.contains(ae)) {
                                        result(ae);
                                }
                        }
                }
                super.reasoningCycleStarting();
        }

This actually does work, insofar as the logger shows results being  
recorded and I can insert recovery plans... but not reliably all the  
time (if I execute, say, 10 agents acting activities in very close  
temporal proximity, I get maybe 6-9 results being recorded).  Checking  
my log output, there are points where the 'reasoningCycleStarting'  
call seemingly isn't made inbetween execution and the feedback action  
result being processed (?).

I don't really understand why.



--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|

Re: 'intercepting' action results

Rafael H Bordini-2
Hi Alan,

Yes, in principle it's possible that the action execution by the
environment is so quick that the feedback is processed before the
reasoning cycle is finished. As a matter of fact, originally things were
like this, the cycle was only over when the action was done. But in a
distributed setting, we can't afford to make the agent wait for a
feedback in a simulated environment being processed in a different node
of the network, so the PendingActions mechanism for suspending
intentions was created, so that agents can work on other intentions in
the meantime. Doesn't overriding the act() method works for you?

Cheers,

Rafael


On 09/01/2014 15:29, Alan Gordon White wrote:

> Simple problem here... I want to be able to record and work with the
> results of every activity executed by an agent, before the associated
> intention is updated.
>
> Basically I have a reactive replanning approach implemented - if an
> action has a false result, it attempts to find a replacement plan to
> achieve the intention goal and - if so - inserts that plan after the
> action in the IM, setting the action result itself to 'true' such that
> the intention will continue.  The semantics aren't too important -
> basically I need to slot in this code between execution and the
> contents of the resultant feedback action being read.
>
> At the moment I've been using an extension of CentralizedAgArch
> (combined with a slightly modified 'run' class to instantiated it),
> which has the following code;
>
> @Override
> public void reasoningCycleStarting() {
> if(getTS().getAg()==null) {
> super.reasoningCycleStarting();
> return;
> }
> if(logger == null) {
> logger = Logger.getLogger( getTS().getUserAgArch().getAgName() +
> ":" + getClass().getSimpleName());
> }
> logger.setLevel(UniversalConstants.ARCH_LOGGER_LEVEL);
> if(getTS()!=null && getTS().getAg()!=null) {
> logger.severe("Start RS:" + getTS().getC());
> List<ActionExec> faSet = new ArrayList<ActionExec>();
> faSet.addAll(getTS().getC().getFeedbackActions());
>
>
> for(ActionExec ae: faSet) {
> logger.severe(ae.getActionTerm() + "result obtained from FAs");
> result(ae); //does some special handling here
> }
>
>
> faSet.clear();
> faSet.addAll(getTS().getC().getFeedbackActionsWrapper());
> for(ActionExec ae: faSet) {
> if(!faSet.contains(ae)) {
> result(ae);
> }
> }
> }
> super.reasoningCycleStarting();
> }
>
> This actually does work, insofar as the logger shows results being
> recorded and I can insert recovery plans... but not reliably all the
> time (if I execute, say, 10 agents acting activities in very close
> temporal proximity, I get maybe 6-9 results being recorded).  Checking
> my log output, there are points where the 'reasoningCycleStarting'
> call seemingly isn't made inbetween execution and the feedback action
> result being processed (?).
>
> I don't really understand why.
>
>
>


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|

Re: 'intercepting' action results

Jomi Hubner
Hi Alan,

another cause could be the point where you are checking for feedback on actions' execution (FA), i.e., in the begin of the reasoning cycle. It is possible at that point that some FA are not "perceived" by your code:

at t1 the action in the plan starts its execution and its intention is suspended

at t2 the reasoning cycle starts and there is no feedback yet. Suppose that the agent is selecting an event....

at (the same t2), the action finished and the FA is added

at t3 the agent consumes the FA (it is done after selecting an event) and runs the cycle until its end

at t4 the reasoning cycle starts again and the above FA is not there anymore for your code.

since you have a custom arch, you better intercept FA by overriding the method actionExecuted of the CentralisedAgAch class.

HTH,

Jomi



On 09/01/2014, at 16:27, Rafael H Bordini <[hidden email]> wrote:

> Hi Alan,
>
> Yes, in principle it's possible that the action execution by the
> environment is so quick that the feedback is processed before the
> reasoning cycle is finished. As a matter of fact, originally things were
> like this, the cycle was only over when the action was done. But in a
> distributed setting, we can't afford to make the agent wait for a
> feedback in a simulated environment being processed in a different node
> of the network, so the PendingActions mechanism for suspending
> intentions was created, so that agents can work on other intentions in
> the meantime. Doesn't overriding the act() method works for you?
>
> Cheers,
>
> Rafael
>
>
> On 09/01/2014 15:29, Alan Gordon White wrote:
>> Simple problem here... I want to be able to record and work with the
>> results of every activity executed by an agent, before the associated
>> intention is updated.
>>
>> Basically I have a reactive replanning approach implemented - if an
>> action has a false result, it attempts to find a replacement plan to
>> achieve the intention goal and - if so - inserts that plan after the
>> action in the IM, setting the action result itself to 'true' such that
>> the intention will continue.  The semantics aren't too important -
>> basically I need to slot in this code between execution and the
>> contents of the resultant feedback action being read.
>>
>> At the moment I've been using an extension of CentralizedAgArch
>> (combined with a slightly modified 'run' class to instantiated it),
>> which has the following code;
>>
>> @Override
>> public void reasoningCycleStarting() {
>> if(getTS().getAg()==null) {
>> super.reasoningCycleStarting();
>> return;
>> }
>> if(logger == null) {
>> logger = Logger.getLogger( getTS().getUserAgArch().getAgName() +
>> ":" + getClass().getSimpleName());
>> }
>> logger.setLevel(UniversalConstants.ARCH_LOGGER_LEVEL);
>> if(getTS()!=null && getTS().getAg()!=null) {
>> logger.severe("Start RS:" + getTS().getC());
>> List<ActionExec> faSet = new ArrayList<ActionExec>();
>> faSet.addAll(getTS().getC().getFeedbackActions());
>>
>>
>> for(ActionExec ae: faSet) {
>> logger.severe(ae.getActionTerm() + "result obtained from FAs");
>> result(ae); //does some special handling here
>> }
>>
>>
>> faSet.clear();
>> faSet.addAll(getTS().getC().getFeedbackActionsWrapper());
>> for(ActionExec ae: faSet) {
>> if(!faSet.contains(ae)) {
>> result(ae);
>> }
>> }
>> }
>> super.reasoningCycleStarting();
>> }
>>
>> This actually does work, insofar as the logger shows results being
>> recorded and I can insert recovery plans... but not reliably all the
>> time (if I execute, say, 10 agents acting activities in very close
>> temporal proximity, I get maybe 6-9 results being recorded).  Checking
>> my log output, there are points where the 'reasoningCycleStarting'
>> call seemingly isn't made inbetween execution and the feedback action
>> result being processed (?).
>>
>> I don't really understand why.
>>
>>
>>
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Jason-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jason-users

--
Jomi Fred Hubner
Federal University of Santa Catarina
Department of Automation and Systems Engineering
PO Box 476, Florianópolis, SC
88040-900 Brazil
http://www.das.ufsc.br/~jomi


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users