Class: Wallace::Operators::TworsMutationOperator
- Inherits:
-
Wallace::Operator
- Object
- Wallace::Operator
- Wallace::Operators::TworsMutationOperator
- Defined in:
- lib/operators/twors_mutation_operation.rb
Overview
The Twors Mutation operator takes an individual and swaps the values of two genes selected at random.
Found in:
> Analyzing the Performance of Mutation Operators to Solve the Travelling Salesman Problem
> Otman ABDOUN, Jaafar ABOUCHABAKA, Chakir TAJANI
Instance Method Summary collapse
Methods inherited from Wallace::Operator
Constructor Details
This class inherits a constructor from Wallace::Operator
Instance Method Details
#operate(rng, inputs) ⇒ Object
12 13 14 15 16 |
# File 'lib/operators/twors_mutation_operation.rb', line 12 def operate(rng, inputs) i, j = (0...inputs[0].length).to_a.sample(2) inputs[0][i], inputs[0][j] = inputs[0][j], inputs[0][i] return inputs end |