class MutationStrategy
Attributes
mutation_rate[RW]
Public Class Methods
new(mutation_rate = 0.01)
click to toggle source
# File lib/gimuby/genetic/solution/mutation_strategy/mutation_strategy.rb, line 5 def initialize(mutation_rate = 0.01) @mutation_rate = mutation_rate end
Public Instance Methods
mutate(solution)
click to toggle source
# File lib/gimuby/genetic/solution/mutation_strategy/mutation_strategy.rb, line 11 def mutate(solution) if rand < @mutation_rate perform_mutation(solution) solution.reset_fitness_state end end
perform_mutation(solution)
click to toggle source
# File lib/gimuby/genetic/solution/mutation_strategy/mutation_strategy.rb, line 18 def perform_mutation(solution) raise NotImplementedError end