Method: EvoSynth::Problems::FloatBenchmarkFuntions.ackley

Defined in:
lib/evosynth/problems/float_benchmark_functions.rb

.ackley(xs) ⇒ Object

Ackley (Ackley 1987)

global minimum: f(x) = 0 at x(i) = 0, i = 1..n



81
82
83
84
85
# File 'lib/evosynth/problems/float_benchmark_functions.rb', line 81

def FloatBenchmarkFuntions.ackley(xs)
	quad_sum = xs.inject(0.0) { |sum, x| sum += x**2 }
	cos_sum = xs.inject(0.0) { |sum, x| sum += Math.cos(2 * Math::PI * x) }
	20 + Math::E - 20 * Math.exp(-0.2 * Math.sqrt( (1.0 / xs.size) * quad_sum )) - Math.exp( (1.0 / xs.size) * cos_sum )
end