我的项目是创建代表总线的代理,以使用高斯seidel方法解决潮流系统。现在的困难是,由于不同的总线包含不同的信息,它们将需要相互发送信息才能执行计算。我的方法是定义变量来表示每个代理中的已知值,如电压,然后在必要时将它们传递给其他代理。然而,由于我对编程非常陌生,尤其是JADE,我很难让这些代理共享信息。我该如何实现它呢?非常感谢你提前这么做。
发布于 2017-06-22 00:31:02
据我所知,“黄页服务”会帮到你。您应该在安装过程中注册每个代理,并在需要时搜索它们。例如(摘自“用Jade开发多智能体系统”)。
注册:
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(); } ...
}和搜索:
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();
}发布于 2017-09-01 20:01:27
有关基本信息,请参阅将提供的链接。不过,这是一个基本的解决方案,不能很好地扩展。Passing ACL messages between jade remote platforms
要获得更干净的解决方案,请执行以下步骤:
我通常使用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);https://stackoverflow.com/questions/44657917
复制相似问题