Method: EvoSynth::Problems::FloatBenchmarkFuntions.griewank
- Defined in:
- lib/evosynth/problems/float_benchmark_functions.rb
.griewank(xs) ⇒ Object
Griewank (Törn & Zilinskas 1989)
global minimum: f(x) = 0 at x(i) = 0, i = 1..n
91 92 93 94 95 |
# File 'lib/evosynth/problems/float_benchmark_functions.rb', line 91 def FloatBenchmarkFuntions.griewank(xs) product = 1.0 xs.each_with_index { |x, i| product *= Math.cos x / Math.sqrt(i+1) } 1 + xs.inject(0.0) { |sum, x| sum += x**2 / (400 * xs.size) } - product end |