Beispiel #1
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(configuration, map, Constants.AUTO_EVO_VARIANT_SIMULATION_STEPS);

            config.SetPatchesToRunBySpeciesPresence(species);
            config.PatchesToRun.Add(migration.From);
            config.PatchesToRun.Add(migration.To);

            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));
        }
Beispiel #2
0
        protected override IAttemptResult TryCurrentVariant()
        {
            var config = new SimulationConfiguration(configuration, map, Constants.AUTO_EVO_VARIANT_SIMULATION_STEPS);

            config.SetPatchesToRunBySpeciesPresence(species);

            PopulationSimulation.Simulate(config);

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

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