cec2020: implement Griewank func
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
leo 2023-02-05 00:05:53 +01:00
parent ce1b587b22
commit 6b20fc8ea5
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

@ -19,7 +19,19 @@ func HGBat(x []float64) float64 { return 0 }
func Rosenbrock(x []float64) float64 { return 0 } func Rosenbrock(x []float64) float64 { return 0 }
// Griewank is the "Griewank's Function" of CEC2020. // 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. // Ackley is the "Ackley's Function" of CEC2020.
func Ackley(x []float64) float64 { return 0 } func Ackley(x []float64) float64 { return 0 }