Class: EvoSynth::Mutations::Identity
- Inherits:
-
Object
- Object
- EvoSynth::Mutations::Identity
- 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
-
#mutate(individual) ⇒ Object
:call-seq: mutate(Individual) -> Individual.
-
#to_s ⇒ Object
:call-seq: to_s -> string.
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_s ⇒ Object
: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 |