diff --git a/bench/cec2020/basicFunctions.go b/bench/cec2020/basicFunctions.go index e958f02..96bbae9 100644 --- a/bench/cec2020/basicFunctions.go +++ b/bench/cec2020/basicFunctions.go @@ -19,7 +19,19 @@ func HGBat(x []float64) float64 { return 0 } func Rosenbrock(x []float64) float64 { return 0 } // Griewank is the "Griewank's Function" of CEC2020. -func Griewank(x []float64) float64 { return 0 } +// ref: https://www.sfu.ca/~ssurjano/griewank.html +func Griewank(x []float64) float64 { + var sum float64 + + var prod float64 + + for i := range x { + sum += math.Pow(x[i], 2) / 4000 + prod -= math.Cos(x[i] / math.Sqrt(float64(i))) + } + + return sum - prod + 1 +} // Ackley is the "Ackley's Function" of CEC2020. func Ackley(x []float64) float64 { return 0 }