简体   繁体   English

玉器数据通讯

[英]jade agents data communication

My project is to create agents that represent buses to solve a power flow system using the gauss seidel method. 我的项目是创建代表公交车的代理程序,以使用高斯塞德尔方法来解决潮流系统。 The difficulty right now is that since different buses hold different information, they will need to send each other information in order to perform the calculation. 目前的困难在于,由于不同的总线拥有不同的信息,因此它们将需要相互发送信息才能执行计算。 My approach is to define variables to represent known values like voltage in each agent then deliver them across other agents when necessary. 我的方法是定义变量以表示已知值,例如每个代理中的电压,然后在必要时将其传递给其他代理。 However since I'm very new to programming in general especially JADE, I'm having trouble getting these agents to share information. 但是,由于我对编程特别是JADE刚起步,所以我很难让这些代理共享信息。 How do I implement that? 我该如何实施? Thank you so much in advance. 提前非常感谢您。

As far as I know, "yellow pages service" will help you. 据我所知,“黄页服务”将为您提供帮助。 You should register every agent during setup and search them when you need. 您应该在设置过程中注册每个代理,并在需要时搜索它们。 For example (from "developing multi-agent systems with Jade"). 例如(来自“使用Jade开发多代理系统”)。

registration: 注册:

protected void setup() {
... // Register the book-selling service in the yellow pages 
   DFAgentDescription dfd = new DFAgentDescription(); 
   dfd.setName(getAID()); 
   ServiceDescription sd = new ServiceDescription(); 
   sd.setType("Book-selling"); 
   sd.setName(getLocalName()+"-Book-selling"); 
   dfd.addServices(sd); 
   try { 
       DFService.register(this, dfd);
   } catch (FIPAException fe) { 
      fe.printStackTrace(); } ...
   }

and the search: 和搜索:

DFAgentDescription template = new DFAgentDescription(); 
ServiceDescription sd = new ServiceDescription(); 
sd.setType("Book-selling"); 
template.addServices(sd); 
try { 
    DFAgentDescription[] result = DFService.search(myAgent, template); 
} catch (FIPAException fe) { 
    fe.printStackTrace(); 
}

For basic messages please refer to the linke that will. 有关基本消息,请参阅链接。 This is a basic solution though and does not scale well. 但是,这是一个基本解决方案,无法很好地扩展。 Passing ACL messages between jade remote platforms 在玉器远程平台之间传递ACL消息

For a cleaner solution follow the following steps: 为获得更清洁的解决方案,请执行以下步骤:

  1. Register agents and services with the directory facilitator (DF). 向目录服务商(DF)注册代理和服务。 YOu can find reccommendations on how to do this in this thread and on others. 您可以在此线程和其他线程中找到有关如何执行此操作的建议。 (Message from agent supplying service -> DF) (来自代理提供服务的消息-> DF)
  2. Request service and agent from DF. 向DF请求服务和代理。 Again this can be found (Message from agent requesting service -> DF) (DF-> responds with service supplier info) 再次可以找到它(来自请求服务的代理的消息-> DF)(DF->回复服务提供商信息)
  3. Send a custom message to the agent supplying the service. 向提供服务的代理发送自定义消息。 In this message you will embed you info. 在此消息中,您将嵌入信息。

I typically use XML or string manipulation: 我通常使用XML或字符串操作:

AID r=new AID("agent-name@platform",AID.ISGUID);
r.addAddresses("http://192.168.1.1:7778/acc");
acl.addReceiver(r);
acl.setContent("time=10:30");
this.send(acl);
System.out.println("\nMessage Sent to "+r);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM