gpt4 book ai didi

java - 带 ACL 的 Jade 代理协议(protocol)

转载 作者:行者123 更新时间:2023-12-01 17:28:52 24 4
gpt4 key购买 nike

我想在两个代理(在不同平台上)之间开发一个协议(protocol),例如 Agent1 和 Agent2 之间:

1.Agent1 send a message to Agent2 with a nonce
2.Agent2 receive the nonce, make a mathematic operation and then send to Agent1
3.Agent1 receive the message and sent Agent2 an ACK

所以我想创建一个名为 doProtocol(Locationstint, int nonce) 的函数并自动执行该过程

我知道如何发送或接收消息,但我找不到如何同时执行此操作有人可以帮助我吗?

最佳答案

我会使用 FIPA-RequestInteraction。

代理1,添加行为AchieveREInitiation。在PrepareRequest中指定您的函数

prepareRequest(ACLmessage request)
{
request = getNonceMsg();
return request;
}
handleInform(ACLmessage reply)
{
//acknowledge response if you want to.
}

代理2,添加行为AchieveREResponder。在prepareResponse中指定您的函数

prepareResponse(ACLmessage reply)
{
response = compileResponse(reply.getContent());
return response;
}

关于java - 带 ACL 的 Jade 代理协议(protocol),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61164106/

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