Example #1
0
        private void CreateSystem(PeaSettings settings)
        {
            _starter = Sender;

            var parameterSet      = new ParameterSet(settings.ParameterSet);
            int archipelagosCount = parameterSet.GetInt(ParameterNames.ArchipelagosCount);
            int islandsCount      = parameterSet.GetInt(ParameterNames.IslandsCount);

            ResultsWaitForCount = archipelagosCount * islandsCount;

            Archipelagos = new List <IActorRef>(archipelagosCount);

            for (int a = 0; a < archipelagosCount; a++)
            {
                var archipelagoProps = ArchipelagoActor.CreateProps(settings);
                var actorRef         = Context.ActorOf(archipelagoProps);
                Archipelagos.Add(actorRef);
                ArchipelagosCount++;
            }

            var fitness = (IFitnessFactory)Activator.CreateInstance(settings.Fitness);

            FitnessComparer = fitness.GetFitnessComparer();

            AddCallbackEvents(settings.NewEntityMergedToBest);
        }
Example #2
0
 protected SelectionBase(IRandom random, IFitnessComparer fitnessComparer, IParameterSet parameterSet)
 {
     Random          = random;
     FitnessComparer = fitnessComparer;
     ParameterSet    = parameterSet;
 }
Example #3
0
 protected ReplacementBase(IRandom random, IFitnessComparer fitnessComparer, ParameterSet parameters)
 {
     Random          = random;
     FitnessComparer = fitnessComparer;
     Parameters      = parameters;
 }
Example #4
0
 public ReplaceParentsReinsertion(IRandom random, IFitnessComparer fitnessComparer, ParameterSet parameters)
     : base(random, fitnessComparer, parameters)
 {
 }
 public ReplaceWorstEntitiesOfPopulation(IRandom random, IFitnessComparer fitnessComparer, ParameterSet parameters) : base(random, fitnessComparer, parameters)
 {
 }
Example #6
0
 public TournamentSelection(IRandom random, IFitnessComparer fitnessComparer, IParameterSet parameterSet)
     : base(random, fitnessComparer, parameterSet)
 {
 }
 public ReplaceParentsOnlyWithBetter(IRandom random, IFitnessComparer fitnessComparer,
                                     ParameterSet parameters) : base(random, fitnessComparer, parameters)
 {
 }
Example #8
0
 public ReinsertAll(IRandom random, IFitnessComparer fitnessComparer, ParameterSet parameters) : base(random, fitnessComparer, parameters)
 {
 }
Example #9
0
        private static IProvider <IReplacement> CreateReinsertions(IAlgorithmFactory algorithm, PeaSettings settings, ParameterSet parameterSet, IRandom random, IFitnessComparer fitnessComparer)
        {
            var reinsertions = algorithm.GetReinsertions();

            //TODO: impement override by settings


            var reinsertionProvider = CreateProvider <IReplacement>(reinsertions.Count, random);

            foreach (var reinsertion in reinsertions)
            {
                var reinsertionInstance = (IReplacement)Activator.CreateInstance(reinsertion, random, fitnessComparer, parameterSet);
                reinsertionProvider.Add(reinsertionInstance, 1.0);
            }

            return(reinsertionProvider);
        }
Example #10
0
        public static IProvider <ISelection> CreateSelections(IAlgorithmFactory algorithm, PeaSettings settings, ParameterSet parameterSet, IRandom random, IFitnessComparer fitnessComparer)
        {
            var selections = algorithm.GetSelections();

            //TODO: impement override by settings

            var selectionProvider = CreateProvider <ISelection>(selections.Count, random);

            foreach (var selectionType in selections)
            {
                var selectionInstance = (ISelection)Activator.CreateInstance(selectionType, random, fitnessComparer, parameterSet);
                selectionProvider.Add(selectionInstance, 1.0);
            }

            return(selectionProvider);
        }
Example #11
0
        private static IMigrationStrategy CreateMigrationStrategy(IslandEngine engine, IRandom random, IFitnessComparer fitnessComparer, ParameterSet parameters, PeaSettings settings)
        {
            //TODO: MigrationFactory!
            var selection   = new TournamentSelection(random, fitnessComparer, parameters);
            var replacement = new ReplaceWorstEntitiesOfPopulation(random, fitnessComparer, parameters);
            var strategy    = new Migration.Implementation.MigrationStrategy(random, selection, replacement, engine.Parameters);

            strategy.Parameters.SetValue(Migration.ParameterNames.MigrationReceptionRate, 0.01);
            return(strategy);
        }
 public ReplaceWorstParentWithBestChildrenReinsertion(IRandom random, IFitnessComparer fitnessComparer,
                                                      ParameterSet parameters) : base(random, fitnessComparer, parameters)
 {
 }