1

我想开发一个多代理系统,我想从不同的容器运行不同的代理。我为此使用 eclipse 和 Jade 框架,但我不知道如何为项目配置“运行配置”以完成此操作。到目前为止,我有这个:-gui -container main:Sender;a1:Receiver;a2:Pong 我想将代理 a1 和 a2 放在一个单独的容器中。请帮忙。

4

2 回答 2

0

当开始一个新的翡翠项目时,我通常会创建一个 Coordinator 代理,其中包含启动和销毁其他代理的方法。我认为这是一种很好的做法,因为如果需要,您可以将这些方法扩展到其他代理。

于 2014-12-15T16:34:12.967 回答
-1

我希望这会有所帮助。

  1. 首先运行代理翡翠图形用户界面(Ejade)(通过安装Ejade库)或者你可以在控制台上运行它:( C:\java jade.Boot -gui你必须修复系统变量路径"C:\..\jade.far"并创建一个变量名classpath = "C:\..\jdk7\"

  2. 运行允许您创建新容器以在其上部署您的代理的代码。

    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();
            } 
        }
    }
    
于 2015-11-24T19:58:55.947 回答