Ejemplo n.º 1
0
        public void initPopulation(AbstractEnvironmentType env)
        {
            //_popsize = popsize;
            int init_error_threshold = 5;
            int init_error_count     = 0;

            for (int i = 0; i < PhysaSetting._popsize; i++)
            {
                Amoeba  newAmo     = new Amoeba(_current_id);
                Point3d birthPlace = env.getRandomBirthPlace(util);
                if (!newAmo.initializeAmoeba(birthPlace.X, birthPlace.Y, birthPlace.Z, 4, env, util))
                {
                    init_error_count++;
                    if (init_error_count > init_error_threshold)
                    {
                        break;
                    }
                    continue;
                }
                if (initOrient.Length > 0)
                {
                    newAmo.orientation = initOrient;
                }
                population.Add(newAmo);
                _current_id++;
            }
            env._escape_p = PhysaSetting.escape_p;
        }