I am kind of new with JADE platform in eclipse. I want to create multiple agents, I have put a for loop and incremented the counter to create the agents, It used to work well but when I added the ThiefAgent, it didn't work. It only creates one PoliceAgent and one ThiefAgent. The code works perfectly but it does not create many agents.
this is the main.java code:
public class Main {
public static void main(String[] args) {
/*********************************************************************/
Runtime rt=Runtime.instance();
ProfileImpl p=new ProfileImpl();
p.setParameter(Profile.MAIN_HOST, "localhost");
p.setParameter(Profile.GUI, "true");
ContainerController cc1=rt.createMainContainer(p);
/**************creation of 5 police agents*****************/
for(int i=1; i<6; i++)
{
AgentController ac1;
try {
ac1=cc1.createNewAgent("PoliceAgent"+i, "Agents.PoliceAgent", null);
ac1.start();
} catch (StaleProxyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**************creation of 3 thief agents*****************/
for(int j=1; j<4; j++)
{
AgentController ac2;
try {
ac2=cc1.createNewAgent("ThiefAgent"+j, "Agents.ThiefAgent", null);
ac2.start();
} catch (StaleProxyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
I tried to put one For loop for both agents but nothing changed. What's the mistake? Thanks in advance.