Class: EvoSynth::Selections::FitnessProportionalSelection
- Inherits:
-
Object
- Object
- EvoSynth::Selections::FitnessProportionalSelection
- Defined in:
- lib/evosynth/operators/selections/fitness_proportional_selection.rb
Overview
FITNESSPROPORTIONALE-SELETION (Weicker Page 71)
Direct Known Subclasses
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/fitness_proportional_selection.rb', line 33 def select(population, select_count = 1) selected_population = EvoSynth::Population.new fitness_hash = generate_fitness_hash(population) select_count.to_i.times do limit = EvoSynth.rand(fitness_hash.values.max).floor next_individual = select_next_individual(population, limit, fitness_hash) selected_population.add(next_individual) end selected_population end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/evosynth/operators/selections/fitness_proportional_selection.rb', line 46 def to_s "fitness proportional selection" end |