diff --git a/bench/cec2020/basicFunctions.go b/bench/cec2020/basicFunctions.go index 96bbae9..98682bd 100644 --- a/bench/cec2020/basicFunctions.go +++ b/bench/cec2020/basicFunctions.go @@ -16,7 +16,16 @@ func HighConditionedElliptic(x []float64) float64 { return 0 } func HGBat(x []float64) float64 { return 0 } // Rosenbrock is the "Rosenbrock's Function" of CEC2020. -func Rosenbrock(x []float64) float64 { return 0 } +// ref: https://infinity77.net/global_optimization/test_functions_nd_R.html#go_benchmark.Rosenbrock +func Rosenbrock(x []float64) float64 { + var sum float64 + + for i := 0; i < len(x)-1; i++ { + sum += 100*(math.Pow(math.Pow(x[i], 2)-x[i+1], 2)) + math.Pow(x[i]-1, 2) + } + + return sum +} // Griewank is the "Griewank's Function" of CEC2020. // ref: https://www.sfu.ca/~ssurjano/griewank.html