Module: SurviveMethods
- Included in:
- GA
- Defined in:
- lib/survive_methods.rb
Instance Method Summary collapse
Instance Method Details
#max_fitness(population) ⇒ Object
7 8 9 10 |
# File 'lib/survive_methods.rb', line 7 def max_fitness(population) population.sort! { |a, b| b.fitness <=> a.fitness } @population = population[0..(@population.size-1)] end |
#min_fitness(population) ⇒ Object
2 3 4 5 |
# File 'lib/survive_methods.rb', line 2 def min_fitness(population) population.sort! { |a, b| a.fitness <=> b.fitness } @population = population[0..(@population.size-1)] end |