Module: FeldtRuby::Optimize::DE_MutationStrategy_Best_2

Included in:
DEOptimizer_Best_2_Bin
Defined in:
lib/feldtruby/optimize/differential_evolution.rb

Overview

The DE/best/1/* mutation strategy.

Instance Method Summary collapse

Instance Method Details

#mutate(targetIndex, donorParentsIndices) ⇒ Object



196
197
198
199
200
# File 'lib/feldtruby/optimize/differential_evolution.rb', line 196

def mutate(targetIndex, donorParentsIndices)
	p1, p2, p3, p4 = get_candidates_with_indices(donorParentsIndices)
	f = scale_factor(targetIndex)
	candidate_from_array(best) + (f * (p1 - p2)) + (f * (p3 - p4))
end

#num_parents_to_sampleObject

We need four parents for two donor vectors. And then the target, so 1+4 in total.



194
# File 'lib/feldtruby/optimize/differential_evolution.rb', line 194

def num_parents_to_sample; 5; end