예제 #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
 /// <summary>
 /// The add random gene.
 /// </summary>
 /// <param name="genotype">
 /// The genotype.
 /// </param>
 private void AddRandomGene(Genotype genotype)
 {
     genotype.Genes.Add(Gene.GetRandomGene());
 }