Doing something stupid here? (context condition problems)

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

Doing something stupid here? (context condition problems)

Alan Gordon White
I have the following in my agent asl - one plan to move to a  
destination, and one to avoid performing action if the agent is  
already in situ there;
@moveNotRequired[atomic]
+!moveTo(J): atJ(J)  <- .print("Already at ", J).
@moveToNewLocation[atomic]
+!moveTo(J): not atJ(J) & not stuck & not busy
                <- .print("Planning route to ", J);
                        vehicle.capabilities.PlanRoute(O, J);
                        !doRoute(O,J).

(NB: planRoute is an internal action that adds a new plan to the PL  
for a route from O to J - including setting the value of O - which is  
triggered by the doRoute)

The environment creates the atJ (at Junction) percept -
ASSyntax.createLiteral("atJ", ASSyntax.createString(id))

Whatever the value of id in the belief base, the 'moveNotRequired'  
plan is never selected for use, and moveToNewLocation always is.    
Also tried (for the first context) using (atJ(U) & U==J), and that  
didn't work either.  I've checked and atJ("J5") (or whatever) is in  
the agent BB at the appropriate time.

I get a similar problem with string comparisons; if I have something  
like J=="J6" (or J="J6" - I've been trying every possible combination  
I can thing of) it never holds, even when it should.

Finally, in what I think is a related issue, I've been adding  
generated plans into the plan library during runtime.  As a crude  
mechanism, I wanted to specify the specific arguments - i.e. triggered  
by +!doRoute("J6", "J7") rather than doRoute(O, J) - but this resulted  
in the plan never being selected when O="J6" and J="J7" (putting the  
same condition into the context also failed; this is an issue as I  
need to specify which exact destination the doRoute plan corresponds  
to, which I can't do using purely the belief base contents).

I am, frankly, baffled by this.  Did I miss something major here?

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



------------------------------------------------------------------------------
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_sfd2d_oct
_______________________________________________
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: Doing something stupid here? (context condition problems)

Jomi Hubner
Hi Alan,

that is strange indeed. I tried some tests with string unification and it works fine. For instance:

        at("J2").
        !start("J2").
        +!start(J) : at(J) <- .print("hello world.").

The only possibility I can image now is that you are creating the goal moveTo without a string as parameter.

Cheers,

Jomi


On 19/10/2012, at 10:38, Alan Gordon White wrote:

> I have the following in my agent asl - one plan to move to a  
> destination, and one to avoid performing action if the agent is  
> already in situ there;
> @moveNotRequired[atomic]
> +!moveTo(J): atJ(J)  <- .print("Already at ", J).
> @moveToNewLocation[atomic]
> +!moveTo(J): not atJ(J) & not stuck & not busy
> <- .print("Planning route to ", J);
> vehicle.capabilities.PlanRoute(O, J);
> !doRoute(O,J).
>
> (NB: planRoute is an internal action that adds a new plan to the PL  
> for a route from O to J - including setting the value of O - which is  
> triggered by the doRoute)
>
> The environment creates the atJ (at Junction) percept -
> ASSyntax.createLiteral("atJ", ASSyntax.createString(id))
>
> Whatever the value of id in the belief base, the 'moveNotRequired'  
> plan is never selected for use, and moveToNewLocation always is.    
> Also tried (for the first context) using (atJ(U) & U==J), and that  
> didn't work either.  I've checked and atJ("J5") (or whatever) is in  
> the agent BB at the appropriate time.
>
> I get a similar problem with string comparisons; if I have something  
> like J=="J6" (or J="J6" - I've been trying every possible combination  
> I can thing of) it never holds, even when it should.
>
> Finally, in what I think is a related issue, I've been adding  
> generated plans into the plan library during runtime.  As a crude  
> mechanism, I wanted to specify the specific arguments - i.e. triggered  
> by +!doRoute("J6", "J7") rather than doRoute(O, J) - but this resulted  
> in the plan never being selected when O="J6" and J="J7" (putting the  
> same condition into the context also failed; this is an issue as I  
> need to specify which exact destination the doRoute plan corresponds  
> to, which I can't do using purely the belief base contents).
>
> I am, frankly, baffled by this.  Did I miss something major here?
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>
>
> ------------------------------------------------------------------------------
> 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_sfd2d_oct
> _______________________________________________
> 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


------------------------------------------------------------------------------
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_sfd2d_oct
_______________________________________________
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: Doing something stupid here? (context condition problems)

Rafael H Bordini-2
Hi Alan,

Me too, the only thing I can imagine is if you call !move(j5) somewhere
and the belief is atJ("j5") then it won't work. j5=="j5" fails. also,
make sure you use == if explicit comparison is needed, not =
(unification). But atJ(J) is fine, no need for the atJ(U) & U==J. on the
other hand if you need to call the goal with a term for some reason and
then compare to a string in the belief base, you could use

moveTo(J) : atJ(X) & .string2term(X,J) <- ...
see stdlib at jason.sf.net/api

cheers


On 19/10/2012 10:55, Jomi Hubner wrote:

> Hi Alan,
>
> that is strange indeed. I tried some tests with string unification and it works fine. For instance:
>
> at("J2").
> !start("J2").
> +!start(J) : at(J) <- .print("hello world.").
>
> The only possibility I can image now is that you are creating the goal moveTo without a string as parameter.
>
> Cheers,
>
> Jomi
>
>
> On 19/10/2012, at 10:38, Alan Gordon White wrote:
>
>> I have the following in my agent asl - one plan to move to a
>> destination, and one to avoid performing action if the agent is
>> already in situ there;
>> @moveNotRequired[atomic]
>> +!moveTo(J): atJ(J)  <- .print("Already at ", J).
>> @moveToNewLocation[atomic]
>> +!moveTo(J): not atJ(J) & not stuck & not busy
>> <- .print("Planning route to ", J);
>> vehicle.capabilities.PlanRoute(O, J);
>> !doRoute(O,J).
>>
>> (NB: planRoute is an internal action that adds a new plan to the PL
>> for a route from O to J - including setting the value of O - which is
>> triggered by the doRoute)
>>
>> The environment creates the atJ (at Junction) percept -
>> ASSyntax.createLiteral("atJ", ASSyntax.createString(id))
>>
>> Whatever the value of id in the belief base, the 'moveNotRequired'
>> plan is never selected for use, and moveToNewLocation always is.
>> Also tried (for the first context) using (atJ(U) & U==J), and that
>> didn't work either.  I've checked and atJ("J5") (or whatever) is in
>> the agent BB at the appropriate time.
>>
>> I get a similar problem with string comparisons; if I have something
>> like J=="J6" (or J="J6" - I've been trying every possible combination
>> I can thing of) it never holds, even when it should.
>>
>> Finally, in what I think is a related issue, I've been adding
>> generated plans into the plan library during runtime.  As a crude
>> mechanism, I wanted to specify the specific arguments - i.e. triggered
>> by +!doRoute("J6", "J7") rather than doRoute(O, J) - but this resulted
>> in the plan never being selected when O="J6" and J="J7" (putting the
>> same condition into the context also failed; this is an issue as I
>> need to specify which exact destination the doRoute plan corresponds
>> to, which I can't do using purely the belief base contents).
>>
>> I am, frankly, baffled by this.  Did I miss something major here?
>>
>> --
>> The University of Edinburgh is a charitable body, registered in
>> Scotland, with registration number SC005336.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> 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_sfd2d_oct
>> _______________________________________________
>> Jason-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/jason-users


------------------------------------------------------------------------------
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_sfd2d_oct
_______________________________________________
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: Doing something stupid here? (context condition problems)

Alan Gordon White
In reply to this post by Jomi Hubner
Hi Jomi

I think it's something odder than that, but it's not down to Jason  
itself, but rather something I'M doing in a customized AgArch.  The  
thing is that I'm calling one particular method at different points in  
the code depending on whether the current intention is atomic or not;  
in the former case from reasoningCycleStarting.

If I change the plans to be non-atomic, then there's no problem atall  
(which is why I just cottoned onto it - I'd been previously testing  
stuff with non-atomic plans, which worked fine in that context but not  
for the true automated test cases I want).

So evidently something is happening in the timing sequence that's, er,  
breaking everything in a very strange manner.  Which also means it's  
my fault (erk :/ ).

Cheers,
Alan

Quoting Jomi Hubner <[hidden email]> on Fri, 19 Oct 2012 10:55:39 -0300:

> Hi Alan,
>
> that is strange indeed. I tried some tests with string unification  
> and it works fine. For instance:
>
> at("J2").
> !start("J2").
> +!start(J) : at(J) <- .print("hello world.").
>
> The only possibility I can image now is that you are creating the  
> goal moveTo without a string as parameter.
>
> Cheers,
>
> Jomi
>
>
> On 19/10/2012, at 10:38, Alan Gordon White wrote:
>
>> I have the following in my agent asl - one plan to move to a
>> destination, and one to avoid performing action if the agent is
>> already in situ there;
>> @moveNotRequired[atomic]
>> +!moveTo(J): atJ(J)  <- .print("Already at ", J).
>> @moveToNewLocation[atomic]
>> +!moveTo(J): not atJ(J) & not stuck & not busy
>> <- .print("Planning route to ", J);
>> vehicle.capabilities.PlanRoute(O, J);
>> !doRoute(O,J).
>>
>> (NB: planRoute is an internal action that adds a new plan to the PL
>> for a route from O to J - including setting the value of O - which is
>> triggered by the doRoute)
>>
>> The environment creates the atJ (at Junction) percept -
>> ASSyntax.createLiteral("atJ", ASSyntax.createString(id))
>>
>> Whatever the value of id in the belief base, the 'moveNotRequired'
>> plan is never selected for use, and moveToNewLocation always is.
>> Also tried (for the first context) using (atJ(U) & U==J), and that
>> didn't work either.  I've checked and atJ("J5") (or whatever) is in
>> the agent BB at the appropriate time.
>>
>> I get a similar problem with string comparisons; if I have something
>> like J=="J6" (or J="J6" - I've been trying every possible combination
>> I can thing of) it never holds, even when it should.
>>
>> Finally, in what I think is a related issue, I've been adding
>> generated plans into the plan library during runtime.  As a crude
>> mechanism, I wanted to specify the specific arguments - i.e. triggered
>> by +!doRoute("J6", "J7") rather than doRoute(O, J) - but this resulted
>> in the plan never being selected when O="J6" and J="J7" (putting the
>> same condition into the context also failed; this is an issue as I
>> need to specify which exact destination the doRoute plan corresponds
>> to, which I can't do using purely the belief base contents).
>>
>> I am, frankly, baffled by this.  Did I miss something major here?
>>
>> --
>> The University of Edinburgh is a charitable body, registered in
>> Scotland, with registration number SC005336.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> 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_sfd2d_oct
>> _______________________________________________
>> 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
>
>
>



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



------------------------------------------------------------------------------
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_sfd2d_oct
_______________________________________________
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: Doing something stupid here? (context condition problems)

Alan Gordon White
In reply to this post by Rafael H Bordini-2
Well, I'm still baffled.

The asl is;
@createSupplyGoal[atomic]
+cargoNeeded(J, I): registered & not busy  <-  
        vehicle.capabilities.FindNearestCargo(C, K);!moveCargo(C, K, J).

@moveCargo[atomic]
+!moveCargo(C, CLOC, CDEST): registered & not busy
<- !moveTo(CLOC);load(CLOC, C);!moveTo(CDEST);unload(CDEST, C).

//goals  - for moves
@moveNotRequired
+!moveTo(J): atJ(J)<- .print("Already at ", J).
@moveToNewLocation
+!moveTo(J): not atJ(J) & not stuck & not busy & atJ(U) & J\==U
                                <- .print("Planning route to ", J, "currently at ",  
U);vehicle.capabilities.PlanRoute(O, J); !doRoute(O,J).

(NB: the atJ(U) thing is in there purely for testing this)

And I get the following print output;
[truck1] Planning route to "J5" currently at J5
(unifier is {U="J5", J="J5"} for selected moveTo; moveCargo unifies to  
{CLOC="J5", C="Cargo1", CDEST="J1"})

...so the string value does appear to be set correctly - except,  
perhaps, I don't know why one 'J5' has quotations and the other not.

Quoting Rafael H Bordini <[hidden email]> on Fri, 19 Oct 2012  
11:07:01 -0300:

> Hi Alan,
>
> Me too, the only thing I can imagine is if you call !move(j5) somewhere
> and the belief is atJ("j5") then it won't work. j5=="j5" fails. also,
> make sure you use == if explicit comparison is needed, not =
> (unification). But atJ(J) is fine, no need for the atJ(U) & U==J. on the
> other hand if you need to call the goal with a term for some reason and
> then compare to a string in the belief base, you could use
>
> moveTo(J) : atJ(X) & .string2term(X,J) <- ...
> see stdlib at jason.sf.net/api
>
> cheers
>
>
> On 19/10/2012 10:55, Jomi Hubner wrote:
>> Hi Alan,
>>
>> that is strange indeed. I tried some tests with string unification  
>> and it works fine. For instance:
>>
>> at("J2").
>> !start("J2").
>> +!start(J) : at(J) <- .print("hello world.").
>>
>> The only possibility I can image now is that you are creating the  
>> goal moveTo without a string as parameter.
>>
>> Cheers,
>>
>> Jomi
>>
>>
>> On 19/10/2012, at 10:38, Alan Gordon White wrote:
>>
>>> I have the following in my agent asl - one plan to move to a
>>> destination, and one to avoid performing action if the agent is
>>> already in situ there;
>>> @moveNotRequired[atomic]
>>> +!moveTo(J): atJ(J)  <- .print("Already at ", J).
>>> @moveToNewLocation[atomic]
>>> +!moveTo(J): not atJ(J) & not stuck & not busy
>>> <- .print("Planning route to ", J);
>>> vehicle.capabilities.PlanRoute(O, J);
>>> !doRoute(O,J).
>>>
>>> (NB: planRoute is an internal action that adds a new plan to the PL
>>> for a route from O to J - including setting the value of O - which is
>>> triggered by the doRoute)
>>>
>>> The environment creates the atJ (at Junction) percept -
>>> ASSyntax.createLiteral("atJ", ASSyntax.createString(id))
>>>
>>> Whatever the value of id in the belief base, the 'moveNotRequired'
>>> plan is never selected for use, and moveToNewLocation always is.
>>> Also tried (for the first context) using (atJ(U) & U==J), and that
>>> didn't work either.  I've checked and atJ("J5") (or whatever) is in
>>> the agent BB at the appropriate time.
>>>
>>> I get a similar problem with string comparisons; if I have something
>>> like J=="J6" (or J="J6" - I've been trying every possible combination
>>> I can thing of) it never holds, even when it should.
>>>
>>> Finally, in what I think is a related issue, I've been adding
>>> generated plans into the plan library during runtime.  As a crude
>>> mechanism, I wanted to specify the specific arguments - i.e. triggered
>>> by +!doRoute("J6", "J7") rather than doRoute(O, J) - but this resulted
>>> in the plan never being selected when O="J6" and J="J7" (putting the
>>> same condition into the context also failed; this is an issue as I
>>> need to specify which exact destination the doRoute plan corresponds
>>> to, which I can't do using purely the belief base contents).
>>>
>>> I am, frankly, baffled by this.  Did I miss something major here?
>>>
>>> --
>>> The University of Edinburgh is a charitable body, registered in
>>> Scotland, with registration number SC005336.
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> 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_sfd2d_oct
>>> _______________________________________________
>>> Jason-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/jason-users
>
>
> ------------------------------------------------------------------------------
> 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_sfd2d_oct
> _______________________________________________
> Jason-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jason-users
>
>



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



------------------------------------------------------------------------------
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_sfd2d_oct
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Loading...