如何扭转或构建对jason(agentspeak)的信念?

时间:2012-05-04 08:24:15

标签: prolog agent multi-agent

我想做以下事情:

我有一个最初的目标,一个论点作为一种信念,我想扭转它,以便信念的论证成为新的信念,论证成为信仰名称。

这样的事情:

//Agent asker in project Test.mas2j
!translate(barks(dog)). //I would like to have the belief: dog(barks)
+!translate(T)<-
    T =.. [A,[B],C];
    .print("functor: ",A);
    .print("argument: ",B);
    //.print("source: ",C);
    +B(A);//<- I want something like this, but it gives a syntax error.
    +B. //<-this works, but it doesn't give the argument to it

所以,我的问题是,通过这种方式来构建信念?

1 个答案:

答案 0 :(得分:2)

T一样构建术语:

...
X =.. [B,[A]]; // constructs the belief
+X; // adds the belief to the current belief base
...

从书Programming Multi-Agent Systems in AgentSpeak using Jason

  

Prolog中也有一个操作员   这里的工作方式略有不同(因为谓词注释不可用)   在Prolog中)是'=..',用于将文字解构为列表。所结果的   list的格式为[functor, list of arguments, list of annotations],例如:   p(b,c)[a1,a2] =.. [p, [b,c], [a1,a2]]