Quantcast

Save an agent when running

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

Save an agent when running

Luna Ramirez, Wulfrano A

Hi,


I'm looking for the method to rewrite the code of one agent (at running time) once I have modified their plan library (i.e. adding or deleting plans or actions in those plans), is it possible?,

otherwise,

how can I save the complete state of an agent into a file (once it is modified).


Thank you for your help!


Arturo


------------------------------------------------------------------------------

_______________________________________________
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: Save an agent when running

Jomi Hubner
Dear Arturo,

to dynamically change the plan library, you can use internal actions like .add_plan (see http://jason.sourceforge.net/api/jason/stdlib/package-summary.html#package.description)

Note that plan parameter can be built from variables, example:

Action = { .print(a); .print(b) };
.add_plan( {+!g : c & b <- Action} );
+c;
+b;
!g;
.list_plans.

Unfortunately, there is no internal actions to store the plans (and beliefs) into a file. But is is quite easy to write them in Java. (if you want, I can write them and send to you.)

HTH,

Jomi




> On 4 de nov de 2015, at 12:31, Luna Ramirez, Wulfrano A <[hidden email]> wrote:
>
> Hi,
>
> I'm looking for the method to rewrite the code of one agent (at running time) once I have modified their plan library (i.e. adding or deleting plans or actions in those plans), is it possible?,
> otherwise,
> how can I save the complete state of an agent into a file (once it is modified).
>
> Thank you for your help!
>
> Arturo
> ------------------------------------------------------------------------------
> _______________________________________________
> 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


------------------------------------------------------------------------------
_______________________________________________
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: Save an agent when running

Jomi Hubner
Hi Luna,

I implemented a new internal action to store the agent into a file, you can use it as follows:

        ….
        .save_agent(“x.asl”);
        …

it will save the beliefs, rules and plans of the agent into the file x.asl. Optionally, you can include initial goals:

        ….
        .save_agent(“x.asl”, [say(hello)] ); // it includes !say(hello) in x.asl
        …

to use this new internal action, replace your jason.jar by the one available at
        https://www.dropbox.com/s/thgepw5xogr4gjn/jason.jar?dl=0

HTH,

Jomi

> On 5 de nov de 2015, at 15:25, Wulfrano Arturo Luna Ramírez <[hidden email]> wrote:
>
> Dear Professor Hubner,
>
> It would be very appreciated your help.
>
> I tried to do something like this:
>
> //Calling:
>
> saveAgent("nvoAg.asl",ag.getAgState().toString());
>
> public void saveAgent(String arch, String agente){
>         BufferedWriter output = null;
>             try {
>                 File file = new File(arch);
>                 output = new BufferedWriter(new FileWriter(file));
>              output.write(agente);
>                 output.close();
>             } catch ( IOException e ) {
>                 e.printStackTrace();
>             }
>     }
>
> But, it doesn't works.  So, if you can sent the code to me it would be wonderful.
>
>
> Thank you so much,
>
> Arturo Luna
>
>
> 2015-11-05 12:41 GMT+00:00 Jomi Hubner <[hidden email]>:
> Dear Arturo,
>
> to dynamically change the plan library, you can use internal actions like .add_plan (see http://jason.sourceforge.net/api/jason/stdlib/package-summary.html#package.description)
>
> Note that plan parameter can be built from variables, example:
>
> Action = { .print(a); .print(b) };
> .add_plan( {+!g : c & b <- Action} );
> +c;
> +b;
> !g;
> .list_plans.
>
> Unfortunately, there is no internal actions to store the plans (and beliefs) into a file. But is is quite easy to write them in Java. (if you want, I can write them and send to you.)
>
> HTH,
>
> Jomi
>
>
>
>
> > On 4 de nov de 2015, at 12:31, Luna Ramirez, Wulfrano A <[hidden email]> wrote:
> >
> > Hi,
> >
> > I'm looking for the method to rewrite the code of one agent (at running time) once I have modified their plan library (i.e. adding or deleting plans or actions in those plans), is it possible?,
> > otherwise,
> > how can I save the complete state of an agent into a file (once it is modified).
> >
> > Thank you for your help!
> >
> > Arturo
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > 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
>
>
>
>
> --
> M. en I.A. Wulfrano Arturo Luna Ramírez
>
> Universidad Autónoma Metropolitana
> Unidad Cuajimalpa
> División de Ciencias de la Comunicación y Diseño
> Departamento de Tecnologías de la Información
> Tel. +52 (55) 5814 6557
>  http://hermes.cua.uam.mx
>   ________
> | \__°__ / |   [hidden email]
> |_______ |   [hidden email]
>

--
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


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