class CombinedNewGenerationStrategy
This class pick randomly between strategies to implement more mitigated new generation strategy
Public Class Methods
new()
click to toggle source
# File lib/gimuby/genetic/solution/new_generation_strategy/combined_new_generation_strategy.rb, line 7 def initialize @strategies = [] end
Public Instance Methods
add_strategy(strategy)
click to toggle source
Add a strategy in the handled strategy of the system @param strategy {NewGenerationStrategy}
# File lib/gimuby/genetic/solution/new_generation_strategy/combined_new_generation_strategy.rb, line 18 def add_strategy(strategy) @strategies.push(strategy) end
reproduce(solution1, solution2)
click to toggle source
# File lib/gimuby/genetic/solution/new_generation_strategy/combined_new_generation_strategy.rb, line 11 def reproduce(solution1, solution2) strategy = get_concrete_strategy strategy.reproduce(solution1, solution2) end
Protected Instance Methods
get_concrete_strategy()
click to toggle source
# File lib/gimuby/genetic/solution/new_generation_strategy/combined_new_generation_strategy.rb, line 24 def get_concrete_strategy Factory.random_entry(@strategies) end