Esempio n. 1
0
 public GeneticAlgorithm(IFittnessFunction <T> fittnessFunction, ISelection <T> selection, ICrossover <T> crossover,
                         IMutation <T> mutation, ITerminate <T> terminate)
 {
     Population       = new List <IChromosome <T> >();
     FittnessFunction = fittnessFunction;
     Selection        = selection;
     Crossover        = crossover;
     Mutation         = mutation;
     Terminate        = terminate;
 }
Esempio n. 2
0
        public NeuroGeneticAlgorithm(IFittnessFunction <Neuron> fittnessFunction, ISelection <Neuron> selection,
                                     ICrossover <Neuron> crossover, IMutation <Neuron> mutation,
                                     ITerminate <Neuron> terminate, NeuralNetwork networkForTeach)
            : base(fittnessFunction, selection, crossover, mutation, terminate)
        {
            NeuralNetwork = networkForTeach;
            Random        = new Random((int)DateTime.Now.Ticks);
            generateNeuroPopulation_();

            var options = new EnvironmentOptions
            {
                AgentsCount = Population.Count,
                FoodCount   = 5,
                FieldWidth  = 200,
                FieldHeight = 200
            };

            TestGameEnvironment = new GameEnvironment(options);
        }