I need to run my agents multiple times. Each time all the agents should be
- created
- perform their behaviour and
- be removed from the platform.
My problem is with the last step.
How can I remove the agents from the platform or how can I shut the platform down to execute another one later?
I tried this code but I still can't shut down the RMA:
for( int i=0; i<10;i++)
{
System.out.println("******************************iteration************************"+i);
// Récupération du conteneur (Main Container) en cours d'execution de Jade
Runtime rt = Runtime.instance();
// Création du profil par défault
ProfileImpl p = new ProfileImpl(false);
AgentContainer container =rt.createAgentContainer(p);
AgentController Agent=null;
for (int j=0; j<Ag.length;j++)
{//loop to create all the existing agents in Ag (array).
try { System.out.println("creation de l'agent"+j);
Agent = container.createNewAgent(Ag[j], "jade.project."+Ag[j], null);
Agent.start();
} catch (StaleProxyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//shut down
System.out.println("******************************Fin iteration************************"+i);
}
How can I shut down the maincontainer each time ? thanks
You can probably try container.kill() to shut down the platform.