Agents do not synchronize messages and perceptions

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

Agents do not synchronize messages and perceptions

somallef
Good Morning! I'm building a simulation Jason where several agents of the "User" request a channel for a two agents "Operator". However, the agents "Operator" are failing to capture the messages from the "User" agents then update their belief base. See the pictures attached and also my code below. Excuse me ignorance, I am newbie with Jason! Thank you in advance! ================================================================ // Agent usuario in project prj_MAS_TCC /* Initial beliefs and rules */ /* Initial goals */ !participate. !contataOperadora. /* Plans */ //+link(service, D)[source(A)] <- .send(A, tell, req(D, qtdCanais(V-1))). +!participate: true<- ?myArtifact (ID); focus(ID). //println("Artefato montado"). //.print(X). -!participate: true <- !participate. +?myArtifact(C) : true <- lookupArtifact("a0", C). -?myArtifact(Art) : true <- .wait(10); //println("Esperando por uma operadora."); !participate. +!contataOperadora : true <- .wait(100); .findall(X, addOperadora(X), L); .shuffle(L, R); .range(I, 1, .length(R)); .nth(I, R, O); .send(O, achieve, req); .println("Solicitando canal para ", O). //-!contataOperadora: true <- !contataOperadora. ========================================================== // Agent operadora in project prj_MAS_TCC /* Initial beliefs and rules */ bloqueiosDuros(0). bloqueiosSuaves(0). qtdRequisicoes(0). /* Initial goals */ //!teste. !start. /* Plans */ +!start : true <- .my_name(N); .broadcast(tell, addOperadora(N)); !teste. +!teste <- ?qtdCanais(V); .println("Eu possuo um total de ", V, " canais!"); ?myArtifact (ID); focus(ID). -!teste: true <- !teste. +?myArtifact(Ar) : true <- lookupArtifact("a0", Ar); start. -?myArtifact(Art) : true <- .wait(10); !teste. +!req <- ?qtdRequisicoes(Qr); ?qtdCanais(Qc); if(Qc > 0) { C = Qc - 1; R = Qr + 1; -+qtdRequisicoes(R); -+qtdCanais(C); } else { ?bloqueiosSuaves(Bs); -+bloqueiosSuaves(Bs+1); R = Qr + 1; -+qtdRequisicoes(R); }.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Agents do not synchronize messages and perceptions

Jomi Fred Hübner
Hi, I am not sure I’ve got the problem (and your code is difficult to read due to the way it was attached). However, I guess that some race condition may be happening.

For example, in a program like

        v(0).
        +b(X) <- ?v(A); -v(A); +v(A+X).

if several events +b(…) have being handled concurrently, the final value of v may be inconsistent. The atomic annotation avoids that:

        v(0).

        @lb[atomic]
        +b(X) <- ?v(A); -v(A); +v(A+X).


HTH,

Jomi


> On 23 de set de 2016, at 09:40, somallef <[hidden email]> wrote:
>
> Good Morning! I'm building a simulation Jason where several agents of the "User" request a channel for a two agents "Operator". However, the agents "Operator" are failing to capture the messages from the "User" agents then update their belief base. See the pictures attached and also my code below. Excuse me ignorance, I am newbie with Jason! Thank you in advance! ================================================================ // Agent usuario in project prj_MAS_TCC /* Initial beliefs and rules */ /* Initial goals */ !participate. !contataOperadora. /* Plans */ //+link(service, D)[source(A)] <- .send(A, tell, req(D, qtdCanais(V-1))). +!participate: true<- ?myArtifact (ID); focus(ID). //println("Artefato montado"). //.print(X). -!participate: true <- !participate. +?myArtifact(C) : true <- lookupArtifact("a0", C). -?myArtifact(Art) : true <- .wait(10); //println("Esperando por uma operadora."); !participate. +!contataOperadora : true <- .wait(100); .findall(X, addOperadora(X), L); .shuffle(L, R); .range(I, 1, .length(R)); .nth(I, R, O); .send(O, achieve, req); .println("Solicitando canal para ", O). //-!contataOperadora: true <- !contataOperadora. ========================================================== // Agent operadora in project prj_MAS_TCC /* Initial beliefs and rules */ bloqueiosDuros(0). bloqueiosSuaves(0). qtdRequisicoes(0). /* Initial goals */ //!teste. !start. /* Plans */ +!start : true <- .my_name(N); .broadcast(tell, addOperadora(N)); !teste. +!teste <- ?qtdCanais(V); .println("Eu possuo um total de ", V, " canais!"); ?myArtifact (ID); focus(ID). -!teste: true <- !teste. +?myArtifact(Ar) : true <- lookupArtifact("a0", Ar); start. -?myArtifact(Art) : true <- .wait(10); !teste.  +!req <- ?qtdRequisicoes(Qr); ?qtdCanais(Qc); if(Qc > 0) { C = Qc - 1; R = Qr + 1; -+qtdRequisicoes(R); -+qtdCanais(C); } else { ?bloqueiosSuaves(Bs); -+bloqueiosSuaves(Bs+1); R = Qr + 1; -+qtdRequisicoes(R); }.    
> View this message in context: Agents do not synchronize messages and perceptions
> Sent from the jason-users mailing list archive at Nabble.com.
> ------------------------------------------------------------------------------
> _______________________________________________
> Jason-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jason-users


------------------------------------------------------------------------------
_______________________________________________
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: Agents do not synchronize messages and perceptions

somallef
This post has NOT been accepted by the mailing list yet.
Jomi, boa noite!

Acho que posso agradecer em português, certo? rsrs

Muito obrigado, era exatamente o que eu precisava para corrigir o problema!

Abraços,



2016-09-23 10:58 GMT-03:00 Jomi Fred Hübner [via jason] <[hidden email]>:
Hi, I am not sure I’ve got the problem (and your code is difficult to read due to the way it was attached). However, I guess that some race condition may be happening.

For example, in a program like

        v(0).
        +b(X) <- ?v(A); -v(A); +v(A+X).

if several events +b(…) have being handled concurrently, the final value of v may be inconsistent. The atomic annotation avoids that:

        v(0).

        @lb[atomic]
        +b(X) <- ?v(A); -v(A); +v(A+X).


HTH,

Jomi


> On 23 de set de 2016, at 09:40, somallef <[hidden email]> wrote:
>
> Good Morning! I'm building a simulation Jason where several agents of the "User" request a channel for a two agents "Operator". However, the agents "Operator" are failing to capture the messages from the "User" agents then update their belief base. See the pictures attached and also my code below. Excuse me ignorance, I am newbie with Jason! Thank you in advance! ================================================================ // Agent usuario in project prj_MAS_TCC /* Initial beliefs and rules */ /* Initial goals */ !participate. !contataOperadora. /* Plans */ //+link(service, D)[source(A)] <- .send(A, tell, req(D, qtdCanais(V-1))). +!participate: true<- ?myArtifact (ID); focus(ID). //println("Artefato montado"). //.print(X). -!participate: true <- !participate. +?myArtifact(C) : true <- lookupArtifact("a0", C). -?myArtifact(Art) : true <- .wait(10); //println("Esperando por uma operadora."); !participate. +!contataOperadora : true <- .wait(100); .findall(X, addOperadora(X), L); .shuffle(L, R); .range(I, 1, .length(R)); .nth(I, R, O); .send(O, achieve, req); .println("Solicitando canal para ", O). //-!contataOperadora: true <- !contataOperadora. ========================================================== // Agent operadora in project prj_MAS_TCC /* Initial beliefs and rules */ bloqueiosDuros(0). bloqueiosSuaves(0). qtdRequisicoes(0). /* Initial goals */ //!teste. !start. /* Plans */ +!start : true <- .my_name(N); .broadcast(tell, addOperadora(N)); !teste. +!teste <- ?qtdCanais(V); .println("Eu possuo um total de ", V, " canais!"); ?myArtifact (ID); focus(ID). -!teste: true <- !teste. +?myArtifact(Ar) : true <- lookupArtifact("a0", Ar); start. -?myArtifact(Art) : true <- .wait(10); !teste.  +!req <- ?qtdRequisicoes(Qr); ?qtdCanais(Qc); if(Qc > 0) { C = Qc - 1; R = Qr + 1; -+qtdRequisicoes(R); -+qtdCanais(C); } else { ?bloqueiosSuaves(Bs); -+bloqueiosSuaves(Bs+1); R = Qr + 1; -+qtdRequisicoes(R); }.    
> View this message in context: Agents do not synchronize messages and perceptions
> Sent from the jason-users mailing list archive at Nabble.com.
> ------------------------------------------------------------------------------
> _______________________________________________
> Jason-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jason-users


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



If you reply to this email, your message will be added to the discussion below:
http://jason.2324890.n4.nabble.com/Agents-do-not-synchronize-messages-and-perceptions-tp827p828.html
To unsubscribe from Agents do not synchronize messages and perceptions, click here.
NAML



--
Allef
(11) 981-794-628
Loading...