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