Class: EvoSynth::Selections::SelectBest
- Inherits:
-
Object
- Object
- EvoSynth::Selections::SelectBest
- Defined in:
- lib/evosynth/operators/selections/best_selection.rb
Overview
BESTEN-SELEKTION (Weicker Page 65)
Instance Method Summary collapse
Instance Method Details
#select(population, select_count = 1) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/evosynth/operators/selections/best_selection.rb', line 33 def select(population, select_count = 1) selected_population = EvoSynth::Population.new if select_count > 1 best = population.best(select_count) best.each { |individual| selected_population.add(individual) } else selected_population.add(population.best) end selected_population end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/evosynth/operators/selections/best_selection.rb', line 46 def to_s "select best individuals" end |