Class: Rosenbrock

Inherits:
Object
  • Object
show all
Defined in:
lib/gimuby/problem/rosenbrock/rosenbrock.rb

Overview

Rosenbrock function (banana / valley function) Optimal is at (1, 1) en.wikipedia.org/wiki/Rosenbrock_function

Instance Method Summary collapse

Instance Method Details

#evaluate(values) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/gimuby/problem/rosenbrock/rosenbrock.rb', line 6

def evaluate(values)
  x = values.shift
  y = values.shift
  term_1 = (1 - x) ** 2
  term_2 = 100 * (y - x ** 2) ** 2
  term_1 + term_2
end