how to get a belief

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

how to get a belief

Giancarlo Rafael Córdova Oliden
Hello there,

I'm problems with this. I want to get a belief from the BB of and agent through a java class with this:


CustomAgArch.getTS().getAg().findBel(Literal, unifier)

is correct? 

the API documentation tell me this:

findBel

public Literal findBel(Literal bel,
                       Unifier un)
Find a literal in BB using unification to test. Returns the belief as it is in BB, e.g. findBel(a(_),...) may returns a(10)[source(ag)]. The unifier un is updated by the method.
I'm not so sure how I have to declare or invoque the unifier.


I need a little example for this or if this is the correct way to get a belief.


thanks
---
Est. Giancarlo Rafael Córdova Oliden
Escuela de Ingeniería de Sistemas y Computación
Universidad Católica Santo Toribio de Mogrovejo
Email: [hidden email]
Contactos Telf.: (74) -603475 Cel.: (51)979074927

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|

Re: how to get a belief

Giancarlo Rafael Córdova Oliden
Hey, don't worry I made it work finally with:

this.visualizador.getTS().getLogger().info(this.visualizador.getTS().getAg().getBB().contains(Literal.parseLiteral("config(1.5,85)")).toString());


correct me if there is a better way

thanks

---
Est. Giancarlo Rafael Córdova Oliden
Escuela de Ingeniería de Sistemas y Computación
Universidad Católica Santo Toribio de Mogrovejo
Email: [hidden email]
Contactos Telf.: (74) -603475 Cel.: (51)979074927


From: [hidden email]
To: [hidden email]
Subject: how to get a belief
Date: Sun, 23 Jun 2013 12:03:54 -0500

Hello there,

I'm problems with this. I want to get a belief from the BB of and agent through a java class with this:


CustomAgArch.getTS().getAg().findBel(Literal, unifier)

is correct? 

the API documentation tell me this:

findBel

public Literal findBel(Literal bel,
                       Unifier un)
Find a literal in BB using unification to test. Returns the belief as it is in BB, e.g. findBel(a(_),...) may returns a(10)[source(ag)]. The unifier un is updated by the method.
I'm not so sure how I have to declare or invoque the unifier.


I need a little example for this or if this is the correct way to get a belief.


thanks
---
Est. Giancarlo Rafael Córdova Oliden
Escuela de Ingeniería de Sistemas y Computación
Universidad Católica Santo Toribio de Mogrovejo
Email: [hidden email]
Contactos Telf.: (74) -603475 Cel.: (51)979074927

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|

Adding a belief trigger

Giancarlo Rafael Córdova Oliden
Hello, 

Sorry for the constant questions but I'm developing a irrigation system with agent and I learning Jason at the same time.


I was trying to add a belief and finally I get it work like this:

this.visualizador.getTS().getC().addAchvGoal(goal, null);

->visualizador is the agent arch
-> goal is my literal builded previously
 
like you can see, I added the belief through a Goal addition to the agent but later I was trying another way.

This time I tried this methods:

1). this.visualizador.getTS().getAg().brf(goal, null, null);
2). this.visualizador.getTS().getAg().addBel(goal);

and I wrote some code in my agent when the belief were added:

+update_config(Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, Reg8, Reg9, Reg10):true
<- 
-+config(Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, Reg8, Reg9, Reg10);
.send(agente_reglas, tell, reglas(Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, Reg8, Reg9, Reg10));
.print("Nuevas reglas enviadas al agente de reglas");
-update_config(Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, Reg8, Reg9, Reg10);
.


for my surprise, the belief was added directly to the belief base and the agent never executed the previous block of code.

So my question is, what happened?, the adding function didn't generate the trigger event?. In that case, there is some place where I can find an example? or can you provide me some example where I can see how to add the trigger event to the goal addition's process?. Maybe there is something like the AddAchvGoal method but in this case for beliefs's adding.

thanks for advance.

---
Est. Giancarlo Rafael Córdova Oliden
Escuela de Ingeniería de Sistemas y Computación
Universidad Católica Santo Toribio de Mogrovejo
Email: [hidden email]
Contactos Telf.: (74) -603475 Cel.: (51)979074927


From: [hidden email]
To: [hidden email]
Subject: RE: how to get a belief
Date: Sun, 23 Jun 2013 13:18:24 -0500

Hey, don't worry I made it work finally with:

this.visualizador.getTS().getLogger().info(this.visualizador.getTS().getAg().getBB().contains(Literal.parseLiteral("config(1.5,85)")).toString());


correct me if there is a better way

thanks

---
Est. Giancarlo Rafael Córdova Oliden
Escuela de Ingeniería de Sistemas y Computación
Universidad Católica Santo Toribio de Mogrovejo
Email: [hidden email]
Contactos Telf.: (74) -603475 Cel.: (51)979074927


From: [hidden email]
To: [hidden email]
Subject: how to get a belief
Date: Sun, 23 Jun 2013 12:03:54 -0500

Hello there,

I'm problems with this. I want to get a belief from the BB of and agent through a java class with this:


CustomAgArch.getTS().getAg().findBel(Literal, unifier)

is correct? 

the API documentation tell me this:

findBel

public Literal findBel(Literal bel,
                       Unifier un)
Find a literal in BB using unification to test. Returns the belief as it is in BB, e.g. findBel(a(_),...) may returns a(10)[source(ag)]. The unifier un is updated by the method.
I'm not so sure how I have to declare or invoque the unifier.


I need a little example for this or if this is the correct way to get a belief.


thanks
---
Est. Giancarlo Rafael Córdova Oliden
Escuela de Ingeniería de Sistemas y Computación
Universidad Católica Santo Toribio de Mogrovejo
Email: [hidden email]
Contactos Telf.: (74) -603475 Cel.: (51)979074927

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|

Re: how to get a belief

Jomi Hubner
In reply to this post by Giancarlo Rafael Córdova Oliden
<base href="x-msg://681/">Hi,

let me explain the findBel and unifier with an example:

Unifier u = new Unifier();
Literal l = ....findBel( ....parseLiteral("a(X)"), u);

if the belief base contains a(10), 

l = a(10)
u = { X->10 }

When using the method BB.contains (as in your next email), you cannot use variables in the query.

HTH,

Jomi


On 23/06/2013, at 14:03, Giancarlo Rafael Córdova Oliden wrote:

Hello there,

I'm problems with this. I want to get a belief from the BB of and agent through a java class with this:


CustomAgArch.getTS().getAg().findBel(Literal, unifier)

is correct? 

the API documentation tell me this:

findBel

public Literal findBel(Literal bel,
                       Unifier un)
Find a literal in BB using unification to test. Returns the belief as it is in BB, e.g. findBel(a(_),...) may returns a(10)[source(ag)]. The unifier un is updated by the method.
I'm not so sure how I have to declare or invoque the unifier.


I need a little example for this or if this is the correct way to get a belief.


thanks
---
Est. Giancarlo Rafael Córdova Oliden
Escuela de Ingeniería de Sistemas y Computación
Universidad Católica Santo Toribio de Mogrovejo
Email: [hidden email]
Contactos Telf.: (74) -603475 Cel.: (51)979074927
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
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


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|

Re: Adding a belief trigger

Jomi Hubner
In reply to this post by Giancarlo Rafael Córdova Oliden
<base href="x-msg://687/">
On 24/06/2013, at 00:30, Giancarlo Rafael Córdova Oliden wrote:

Hello, 

Sorry for the constant questions but I'm developing a irrigation system with agent and I learning Jason at the same time.


I was trying to add a belief and finally I get it work like this:

this.visualizador.getTS().getC().addAchvGoal(goal, null);

as you mentioned, this method is better for goals and not suitable for beliefs.


->visualizador is the agent arch
-> goal is my literal builded previously
 
like you can see, I added the belief through a Goal addition to the agent but later I was trying another way.

This time I tried this methods:

1). this.visualizador.getTS().getAg().brf(goal, null, null);

brf does not produce events.

2). this.visualizador.getTS().getAg().addBel(goal);

this is the right way to add beliefs (and produce events).


and I wrote some code in my agent when the belief were added:

+update_config(Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, Reg8, Reg9, Reg10):true
<- 
-+config(Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, Reg8, Reg9, Reg10);
.send(agente_reglas, tell, reglas(Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, Reg8, Reg9, Reg10));
.print("Nuevas reglas enviadas al agente de reglas");
-update_config(Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, Reg8, Reg9, Reg10);
.


for my surprise, the belief was added directly to the belief base and the agent never executed the previous block of code.

Notice that (add belief) events are produced only when the belief is new. Moreover a command like

-update_config(Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, Reg8, Reg9, Reg10);

is like

-update_config(Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, Reg8, Reg9, Reg10)[source(self)];

and thus only belief added from "self" are indeed removed.

so, does the belief you are adding have any source annotation? If so, this annotation should be used in the - operator.

HTH,

Jomi




So my question is, what happened?, the adding function didn't generate the trigger event?. In that case, there is some place where I can find an example? or can you provide me some example where I can see how to add the trigger event to the goal addition's process?. Maybe there is something like the AddAchvGoal method but in this case for beliefs's adding.

thanks for advance.

---
Est. Giancarlo Rafael Córdova Oliden
Escuela de Ingeniería de Sistemas y Computación
Universidad Católica Santo Toribio de Mogrovejo
Email: [hidden email]
Contactos Telf.: (74) -603475 Cel.: (51)979074927


From: [hidden email]
To: [hidden email]
Subject: RE: how to get a belief
Date: Sun, 23 Jun 2013 13:18:24 -0500

Hey, don't worry I made it work finally with:

this.visualizador.getTS().getLogger().info(this.visualizador.getTS().getAg().getBB().contains(Literal.parseLiteral("config(1.5,85)")).toString());


correct me if there is a better way

thanks

---
Est. Giancarlo Rafael Córdova Oliden
Escuela de Ingeniería de Sistemas y Computación
Universidad Católica Santo Toribio de Mogrovejo
Email: [hidden email]
Contactos Telf.: (74) -603475 Cel.: (51)979074927


From: [hidden email]
To: [hidden email]
Subject: how to get a belief
Date: Sun, 23 Jun 2013 12:03:54 -0500

Hello there,

I'm problems with this. I want to get a belief from the BB of and agent through a java class with this:


CustomAgArch.getTS().getAg().findBel(Literal, unifier)

is correct? 

the API documentation tell me this:

findBel

public Literal findBel(Literal bel,
                       Unifier un)
Find a literal in BB using unification to test. Returns the belief as it is in BB, e.g. findBel(a(_),...) may returns a(10)[source(ag)]. The unifier un is updated by the method.
I'm not so sure how I have to declare or invoque the unifier.


I need a little example for this or if this is the correct way to get a belief.


thanks
---
Est. Giancarlo Rafael Córdova Oliden
Escuela de Ingeniería de Sistemas y Computación
Universidad Católica Santo Toribio de Mogrovejo
Email: [hidden email]
Contactos Telf.: (74) -603475 Cel.: (51)979074927
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
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


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users