/// <summary> /// Funkcja mutuje genotyp osobnika przez dodanie do wartości genu zmiennej losowej z rozkładu normanego Gaussa. /// </summary> public void Mutate(float mutationRate) { var gaussian = new GaussianGenerator(); var normal = gaussian.NextDouble(0, 1); for (int i = 0; i < Length; i++) { if (EvolutionStrategy.Random.NextDouble() < mutationRate) { this.Genes[i] = this.Genes[i] + normal; } } }
/// <summary> /// Funkcja mutuje genotyp osobnika przez dodanie do wartości genu zmiennej losowej z rozkładu normanego Gaussa. /// </summary> public void Mutate(float mutationRate) { var gaussian = new GaussianGenerator(); var normal = gaussian.NextDouble(0,1); for(int i=0; i < Length; i++) { if(EvolutionStrategy.Random.NextDouble() < mutationRate) this.Genes[i] = this.Genes[i] + normal; } }