【问题标题】:Protocol on Jade Agents with ACL带有 ACL 的 Jade 代理协议
【发布时间】:2020-04-11 21:45:14
【问题描述】:

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

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(Location fatal, int nonce) 的函数并自动执行该过程

我知道如何发送或接收消息,但我不知道如何同时进行 任何人都可以帮助我吗?

【问题讨论】:

    标签: java acl agents-jade


    【解决方案1】:

    我会使用 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;
    }
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-11
      • 2018-07-01
      • 2014-01-19
      • 2018-06-21
      • 1970-01-01
      • 2014-07-18
      • 2019-07-15
      相关资源
      最近更新 更多