Пример #1
0
        public override IGenome CreateNew(Gene[] genes)
        {
            var result = new NumberGenome
            {
                Genes = genes.Select(g => new Gene(g))
                        .ToArray()
            };

            return(result);
        }
Пример #2
0
        protected override IGenome NewRandomGenome()
        {
            var genes = Enumerable.Range(0, GeneCount)
                        .Select(i =>
            {
                var val = GARandomManager.Random.Next(MinValue, MaxValue);
                return(new Gene(new ClonableInt(val)));
            }).ToArray();

            var genome = new NumberGenome
            {
                Genes = genes
            };

            return(genome);
        }