Beispiel #1
0
        public MinCog(int populationSize, int generations, double mutationRate,
                      double crossoverRate, string selectionProtocol, string selectionMechanism)
        {
            GeneticOperators = new BinaryOperators();
            PopulationSize = populationSize;
            Generations = generations;
            MutationRate = mutationRate;
            CrossoverRate = crossoverRate;

            switch (selectionMechanism.ToLower())
            {
                case "fitness-prop":
                    ParentSelector = new FitnessProportionate();
                    SelectionMechanism = selectionMechanism;
                    break;
                case "sigma":
                    ParentSelector = new SigmaScaling();
                    SelectionMechanism = selectionMechanism;
                    break;
                case "tournament":
                    ParentSelector = new Tournament();
                    SelectionMechanism = selectionMechanism;
                    break;
                case "rank":
                    ParentSelector = new Rank();
                    SelectionMechanism = selectionMechanism;
                    break;
            }

            var translator = new MinCogTranslator();

            FitnessEvaluator = new MinCogFitness();
            Population = new BinaryPopulation(PopulationSize, 272, selectionProtocol, FitnessEvaluator, translator, 0, 2);
            FitnessEvaluator.CalculatePopulationFitness(Population.CurrentPopulation);
        }
Beispiel #2
0
        public OneMax(int populationSize, int generations, List<int> goalVector,
                      double mutationRate, double crossoverRate, string selectionProtocol, string selectionMechanism)
        {
            FitnessEvaluator = new OneMaxFitness(goalVector);
            GeneticOperators = new BinaryOperators();
            PopulationSize = populationSize;
            Generations = generations;
            MutationRate = mutationRate;
            CrossoverRate = crossoverRate;

            switch (selectionMechanism.ToLower())
            {
                case "fitness-prop":
                    ParentSelector = new FitnessProportionate();
                    SelectionMechanism = selectionMechanism;
                    break;
                case "sigma":
                    ParentSelector = new SigmaScaling();
                    SelectionMechanism = selectionMechanism;
                    break;
                case "tournament":
                    ParentSelector = new Tournament();
                    SelectionMechanism = selectionMechanism;
                    break;
                case "rank":
                    ParentSelector = new Rank();
                    SelectionMechanism = selectionMechanism;
                    break;
            }
            Population = new BinaryPopulation(PopulationSize, goalVector.Count, selectionProtocol, FitnessEvaluator,
                                              new OneMaxTranslator(), 0, 2);
            FitnessEvaluator.CalculatePopulationFitness(Population.CurrentPopulation);
        }
Beispiel #3
0
        public SpikingNeuron(int populationSize, int generations, int dataSetNumber,
                             double mutationRate, double crossoverRate, string selectionProtocol,
                             string selectionMechanism, string sdm)
        {
            GeneticOperators = new BinaryOperators();
            PopulationSize = populationSize;
            Generations = generations;
            MutationRate = mutationRate;
            CrossoverRate = crossoverRate;

            K = 0;
            J = 0;
            PrevFitness = 0.0;

            switch (selectionMechanism.ToLower())
            {
                case "fitness-prop":
                    ParentSelector = new FitnessProportionate();
                    SelectionMechanism = selectionMechanism;
                    break;
                case "sigma":
                    ParentSelector = new SigmaScaling();
                    SelectionMechanism = selectionMechanism;
                    break;
                case "tournament":
                    ParentSelector = new Tournament();
                    SelectionMechanism = selectionMechanism;
                    break;
                case "rank":
                    ParentSelector = new Rank();
                    SelectionMechanism = selectionMechanism;
                    break;
            }
            GoalSpike = readDataSet(dataSetNumber);
            FitnessEvaluator = new IzhikevichFitness(sdm, GoalSpike);
            Population = new BinaryPopulation(PopulationSize, 35, selectionProtocol, FitnessEvaluator,
                                              new IzhikevichTranslator(), 0, 2);
            FitnessEvaluator.CalculatePopulationFitness(Population.CurrentPopulation);
        }
Beispiel #4
0
        public ColonelBlotto(int populationSize, int generations, int numberOfBattles,
                             double mutationRate, double crossoverRate, string selectionProtocol,
                             string selectionMechanism, double redeploymentFraction, double lossFraction)
        {
            FitnessEvaluator = new ColonelBlottoFitness();
            GeneticOperators = new BinaryOperators();
            PopulationSize = populationSize;
            Generations = generations;
            MutationRate = mutationRate;
            CrossoverRate = crossoverRate;
            NumberOfBattles = numberOfBattles;
            RedeploymentFraction = redeploymentFraction;
            LossFraction = lossFraction;
            AverageEntropy = 0.0;

            switch (selectionMechanism.ToLower())
            {
                case "fitness-prop":
                    ParentSelector = new FitnessProportionate();
                    SelectionMechanism = selectionMechanism;
                    break;
                case "sigma":
                    ParentSelector = new SigmaScaling();
                    SelectionMechanism = selectionMechanism;
                    break;
                case "tournament":
                    ParentSelector = new Tournament();
                    SelectionMechanism = selectionMechanism;
                    break;
                case "rank":
                    ParentSelector = new Rank();
                    SelectionMechanism = selectionMechanism;
                    break;
            }
            Population = new BinaryPopulation(PopulationSize, NumberOfBattles, selectionProtocol, FitnessEvaluator,
                                              new ColonelBlottoTranslator(), 0, 11);
        }