/// <summary> /// C'tor /// </summary> /// <param name="populationSize"> The amount of members that will be simulated </param> /// <param name="starter"> A member to create a start population from </param> /// <param name="survivalThreshold"> The amount of the population that will survive after each epoch (in percent). Must be less than 0.5! </param> public GeneticAlgorithm(int populationSize, ISpecies starter, float survivalThreshold) { this.PopulationSize = populationSize; this.SurvivingMembers = (int)Math.Round(populationSize * survivalThreshold); //Create the initial population which equals the member and n - 1 mutations of it members.AddFirst(starter); for (int i = 1; i < populationSize; i++) { members.AddFirst(starter.Mutate()); } }