Ejemplo n.º 1
0
        protected override IAttemptResult TryVariant()
        {
            var mutated = (MicrobeSpecies)species.Clone();

            mutations.CreateMutatedSpecies((MicrobeSpecies)species, mutated);

            var config = new SimulationConfiguration(map, Constants.AUTOEVO_VARIANT_SIMULATION_STEPS);

            config.ExcludedSpecies.Add(species);
            config.ExtraSpecies.Add(mutated);

            PopulationSimulation.Simulate(config);

            var population = config.Results.GetGlobalPopulation(mutated);

            return(new AttemptResult(mutated, population));
        }
Ejemplo n.º 2
0
        private MicrobeSpecies TryBiodiversitySplit(Species splitFrom, bool inCurrentPatch)
        {
            var config = new SimulationConfiguration(configuration, map, Constants.AUTO_EVO_VARIANT_SIMULATION_STEPS);

            var split = (MicrobeSpecies)splitFrom.Clone();

            if (configuration.BiodiversitySplitIsMutated)
            {
                mutations.CreateMutatedSpecies((MicrobeSpecies)splitFrom, split);
            }

            // Set the starting population in the patch
            split.Population = configuration.NewBiodiversityIncreasingSpeciesPopulation;

            config.ExtraSpecies.Add(split);
            config.PatchesToRun.Add(patch);

            if (inCurrentPatch)
            {
                // TODO: should we apply the population reduction to splitFrom?
            }

            PopulationSimulation.Simulate(config);

            var population = config.Results.GetPopulationInPatch(split, patch);

            if (population < configuration.NewBiodiversityIncreasingSpeciesPopulation)
            {
                return(null);
            }

            // TODO: could compare the original species population here to determine if this change is beneficial to
            // it as well (in which case a non-force species split could be done)

            // Successfully found a species to create in order to increase biodiversity
            return(split);
        }
Ejemplo n.º 3
0
        protected override IAttemptResult TryVariant()
        {
            var migration = GetRandomMigration();

            // Move generation can randomly fail
            if (migration == null)
            {
                return(new AttemptResult(null, -1));
            }

            var config = new SimulationConfiguration(map, Constants.AUTOEVO_VARIANT_SIMULATION_STEPS);

            config.Migrations.Add(new Tuple <Species, SpeciesMigration>(species, migration));

            // TODO: this could be faster to just simulate the source and
            // destination patches (assuming in the future no global effects of
            // migrations are added, which would need a full patch map
            // simulation anyway)
            PopulationSimulation.Simulate(config);

            var population = config.Results.GetGlobalPopulation(species);

            return(new AttemptResult(migration, population));
        }