Hard relative plan context

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

Hard relative plan context

Willem Timmers
Hi,

I was wondering if anyone knows a straightforward way of programming a hard plan context of relative beliefs?

Let me explain what i mean.
When the plan context ("when a plan should be considered applicable") should be valid during the whole course of actions of that plan (what I call a hard plan context), I use the following code:
+!g : 
       a_belief1 & a_belief2 
     <- 
       while(a_belief & a_belief2)
 some;
         course;
         of;
 action;
       }
       ?g.

This works fine for logical formulas without Variables in them (e.g. a_belief1 and a_belief2). Now, my question is, how to can i program a hard context with a logical formula with a comparison (what i mean with relative) of Variables that are highly dynamic . In the previous example:

+!g : 
       a_belief1(X) & a_belief2(Y) & X>Y
     <- 
       while(a_belief1(X) & a_belief2(Y) & X>Y ) { 
 some;
         course;
         of;
 action;
       }
       ?g.

In this way, these Variables X and Y get instantiated at the selection of this plan, while they probably change every second (so the logical expression is not valid anymore in real-time). Turning this context into a soft plan context.

Is there a straightforward way of programming a hard plan context of relative beliefs?

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|

Re: Hard relative plan context

Rafael H Bordini-2
Hi Willem,

Some languages (eg jadex) have other types of plan conditions (including what they called in-conditions). There is not explicit extra syntax for that in Jason but there are various ways in which you could do what you want. Just note that it isn't clear you want the body of the plan to actually repeat or you just wanted an invariant for the duration of one execution. I'll assume the latter first.

1) The normal way to approach this in Jason's extension of AgentSpeak is for you to think of the condition for the plan to remain in execution as in fact the condition for another plan to execute which will in turn drop the plan currently executing. For example, you have a plan

!g1: b1 & b2 <- a1 ... .

and you wanted that guard (b1 & b2) to be valid throughout the execution of the body, you could try a plan like

-b1 : ... <- .drop_goal(g1).
or
+~b1 ... if you're using open world and similarly for b2.
(note that in complex scenarios you might need to customise Jason to ensure priority for this kind of event)

2) Another way to do that kind of context would be to annotation the plan with that condition and use a specialised method for intention selection (the Jason book might give some hint on how to do it but would involve some advanced knowledge of Jason).

If you want to repeat a plan's body, rather than using imperative programming constructs, consider using a recursive plan. If it's a short plan and it makes sense for it to be atomic (but be very careful with a recursive atomic plan!), you also ensure the whole course of action takes place while the context is still valid:

@my_plan[atomic]
+!g1 : b1&b2 : a1; ... !g1.
+!g1.

Also, have a look at .wait which helps with some interesting tricks too.

HTH,

Rafael

On 17/09/2011 09:51, Willem Timmers wrote:
Hi,

I was wondering if anyone knows a straightforward way of programming a hard plan context of relative beliefs?

Let me explain what i mean.
When the plan context ("when a plan should be considered applicable") should be valid during the whole course of actions of that plan (what I call a hard plan context), I use the following code:
+!g : 
       a_belief1 & a_belief2 
     <- 
       while(a_belief & a_belief2)
 some;
         course;
         of;
 action;
       }
       ?g.

This works fine for logical formulas without Variables in them (e.g. a_belief1 and a_belief2). Now, my question is, how to can i program a hard context with a logical formula with a comparison (what i mean with relative) of Variables that are highly dynamic . In the previous example:

+!g : 
       a_belief1(X) & a_belief2(Y) & X>Y
     <- 
       while(a_belief1(X) & a_belief2(Y) & X>Y ) { 
 some;
         course;
         of;
 action;
       }
       ?g.

In this way, these Variables X and Y get instantiated at the selection of this plan, while they probably change every second (so the logical expression is not valid anymore in real-time). Turning this context into a soft plan context.

Is there a straightforward way of programming a hard plan context of relative beliefs?


------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2


_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users


------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users