Class: Wallace::Operators::BoundaryMutationOperator
- Inherits:
-
Wallace::Operator
- Object
- Wallace::Operator
- Wallace::Operators::BoundaryMutationOperator
- Defined in:
- lib/operators/boundary_mutation_operation.rb
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ BoundaryMutationOperator
constructor
Constructs a new boundary mutation operator.
- #operate(rng, inputs) ⇒ Object
Methods inherited from Wallace::Operator
Constructor Details
#initialize(opts = {}) ⇒ BoundaryMutationOperator
Constructs a new boundary mutation operator.
Parameters:
-
opts, a hash of keyword options for this method. -> id, the unique identifier for this operator. -> inputs, an array of inputs (OperatorInput) to this operator. -> values, the collection of values that each gene can take.
12 13 14 15 |
# File 'lib/operators/boundary_mutation_operation.rb', line 12 def initialize(opts = {}) super(opts) @values = opts[:values] # Extract this from the species? end |
Instance Method Details
#operate(rng, inputs) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/operators/boundary_mutation_operation.rb', line 17 def operate(rng, inputs) # x = inputs[0] # Select a gene to mutate. #index = rng.rand(x.data.length) #x.data[rng.rand(x.data.length)] = return inputs end |