test/genetic_algorithm.rb
# Select the best chromosome in the population
Select the best chromosome in the population
Select the best chromosome in the population
def best_chromosome()
        the_best = @population[0]
        @population.each do |chromosome|
          the_best = chromosome if chromosome.fitness > the_best.fitness
        end
        return the_best
      end
def best_chromosome ( ) the_best = @population [ 0 ] @population . each do | chromosome | the_best = chromosome if chromosome . fitness > the_best . fitness end return the_best end
Select the best chromosome in the population
Select the best chromosome in the population