コード例 #1
0
        /// <summary>
        /// Constructs a random genotype of the requested size.
        /// </summary>
        /// <param name="size">The length of the genome to construct</param>
        /// <returns>The constructed Genotype</returns>
        public static Genotype GetRandomGenotype(int size)
        {
            var genotype = new Genotype();

            for (var j = 0; j < size; j++)
            {
                genotype.Genes.Add(Gene.GetRandomGene());
            }

            return(genotype);
        }
コード例 #2
0
ファイル: Breeder.cs プロジェクト: charlesj/Nenetics
 /// <summary>
 /// The add random gene.
 /// </summary>
 /// <param name="genotype">
 /// The genotype.
 /// </param>
 private void AddRandomGene(Genotype genotype)
 {
     genotype.Genes.Add(Gene.GetRandomGene());
 }