Quantcast

Weird result using DefaultBeliefBase contains() - is this a bug?

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

Weird result using DefaultBeliefBase contains() - is this a bug?

Alan Gordon White
I'm confused about this; the contains(Literal) method for defaultBB is  
returning a null result, even when the actual literal is definitely  
present in the BB.  I've seen this with both contains() and assessing  
a LogicalFormula instance containing the particular literal.

i.e. The code
logger.finer("~busy check1-" +  
bb.contains(ASSyntax.parseLiteral("~busy(\"bulldozer1\")")));
logger.finer("~busy check2-" +  
bb.getCandidateBeliefs(ASSyntax.parseLiteral("~busy(\"bulldozer1\")"),  
null).hasNext());

gives the result;
[bulldozer1:moveAndClear(AGENT,RID,START,END)] ~busy check1-null
[bulldozer1:moveAndClear(AGENT,RID,START,END)] ~busy check2-true

(~busy("bulldozer1")[source(percept)] is definitely in the belief  
base.  I've only seen this error with this specific literal, too -  
I've tested other negative and positive preconditions and they resolve  
to the correct answer.  But when I test for the specific '~busy'  
literal, whether in java code or as a plan context in the ASL, it  
never gets the correct result.

Help?

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



------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
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: Weird result using DefaultBeliefBase contains() - is this a bug?

Jomi Hubner
Hi Alan,

it is very strange indeed. I tried to reproduce this error and didn't succeed.

For instance, the following simple code in Jason works fine for me:

        !start.
        +!start  <- +~busy("a"); !g.

        +!g : ~busy(X) <- .print(X).
        +!g <- .print(error).


Which version of Jason are you using? Do you have a custom agent architecture or belief base?

Jomi


On 25/04/2013, at 14:27, Alan Gordon White wrote:

> I'm confused about this; the contains(Literal) method for defaultBB is  
> returning a null result, even when the actual literal is definitely  
> present in the BB.  I've seen this with both contains() and assessing  
> a LogicalFormula instance containing the particular literal.
>
> i.e. The code
> logger.finer("~busy check1-" +  
> bb.contains(ASSyntax.parseLiteral("~busy(\"bulldozer1\")")));
> logger.finer("~busy check2-" +  
> bb.getCandidateBeliefs(ASSyntax.parseLiteral("~busy(\"bulldozer1\")"),  
> null).hasNext());
>
> gives the result;
> [bulldozer1:moveAndClear(AGENT,RID,START,END)] ~busy check1-null
> [bulldozer1:moveAndClear(AGENT,RID,START,END)] ~busy check2-true
>
> (~busy("bulldozer1")[source(percept)] is definitely in the belief  
> base.  I've only seen this error with this specific literal, too -  
> I've tested other negative and positive preconditions and they resolve  
> to the correct answer.  But when I test for the specific '~busy'  
> literal, whether in java code or as a plan context in the ASL, it  
> never gets the correct result.
>
> Help?
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
> _______________________________________________
> 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


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
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: Weird result using DefaultBeliefBase contains() - is this a bug?

Alan Gordon White
Hi Jomi

I'm using 1.3.9.  There are actually a lot of custom arch, agent and  
bb classes in play, but nothing that actually affects the contains  
method (the bb changes just take the added literals and, depending on  
type, add certain java object instances as a sort of easy-access cache).

Iterating through the bb being checked also shows ~busy(...) is  
present.  And other negative conditions seem fine.

I also did another couple of checks with a ~busy context condition.  
If the ~busy percept is generated by the environment (as I have by  
default), then the context condition fails.  If I add the ~busy  
percept to the starting beliefs, the context condition passes and the  
plan is selected.

In both cases, I checked the BB using the Jason debug/agent inspector  
tool and the relevant ~busy literal was listed in the BB (with the  
source annotation as 'percept'; the initial behaviour of the agent is  
to perform a 'register' action to hook into the environment and take  
control of an entity therein, so a ~busy percept is generated there  
almost immediately as the agent starts).

I'll keep checking my own code for anything that looks odd, but I was  
wondering if there were some semantic differences between contains and  
getCandidateBeliefs I should be aware of.

Thanks,
Alan

Quoting Jomi Hubner <[hidden email]> on Thu, 25 Apr 2013 15:20:06 -0300:

> Hi Alan,
>
> it is very strange indeed. I tried to reproduce this error and  
> didn't succeed.
>
> For instance, the following simple code in Jason works fine for me:
>
> !start.
> +!start  <- +~busy("a"); !g.
>
> +!g : ~busy(X) <- .print(X).
> +!g <- .print(error).
>
>
> Which version of Jason are you using? Do you have a custom agent  
> architecture or belief base?
>
> Jomi
>
>
> On 25/04/2013, at 14:27, Alan Gordon White wrote:
>
>> I'm confused about this; the contains(Literal) method for defaultBB is
>> returning a null result, even when the actual literal is definitely
>> present in the BB.  I've seen this with both contains() and assessing
>> a LogicalFormula instance containing the particular literal.
>>
>> i.e. The code
>> logger.finer("~busy check1-" +
>> bb.contains(ASSyntax.parseLiteral("~busy(\"bulldozer1\")")));
>> logger.finer("~busy check2-" +
>> bb.getCandidateBeliefs(ASSyntax.parseLiteral("~busy(\"bulldozer1\")"),
>> null).hasNext());
>>
>> gives the result;
>> [bulldozer1:moveAndClear(AGENT,RID,START,END)] ~busy check1-null
>> [bulldozer1:moveAndClear(AGENT,RID,START,END)] ~busy check2-true
>>
>> (~busy("bulldozer1")[source(percept)] is definitely in the belief
>> base.  I've only seen this error with this specific literal, too -
>> I've tested other negative and positive preconditions and they resolve
>> to the correct answer.  But when I test for the specific '~busy'
>> literal, whether in java code or as a plan context in the ASL, it
>> never gets the correct result.
>>
>> Help?
>>
>> --
>> The University of Edinburgh is a charitable body, registered in
>> Scotland, with registration number SC005336.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Try New Relic Now & We'll Send You this Cool Shirt
>> New Relic is the only SaaS-based application performance monitoring service
>> that delivers powerful full stack analytics. Optimize and monitor your
>> browser, app, & servers with just a few lines of code. Try New Relic
>> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
>> _______________________________________________
>> 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.



------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Loading...