gpt4 book ai didi

prolog - 如何扭转或构建对杰森的信念(agentspeak)?

转载 作者:行者123 更新时间:2023-12-04 05:47:51 25 4
gpt4 key购买 nike

我想做以下事情:

我有一个初始目标,将论证作为信念,我想将其反转,使信念的论证成为新的信念,而论证成为信念名称。

像这样的东西:

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

所以,我的问题是,以这种方式构建信念是不是太自私了?

最佳答案

像对 T 一样构造术语:

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

来自本书 Programming Multi-Agent Systems in AgentSpeak using Jason :

One operator also available in Prolog that works slightly differently here (because of the predicate annotations not available in Prolog) is ‘=..’, which is used to deconstruct a literal into a list. The resulting list has the format [functor, list of arguments, list of annotations], for example: p(b,c)[a1,a2] =.. [p, [b,c], [a1,a2]].

关于prolog - 如何扭转或构建对杰森的信念(agentspeak)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10445273/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com