Class: Operator::MutationAltering
- Inherits:
-
MutationAlteringCore
- Object
- MutationAlteringCore
- Operator::MutationAltering
- Defined in:
- ../lib/mutation_altering.rb
Overview
Common functionality for MutationNodal and MutationStructural classes. Select the random (nodal/structural filtered) position within the orig vector and mutate it. The resultant value (of a mutated codon) is a random number in the range 0..magnitude. Return the mutated copy of the orig. genotype. track argument is the hint (symbols atteched to positions) obtained from Mapper::Base#track_support
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) magnitude
The maximal possible value of the mutaton plus 1.
-
- (Object) random
The source of randomness, used for calling “random.rand( limit )”, defaulting to ‘Kernel’ class.
Attributes inherited from MutationAlteringCore
Instance Method Summary (collapse)
-
- (MutationAltering) initialize(grammar, magnitude = nil)
constructor
Create the mutation operator.
Methods inherited from MutationAlteringCore
Constructor Details
- (MutationAltering) initialize(grammar, magnitude = nil)
Create the mutation operator. grammar is the valid grammar for distinguishing :structural and :nodal symbols magnitude is the initial value of the MutationAltering#magnitude attribute
107 108 109 110 |
# File '../lib/mutation_altering.rb', line 107 def initialize( grammar, magnitude=nil ) super(grammar) @magnitude = magnitude end |
Instance Attribute Details
- (Object) magnitude
The maximal possible value of the mutaton plus 1. If not specified, the maximal value over the original genotype values is used.
117 118 119 |
# File '../lib/mutation_altering.rb', line 117 def magnitude @magnitude end |
- (Object) random
The source of randomness, used for calling “random.rand( limit )”, defaulting to ‘Kernel’ class.
113 114 115 |
# File '../lib/mutation_altering.rb', line 113 def random @random end |