Module: FeldtRuby::Optimize::DE_MutationStrategy_Best_1
- Included in:
- DEOptimizer_Best_1_Bin
- Defined in:
- lib/feldtruby/optimize/differential_evolution.rb
Overview
The DE/best/1/* mutation strategy.
Instance Method Summary collapse
- #mutate(targetIndex, donorParentsIndices) ⇒ Object
-
#num_parents_to_sample ⇒ Object
We need two parents for donor vector.
Instance Method Details
#mutate(targetIndex, donorParentsIndices) ⇒ Object
173 174 175 176 |
# File 'lib/feldtruby/optimize/differential_evolution.rb', line 173 def mutate(targetIndex, donorParentsIndices) p1, p2 = get_candidates_with_indices(donorParentsIndices) candidate_from_array(best) + (scale_factor(targetIndex) * (p1 - p2)) end |
#num_parents_to_sample ⇒ Object
We need two parents for donor vector. And then the target, so 1+2 in total.
171 |
# File 'lib/feldtruby/optimize/differential_evolution.rb', line 171 def num_parents_to_sample; 3; end |