From ce615d8a268dbae8b6eb2d744b1598cf3ebf55f3 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 6 Feb 2023 00:01:22 +0100 Subject: [PATCH] cec2020: implement HighConditionElliptic func --- bench/cec2020/basicFunctions.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bench/cec2020/basicFunctions.go b/bench/cec2020/basicFunctions.go index 98b02bf..0c7a15d 100644 --- a/bench/cec2020/basicFunctions.go +++ b/bench/cec2020/basicFunctions.go @@ -18,7 +18,18 @@ func Rastrigin(x []float64) float64 { // HighConditionedElliptic is the "High Conditioned Elliptic Function" of // CEC2020. -func HighConditionedElliptic(x []float64) float64 { return 0 } +func HighConditionedElliptic(x []float64) float64 { + var sum float64 + + // float64 version of the length of x. + fnx := float64(len(x)) + + for i := range x { + sum += math.Pow(math.Pow(10, 6), float64(i-1)/(fnx-1)) * math.Pow(x[i], 2) + } + + return sum +} // HGBat is the "HGBat Function" of CEC2020. func HGBat(x []float64) float64 { return 0 }