Class: EvoSynth::GlobalRecombinations::GlobalUniformCrossover

Inherits:
Object
  • Object
show all
Defined in:
lib/evosynth/operators/global_recombinations/global_uniform_crossover.rb

Overview

GLOBALER-UNIFORMER-CROSSOVER (Weicker Page 137)

Instance Method Summary collapse

Instance Method Details

#recombine(population) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/evosynth/operators/global_recombinations/global_uniform_crossover.rb', line 32

def recombine(population)
	child = population[EvoSynth.rand(population.size)].deep_clone

	child.genome.each_index do |index|
		child.genome[index] = population[EvoSynth.rand(population.size)].genome[index]
	end

	child
end

#to_sObject



42
43
44
# File 'lib/evosynth/operators/global_recombinations/global_uniform_crossover.rb', line 42

def to_s
	"global uniform crossover"
end