Quantcast

incorrect communication of some kinds of plans by .send(... tellHow ...)

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

incorrect communication of some kinds of plans by .send(... tellHow ...)

Boris Smilga
Hello jason-developers. First of all, as a newcomer on this list, I'd
like to say my humble greetings to all of you.

What brings me forth from my read-only mode is an issue which I found
when trying to share, among several agents in a project, something
like a library of utility plans, which include destructuring
unification (=..), the use of variables to abstract top-level goal
patterns, and .puts actions. My Jason version is 1.3.10a.


① Re. .puts, consider the following program for an agent called
`teller', using the default environment and centralised
infrastructure:

    !start.

    @test
    +!test(X) <-
        Y = 20;
        .print(X, " ", Y);
        .puts("#{X} #{Y}");
    .

    +!start <-
        .create_agent(other, "empty_file.asl");
        .plan_label(PlanT, test);
        .send(other, tellHow, PlanT);
        !test(10);
        .send(other, achieve, test(10));
    .

In the agent `teller', the .print and .puts actions work in exactly
the same way, viz., by writing two numbers to the console. In the
agent `other', however, .puts instead writes the names of the
variables:

    [teller] 10 20
    [teller] 10 20
    [other] 10 20
    [other] X Y

Now is this intended behaviour?


② Destructuring unification combined with the use of variables to
denote top-level goal patterns also produces some surprising results
when communicated by means of tellHow:

    !start.

    @destructure_query
    +!destructure_query(Strt, Fn, Args, Ann) <-
        Strt =.. [Fn, Args, Ann];
        ?Strt;
    .

    @test
    +!test(Which) <-
        if ( Which == strt_to_list ) {
            Strt = foo(1, 2, 3)[bar];
            +Strt;
            !destructure_query(Strt, Fn, Args, Ann);
            .print(Strt, " =.. [", Fn, ", ", Args, ", ", Ann, "] exists");
        }
        if ( Which == list_to_strt ) {
            +baz(4, 5, 6)[quux];
            !destructure_query(StrtBis, baz, [4, 5, 6], [quux]);
            .print(StrtBis, " =.. [baz, [4, 5, 6], [quux]] exists");
        }
    .

    +!start <-
        .create_agent(other, "empty_file.asl");
        .plan_label(PlanD, destructure_query);
        .send(other, tellHow, PlanD);
        .plan_label(PlanT, test);
        .send(other, tellHow, PlanT);
        !test(strt_to_list);
        !test(list_to_strt);
        .send(other, achieve, test(strt_to_list));
        .send(other, achieve, test(list_to_strt));
    .

Agent `teller' performs the test flawlessly (as far as I understand)
both when going from structure to list, and when going from list to
structure. But when the plan destructure_query is communicated to
agent `other', some kind of parsing error is signalled by Jason
itself, and then `other' fails the test both ways:

    Should not setTerm(1) of body literal!
    [teller] foo(1,2,3)[bar] =.. [foo, [1,2,3], [bar]] exists
    [teller] baz(4,5,6)[quux] =.. [baz, [4, 5, 6], [quux]] exists
    [other] No failure event was generated for
+!destructure_query(foo(1,2,3)[bar],_39_31Fn,_40_32Args,_41_33Ann)[code(Strt),code_line(6),code_src("teller.asl"),error(body_var_without_value),error_msg("teller.asl:6:
Variable 'Strt' must be ground."),source(self)]
    [other] teller.asl:6: Variable 'Strt' must be ground.
    [other] No failure event was generated for
+!destructure_query(_42_34StrtBis,baz,[4,5,6],[quux])[code(Strt),code_line(6),code_src("teller.asl"),error(body_var_without_value),error_msg("teller.asl:6:
Variable 'Strt' must be ground."),source(self)]
    [other] teller.asl:6: Variable 'Strt' must be ground.

The `should not setTerm' error is at
src/jason/asSyntax/PlanBodyImpl.java:147, but I'm afraid I don't
really understand what goes on here.


Thanks in advance for your kind help in these matters.

Sincerely,
 — B. Smilga.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
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: incorrect communication of some kinds of plans by .send(... tellHow ...)

Jomi Hubner
Hi Boris,

thanks again for reporting the problem!

The first bug was fixed in the SVN repository and will be included in the next release. You can also try to simply replace your lib/jason.jar file by the one available at http://www.das.ufsc.br/~jomi/x/jason.jar.

The second bug was already fixed in jason 1.4.0.

Unfortunately, it will be quite difficult for us to fix the problems in the release 1.3.9. So I hope you can move to the latest release.

All the best,

Jomi


 
On 04/06/2014, at 14:16, Boris Smilga <[hidden email]> wrote:

> Hello jason-developers. First of all, as a newcomer on this list, I'd
> like to say my humble greetings to all of you.
>
> What brings me forth from my read-only mode is an issue which I found
> when trying to share, among several agents in a project, something
> like a library of utility plans, which include destructuring
> unification (=..), the use of variables to abstract top-level goal
> patterns, and .puts actions. My Jason version is 1.3.10a.
>
>
> ① Re. .puts, consider the following program for an agent called
> `teller', using the default environment and centralised
> infrastructure:
>
>    !start.
>
>    @test
>    +!test(X) <-
>        Y = 20;
>        .print(X, " ", Y);
>        .puts("#{X} #{Y}");
>    .
>
>    +!start <-
>        .create_agent(other, "empty_file.asl");
>        .plan_label(PlanT, test);
>        .send(other, tellHow, PlanT);
>        !test(10);
>        .send(other, achieve, test(10));
>    .
>
> In the agent `teller', the .print and .puts actions work in exactly
> the same way, viz., by writing two numbers to the console. In the
> agent `other', however, .puts instead writes the names of the
> variables:
>
>    [teller] 10 20
>    [teller] 10 20
>    [other] 10 20
>    [other] X Y
>
> Now is this intended behaviour?
>
>
> ② Destructuring unification combined with the use of variables to
> denote top-level goal patterns also produces some surprising results
> when communicated by means of tellHow:
>
>    !start.
>
>    @destructure_query
>    +!destructure_query(Strt, Fn, Args, Ann) <-
>        Strt =.. [Fn, Args, Ann];
>        ?Strt;
>    .
>
>    @test
>    +!test(Which) <-
>        if ( Which == strt_to_list ) {
>            Strt = foo(1, 2, 3)[bar];
>            +Strt;
>            !destructure_query(Strt, Fn, Args, Ann);
>            .print(Strt, " =.. [", Fn, ", ", Args, ", ", Ann, "] exists");
>        }
>        if ( Which == list_to_strt ) {
>            +baz(4, 5, 6)[quux];
>            !destructure_query(StrtBis, baz, [4, 5, 6], [quux]);
>            .print(StrtBis, " =.. [baz, [4, 5, 6], [quux]] exists");
>        }
>    .
>
>    +!start <-
>        .create_agent(other, "empty_file.asl");
>        .plan_label(PlanD, destructure_query);
>        .send(other, tellHow, PlanD);
>        .plan_label(PlanT, test);
>        .send(other, tellHow, PlanT);
>        !test(strt_to_list);
>        !test(list_to_strt);
>        .send(other, achieve, test(strt_to_list));
>        .send(other, achieve, test(list_to_strt));
>    .
>
> Agent `teller' performs the test flawlessly (as far as I understand)
> both when going from structure to list, and when going from list to
> structure. But when the plan destructure_query is communicated to
> agent `other', some kind of parsing error is signalled by Jason
> itself, and then `other' fails the test both ways:
>
>    Should not setTerm(1) of body literal!
>    [teller] foo(1,2,3)[bar] =.. [foo, [1,2,3], [bar]] exists
>    [teller] baz(4,5,6)[quux] =.. [baz, [4, 5, 6], [quux]] exists
>    [other] No failure event was generated for
> +!destructure_query(foo(1,2,3)[bar],_39_31Fn,_40_32Args,_41_33Ann)[code(Strt),code_line(6),code_src("teller.asl"),error(body_var_without_value),error_msg("teller.asl:6:
> Variable 'Strt' must be ground."),source(self)]
>    [other] teller.asl:6: Variable 'Strt' must be ground.
>    [other] No failure event was generated for
> +!destructure_query(_42_34StrtBis,baz,[4,5,6],[quux])[code(Strt),code_line(6),code_src("teller.asl"),error(body_var_without_value),error_msg("teller.asl:6:
> Variable 'Strt' must be ground."),source(self)]
>    [other] teller.asl:6: Variable 'Strt' must be ground.
>
> The `should not setTerm' error is at
> src/jason/asSyntax/PlanBodyImpl.java:147, but I'm afraid I don't
> really understand what goes on here.
>
>
> Thanks in advance for your kind help in these matters.
>
> Sincerely,
> — B. Smilga.
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> _______________________________________________
> 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


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Loading...