Hello everyone,
I have a bit of code where I am attempting to create new agents to imitate immigration. What is occurring is that thousands of agents are being created and it's slowing my computer down significantly. I have attached a screenshot of what I'm referring too. Notice all the white....those are thousands of little agents. Way too many agents. I've tried several things but continue to create too many agents. I've gone so far as to add a limit, where if the number of shrimp agents is greater than 15, that nothing happens. From that little bit of code, I still get thousands of agents and the whole thing freezes. Anyone have any idea's why I'm creating so many?
t The code that I'm using is as follows:
global
{
init
{
create PS_shrimp number: 10;
}
species PS_shrimp parallel: true skills: [moving] control: fsm
init
{
location <- any_location_in (my_hydro);
PS_Size <- gauss(12,5);
}
reflex update
{
if (nb_s < 15)
{
do immigration();
}
}
action immigration
{
create PS_shrimp number: 1
{
location <- one_of(Gate_ cell_list);
PS_Size <- gauss(2.02, 0.2);
PSColor <- #lime;
gender <- rnd(1);
}
}
aspect a {
draw circle(30) color: PSColor at: {location.x, location.y, hyd_depth};
}
}