public GeneticNeuron[] GetPopulation() { var populationCopy = new GeneticNeuron[_currentPopulation.Length]; _currentPopulation.CopyTo(populationCopy, 0); return(populationCopy); }
private void GeneratePopulation() { for (int i = 0; i < _currentPopulation.Length; i++) { Genotype genotype = EvolutionManager.CurrentPopulation[i]; var network = new NeuralNetwork(_neuronActivator, _neuralNetworkTopology); #if DEBUG if (_genotypeGenesAmount != genotype.Genes.Length) { throw new Exception("The given genotype's parameter count must match " + "the neural network topology's weight count."); } #endif _currentPopulation[i] = new GeneticNeuron(genotype, network); } }
public void UpdateGeneration() { BestGeneticNeuron = _currentPopulation.Max(neuron => neuron); EvolutionManager.UpdateGeneration(); GeneratePopulation(); }