예제 #1
0
        public Population(EvolveConfig config)
        {
            Config = config;

            Individuals = Enumerable.Range(0, config.PopulationConfig.PopulationSize)
                                    .Select(_ => IndividualFactory.Instance.CreateIndividual()).ToList();
        }
예제 #2
0
        public Maters(IEnumerable<IIndividual> individuals, EvolveConfig config)
        {
            _individuals = individuals;
            Config = config;

            SetFathersAndMothers();
        }
예제 #3
0
        public Individual(IEnumerable<double> values, EvolveConfig globalConfig, IndividualConfig individualConfig)
        {
            GlobalConfig = globalConfig;

            IndividualConfig = individualConfig;

            Current = values.ToList();
        }
예제 #4
0
 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));
 }
예제 #5
0
        public Individual(EvolveConfig globalConfig, IndividualConfig individualConfig)
        {
            GlobalConfig = globalConfig;

            IndividualConfig = individualConfig;

            Current = Enumerable.Range(0, IndividualConfig.IndividualSize)
                                .Select(_ => GetValue()).ToList();
        }
예제 #6
0
        public Population(IEnumerable<IIndividual> individuals, EvolveConfig config)
        {
            Individuals = individuals;

            Config = config;
        }