【发布时间】:2020-07-14 21:06:16
【问题描述】:
我的问题是,JADE 在使用合约网络协议时可以处理多少个代理? 我在同一个容器上有一个 ContractNetInitiator 代理和 130 个 ContractNetResponder。用于创建这些代理的代码如下:
ProfileImpl profileImpl2 = new ProfileImpl(false);
profileImpl2.setParameter(ProfileImpl.MAIN_HOST, "localhost");
AgentContainer agentContainer = runtime.createAgentContainer(profileImpl2);
AgentController v;
for (int i=0; i<130; i++){ //8 est le nombre d'agents véhicules
v=agentContainer.createNewAgent("vehicle"+i, "VehicleAgent", new Object[]{});
v.start(); }
与
try {
// Register the vehicle-transporting service in the yellow pages
dfd = new DFAgentDescription();
dfd.setName(getAID());
ServiceDescription sd = new ServiceDescription();
sd.setName("Transport Of Items");
sd.setType("Transport");
dfd.addServices(sd);
DFService.register(this, dfd);
} catch (FIPAException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ContractNetInitiator 只找到了 100 个代理。我用来搜索这些代理的代码如下:
try {
// search list of Vehicle agents
template = new DFAgentDescription();
sd = new ServiceDescription();
sd.setType("Transport");
template.addServices(sd);
DFAgentDescription[] result = DFService.search(this, template);
if (result.length > 0) {
vehicleAgentsD = new AID[result.length];
log.info("Agent Dispatcher Agent found this vehicle's Agents :");
for (int i = 0; i < result.length; ++i) {
vehicleAgentsD[i] = result[i].getName();
log.info("VA" + i + "===>" + vehicleAgentsD[i].getName());
}
} else {
System.out.println("Agent " + getLocalName() + " did not find any service");
}
} catch (FIPAException fe) {
fe.printStackTrace();
}
这个错误是与 JADE 的限制有关还是与我的电脑性能有关? 提前感谢您的回答。
【问题讨论】:
-
能否请您使用“{}”格式化您的代码,以便我们可以看到此文本中的哪些内容正是您的代码
-
不,您必须编辑您的问题,然后添加您的代码
-
@Verity 我编辑了我的问题
-
现在你必须正确格式化它;)你的问题没问题,我们可以回答你:D
标签: java agents-jade