Quantcast

Recording failed intentions / IMeans within the Agent code?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Recording failed intentions / IMeans within the Agent code?

Alan Gordon White
So, I have an agent with the following plans;


@moveCargo[atomic]
+!moveCargo("truck1", C, CLOC, CDEST): registered & not busy & not  
claimCargo(C, ANY)
                                        <- .broadcast(tell, claimCargo(C, K));
                                                !moveTo(CLOC);
                                                load(CLOC, C);
                                                !moveTo(CDEST);
                                                unload(CDEST, C);
                                                .broadcast(untell, claimCargo(C, K)).

//goals  - for moves to specified junctions
@moveNotRequired[atomic]
+!moveTo(J): atJ(J) & not busy("truck1")
                                <- .print("Already at ", J).

@moveToNewLocation[atomic]
+!moveTo(J): not atJ(J) & not stuck("truck1", X, Y) & not busy("truck1")
                                <- vehicle.capabilities.PlanRoute(O, J);
                                        !doRoute(O,J).


(NB: planRoute is an internal action that runs an A* planner,  
generates a plan - e.g. move(A,B), move(B,C) - and then sets the  
trigger up so that 'doRoute' can call it immediately afterwards)

The resultant intention for moveCargo(...) works out to something like  
this (ignore the added annotations - i'm using those as part of  
setting UUIDs, in some other code I'm still to write)

move("J2","J1")[index(1)]; .print("Done Route plan for J2 to J1") /  
{O="J2", J="J1"}
     !doRoute(O,J)[index(1)] / {O="J2", J="J1"}
     !moveTo(CLOC)[index(1)]; load(CLOC,C)[index(2)];  
!moveTo(CDEST)[index(3)]; unload(CDEST,C)[index(4)];  
.broadcast(untell,claimCargo(C,K)) / {CLOC="J1", C="Cargo1", CDEST="J4"}

The problem I'm having is that, if the move action fails, I want to  
record a failure (within the body of the Agent class, i.e. in Java  
code) for both that action, doRoute, moveTo and moveCargo - i.e.  
recording failure for each plan being used (I can do this for  
success).  As far as I understand, the GoalListener method only picks  
up the failure for the action and it's trigger, i.e. move(..) and  
doRoute(..).

(NB: I'm trying to do this for both atomic and non-atomic intentions)

At the moment my best idea is check the FeedbackActions at the start  
of the reasoning cycle (which i'm already doing to check for  
ActionExec success/failure) and, if the action failed, take its  
intention and record a failure for the current IMs (but at the moment  
I'm not sure how to get the trigger for the root goal / trigger to the  
intention).

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



------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recording failed intentions / IMeans within the Agent code?

Rafael H Bordini-2
Hi Alan,

Sorry I didn't check all your code so not sure I understand what you
need, but doesn't

-!doRoute(X,Y) : .current_intention(I) <-  use variable I here somehow...

work?

cheers

Rafael


On 28/01/2013 09:42, Alan Gordon White wrote:

> So, I have an agent with the following plans;
>
>
> @moveCargo[atomic]
> +!moveCargo("truck1", C, CLOC, CDEST): registered & not busy & not
> claimCargo(C, ANY)
> <- .broadcast(tell, claimCargo(C, K));
> !moveTo(CLOC);
> load(CLOC, C);
> !moveTo(CDEST);
> unload(CDEST, C);
> .broadcast(untell, claimCargo(C, K)).
>
> //goals  - for moves to specified junctions
> @moveNotRequired[atomic]
> +!moveTo(J): atJ(J) & not busy("truck1")
> <- .print("Already at ", J).
>
> @moveToNewLocation[atomic]
> +!moveTo(J): not atJ(J) & not stuck("truck1", X, Y) & not busy("truck1")
> <- vehicle.capabilities.PlanRoute(O, J);
> !doRoute(O,J).
>
>
> (NB: planRoute is an internal action that runs an A* planner,
> generates a plan - e.g. move(A,B), move(B,C) - and then sets the
> trigger up so that 'doRoute' can call it immediately afterwards)
>
> The resultant intention for moveCargo(...) works out to something like
> this (ignore the added annotations - i'm using those as part of
> setting UUIDs, in some other code I'm still to write)
>
> move("J2","J1")[index(1)]; .print("Done Route plan for J2 to J1") /
> {O="J2", J="J1"}
>       !doRoute(O,J)[index(1)] / {O="J2", J="J1"}
>       !moveTo(CLOC)[index(1)]; load(CLOC,C)[index(2)];
> !moveTo(CDEST)[index(3)]; unload(CDEST,C)[index(4)];
> .broadcast(untell,claimCargo(C,K)) / {CLOC="J1", C="Cargo1", CDEST="J4"}
>
> The problem I'm having is that, if the move action fails, I want to
> record a failure (within the body of the Agent class, i.e. in Java
> code) for both that action, doRoute, moveTo and moveCargo - i.e.
> recording failure for each plan being used (I can do this for
> success).  As far as I understand, the GoalListener method only picks
> up the failure for the action and it's trigger, i.e. move(..) and
> doRoute(..).
>
> (NB: I'm trying to do this for both atomic and non-atomic intentions)
>
> At the moment my best idea is check the FeedbackActions at the start
> of the reasoning cycle (which i'm already doing to check for
> ActionExec success/failure) and, if the action failed, take its
> intention and record a failure for the current IMs (but at the moment
> I'm not sure how to get the trigger for the root goal / trigger to the
> intention).
>


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Loading...