Class: EvoSynth::Mutations::Identity

Inherits:
Object
  • Object
show all
Defined in:
lib/evosynth/operators/mutations/identity.rb

Overview

The Identity mutation does not change the genome of the given individual, it will return a clone.

This mutations does not destroy permutations.

Instance Method Summary collapse

Instance Method Details

#mutate(individual) ⇒ Object

:call-seq: mutate(Individual) -> Individual

Returns a clone of a given individual.

m = Identity.new
m.mutate(a_individual)   #=> a_new_individual


42
43
44
45
# File 'lib/evosynth/operators/mutations/identity.rb', line 42

def mutate(individual)
	mutated = individual.deep_clone
	mutated
end

#to_sObject

:call-seq: to_s -> string

Returns description of this mutation

m = Identity.new
m.to_s                   #=> "identity (just clones individual)"


55
56
57
# File 'lib/evosynth/operators/mutations/identity.rb', line 55

def to_s
	"identity (just clones individual)"
end