Class: GA::Operators::Selection::Random

Inherits:
Basic show all
Defined in:
lib/operators.rb

Instance Method Summary collapse

Instance Method Details

#apply(population) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/operators.rb', line 42

def apply(population)
    offspring = []
    population.size.times do
        index = GA::Random.rand(population.size)
        offspring.push population[index].dup
    end
    return offspring
end