public Population(EvolveConfig config) { Config = config; Individuals = Enumerable.Range(0, config.PopulationConfig.PopulationSize) .Select(_ => IndividualFactory.Instance.CreateIndividual()).ToList(); }
public Maters(IEnumerable<IIndividual> individuals, EvolveConfig config) { _individuals = individuals; Config = config; SetFathersAndMothers(); }
public Individual(IEnumerable<double> values, EvolveConfig globalConfig, IndividualConfig individualConfig) { GlobalConfig = globalConfig; IndividualConfig = individualConfig; Current = values.ToList(); }
private static void PrintEndPopulationStats(Population finalPopulation, EvolveConfig config, IndividualConfig individualConfig) { Console.WriteLine("Final population fitness {0}", finalPopulation.Grade()); Console.WriteLine("Accepted values:"); finalPopulation.Individuals.Where(i => Math.Round((i as Individual).Sum, config.Precision) == Math.Round(individualConfig.Target, config.Precision)) .GroupBy(i => i.ToString()) .ForEach(i => Console.WriteLine("{0} indiviuals {1} sum to {2}", i.Count(), i.First(), (i.First() as Individual).Sum)); }
public Individual(EvolveConfig globalConfig, IndividualConfig individualConfig) { GlobalConfig = globalConfig; IndividualConfig = individualConfig; Current = Enumerable.Range(0, IndividualConfig.IndividualSize) .Select(_ => GetValue()).ToList(); }
public Population(IEnumerable<IIndividual> individuals, EvolveConfig config) { Individuals = individuals; Config = config; }