Class: Operator::MutationBitAltering

Inherits:
MutationAlteringCore show all
Defined in:
../lib/mutation_altering.rb

Overview

Common functionality for MutationBitNodal and MutationBitStructural classes.

Select the random (nodal/structural filtered) position within the orig vector and mutate it. The resultant value (of a mutated codon) is bit-mutated by self.codon.mutate_bit method. Return the mutated copy of the orig. genotype. track argument is the hint (symbols attached to positions) obtained from Mapper::Base#track_support

Direct Known Subclasses

MutationBitNodal, MutationBitStructural

Instance Attribute Summary (collapse)

Attributes inherited from MutationAlteringCore

#offset

Instance Method Summary (collapse)

Methods inherited from MutationAlteringCore

#mutation

Constructor Details

- (MutationBitAltering) initialize(grammar)

Create the mutation operator. grammar is the valid grammar for distinguishing :structural and :nodal symbols



45
46
47
48
# File '../lib/mutation_altering.rb', line 45

def initialize( grammar )
  super
  @codon = CodonMod.new # standard 8-bit codons
end

Instance Attribute Details

- (Object) codon

Codon encoding scheme. By default the instance of the CodonMod class is used (ie. standard GE 8-bit codons) See CodonMod for details.



52
53
54
# File '../lib/mutation_altering.rb', line 52

def codon
  @codon
end

- (Object) random

The source of randomness, used for calling “random.rand( limit )”, defaulting to ‘Kernel’ class.



55
56
57
# File '../lib/mutation_altering.rb', line 55

def random
  @random
end