test/genetic_algorithm.rb
# We combine each pair of selected chromosome using the method 
# Chromosome.reproduce
#
# The reproduction will also call the Chromosome.mutate method with 
# each member of the population. You should implement Chromosome.mutate
# to only change (mutate) randomly. E.g. You could effectivly change the
# chromosome only if 
#     rand < ((1 - chromosome.normalized_fitness) * 0.4)
We combine each pair of selected chromosome using the method
Chromosome.reproduce

The reproduction will also call the Chromosome.mutate method with
each member of the population. You should implement Chromosome.mutate
to only change (mutate) randomly.
We combine each pair of selected chromosome using the method Chromosome . reproduce The reproduction will also call the Chromosome . mutate method with each member of the population . You should implement Chromosome . mutate to only change ( mutate ) randomly .
def reproduction(selected_to_breed)
        0.upto(selected_to_breed.length/2-1).map do |i|
          offspring = Chromosome.reproduce(selected_to_breed[2*i], selected_to_breed[2*i+1])
          offspring.age = -1
          offspring 
        end
      end
def reproduction ( selected_to_breed ) 0 . upto ( selected_to_breed . length / 2 - 1 ) . map do | i | offspring = Chromosome . reproduce ( selected_to_breed [ 2 * i ] , selected_to_breed [ 2 * i + 1 ] ) offspring . age = - 1 offspring end end
We combine each pair of selected chromosome using the method
Chromosome.reproduce
We combine each pair of selected chromosome using the method Chromosome . reproduce
selected_to_breed