In Anylogic, If I have a 6000 agents in X population..How can I choose 2000 form this population to do a specific task ??
Thank you.
In Anylogic, If I have a 6000 agents in X population..How can I choose 2000 form this population to do a specific task ??
Thank you.
If it is ok that you always select the same 2000 agents then this would work:
int i=0;
ArrayList<Agent> subsetOfAgents = new ArrayList<Agent>(2000);
for(Agent a : population)
{
if(i >= 2000) break;
subsetOfAgents.add(a);
i++;
}
Your 2000 agents are then available in subsetOfAgents.