有没有办法在Jason中使用相同的源文件实例化多个代理?

问题描述 投票:3回答:1

我有3个代理(p1,p2和p3)共享相同的代码(participant.asl)。我想知道是否有可能使用某些命令实例化50个这样的代理,比如数组,像“p [1..50]参与者”?

MAS testMAS {

    infrastructure: Centralised

    agents:
        p1 participant;
        p2 participant; 
        p3 participant;

    aslSourcePath:
        "src/asl";
}
artificial-intelligence agent multi-agent
1个回答
3
投票

是的,您可以使用“#”指令来实例化相同类型的多个代理。在您的代码中,确切的对应关系是:

MAS testMAS {

    infrastructure: Centralised

    agents:
        p participant #3;

    aslSourcePath:
        "src/asl";
}

通过这种方式,将使用participant.asl代码创建代理p1,p2和p3。

© www.soinside.com 2019 - 2024. All rights reserved.