Class: EvoSynth::ArrayGenome
- Inherits:
-
Array
- Object
- Array
- EvoSynth::ArrayGenome
- Defined in:
- lib/evosynth/core/array_genome.rb
Overview
Array based genome which keeps track of changes (changed attribute) to reduce the need to recalculate the fitness function (see Evaluator)
This genome can contain any type of genes.
TODO: complete documentation
Direct Known Subclasses
Constant Summary collapse
- METHODS_THAT_CHANGE_ARRAY =
see ruby-doc.org/doxygen/1.8.4/group__ruby__ary.html#ga9 see rb_ary_store and rb_ary_modify
['initialize', '[]=', 'delete', 'delete_at', 'collect!', 'map!', '<<', 'reject!', 'uniq!', 'unshift', 'shift', 'sort!', 'pop', 'push', 'flatten!', 'reverse!', 'slice!', 'clear']
Instance Method Summary collapse
-
#changed=(value) ⇒ Object
Set the changed flag (boolean) of the genome.
-
#changed? ⇒ Boolean
True if the genome has changed, false otherwise.
-
#clone ⇒ Object
Returns a clone of this genome.
-
#to_s ⇒ Object
Return a printable version of this genome.
Instance Method Details
#changed=(value) ⇒ Object
Set the changed flag (boolean) of the genome
38 39 40 |
# File 'lib/evosynth/core/array_genome.rb', line 38 def changed=(value) @changed = value end |
#changed? ⇒ Boolean
True if the genome has changed, false otherwise. Has to be set to false manually.
44 45 46 |
# File 'lib/evosynth/core/array_genome.rb', line 44 def changed? @changed end |
#clone ⇒ Object
Returns a clone of this genome
56 57 58 59 60 |
# File 'lib/evosynth/core/array_genome.rb', line 56 def clone my_clone = super my_clone.changed = false my_clone end |
#to_s ⇒ Object
Return a printable version of this genome.
50 51 52 |
# File 'lib/evosynth/core/array_genome.rb', line 50 def to_s self * ", " end |