【问题标题】:Intelligent Agents using Jade framework使用 Jade 框架的智能代理
【发布时间】:2014-05-30 16:28:34
【问题描述】:
我想开发一个多代理系统,我想从不同的容器运行不同的代理。我为此使用 eclipse 和 Jade 框架,但我不知道如何为项目配置“运行配置”以完成此操作。到目前为止,我有这个:-gui -container main:Sender;a1:Receiver;a2:Pong 我想将代理 a1 和 a2 放在一个单独的容器中。请帮忙。
【问题讨论】:
标签:
artificial-intelligence
agents-jade
multi-agent
【解决方案1】:
当开始一个新的翡翠项目时,我通常会创建一个 Coordinator 代理,其中包含启动和销毁其他代理的方法。我认为这是一种很好的做法,因为如果需要,您可以将这些方法扩展到其他代理。
【解决方案2】:
我希望这会有所帮助。
首先运行代理jade图形用户界面(Ejade)(通过安装Ejade库)
或者您可以在控制台上运行它:
C:\java jade.Boot -gui(必须将系统变量路径固定为"C:\..\jade.far"并创建变量名classpath = "C:\..\jdk7\")
-
运行允许您创建新容器以在其上部署您的代理的代码。
import jade.core.ProfileImpl;
import jade.core.Runtime;
import jade.domain.ams;
import jade.wrapper.AgentContainer;
import jade.wrapper.AgentController;
public class ContainerDeploy {
public static void main(String[] args) {
try{
Runtime runtime=Runtime.instance();
ProfileImpl profileImpl = new ProfileImpl(false);
profileImpl.setParameter(ProfileImpl.MAIN_HOST, "localhost");
AgentContainer agentContainer=runtime.createAgentContainer(profileImpl);
AgentController agentcontroller1 = agentContainer.createNewAgent("Name of Agent", "com.package.AgentClass", new Object[]{});
agentController1.start();
}catch(Exception e) {
System.out.println("Runtime Error\t");
e.printStackTrace();
}
}
}