【问题标题】:AgentSpeak: Problems at sending plan (Jason)AgentSpeak:发送计划的问题 (Jason)
【发布时间】:2015-03-29 05:26:12
【问题描述】:

我正在尝试通过以下方式从 Agent1 向 Agent2 发送计划:

@c2[atomic] 
+giveRule[source(A)]: planGiven(B) <-
                -+planGiven(B+1);
                .send(A, tellHow, "@s1 +sum(num1(X, Y), num2(A, B))[source(S)] :logic(L) & attentiveness(T)<- if ((L + T) > 2){ -+res(num1(X, Y), num2(A, B), res(X*10 + A*10 + Y + B)); .send(S, tell, result(X*10 + A*10 + Y + B)); } else { -+res(num1(X, Y), num2(A, B), res(X + A + Y + B)); .send(S, tell, result(X + A + Y + B)); }.");
                -+stopGivingPlan.

然后,我试图通过从 Agent1 向 Agent2 发送消息来使这个计划生效:

@c3[atomic]
+giveProbs[source(A)]: probsGiven(B) & stud(A,X)<-
                -+probsGiven(B+1);
                .send(A, tell, sum(num1(3,3), num2(4,9))).

它不起作用。 为什么?

还有重要的补充: 如果我不发送计划,而只是将其复制到 Agent2 中,它就可以正常工作。所以语法没问题。

另外,我在 Eclipse 中使用了 jason 插件,如果这值得一提的话。

【问题讨论】:

  • 要么我方式落后于时代,要么那不是Java。那么......它是什么?
  • 抱歉,标签不足。是 AgentSpeak
  • 您可能想在问题中提及这一点。
  • @BitNinja: Apparently not!
  • 查看 Jason 库中的 Sniffer 示例,您可以在那里找到答案。类似于:p1 -&gt; te1(t) : c1(y) &lt;- .send(ag2,tellHow,"p2 -&gt; te2(t) : c2(t) &lt;- a2(t).").

标签: artificial-intelligence agent


【解决方案1】:

目前还不太清楚正在执行什么,最好能显示整个代码。我简化了这个案例,只是为了展示一个总体思路,如下所示:

Agent1 代码:

!start.

+!start: true <-
    .send(agent2, tellHow, "@s1 +!sum(num1(X, Y), num2(A, B))[source(S)] :true <-  -+res(num1(X, Y), num2(A, B), res(X + A + Y + B)); ?res(Z1,Z2,Z3); .print(Z1,\"+\",Z2,\"=\",Z3).");  
    .send(agent2, achieve, sum(num1(1,2), num2(3,4))).

Agent2 代码:

/* No previous code - agent1 will send a plan*/

响应应该是:

[agent2] num1(1,2)+num2(3,4)=res(10)

在这种情况下,agent2 无事可做,直到 agent1 发送计划。 Agent1 也在发送一个触发计划来实现总和。

【讨论】:

    猜你喜欢
    • 2018-09-28
    • 1970-01-01
    • 2012-05-13
    • 1970-01-01
    • 2018-11-11
    • 2015-09-15
    • 1970-01-01
    • 2010-12-28
    • 1970-01-01
    相关资源
    最近更新 更多