Class: Evolvable::UniformCrossover

Inherits:
Object
  • Object
show all
Defined in:
lib/evolvable/uniform_crossover.rb

Instance Method Summary collapse

Instance Method Details

#call(population) ⇒ Object



32
33
34
35
# File 'lib/evolvable/uniform_crossover.rb', line 32

def call(population)
  population.evolvables = new_evolvables(population, population.size)
  population
end

#new_evolvables(population, count) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/evolvable/uniform_crossover.rb', line 37

def new_evolvables(population, count)
  parent_genome_cycle = population.new_parent_genome_cycle
  Array.new(count) do
    genome = build_genome(parent_genome_cycle.next)
    population.new_evolvable(genome: genome)
  end
end