diff --git a/bench/cec2020/benchFunctions.go b/bench/cec2020/benchFunctions.go index 02836cf..5f9938f 100644 --- a/bench/cec2020/benchFunctions.go +++ b/bench/cec2020/benchFunctions.go @@ -156,7 +156,32 @@ func Hybrid2(x []float64) float64 { } // Hybrid3 is the "Hybrid Function 3" of CEC2020. -func Hybrid3(x []float64) float64 { return 0 } +func Hybrid3(x []float64) float64 { + nx := len(x) + fnx := float64(nx) + + funcs := []func([]float64) float64{ + SchafferExpanded, + HGBat, + Rosenbrock, + SchwefelModified, + HighConditionedElliptic, + } + // percentages used to control the amount of contribution of each func. + p := []float64{0.1, 0.2, 0.2, 0.2, 0.3} + gnx := getGnx(p, fnx) + + z := newOpt(nx) + mz := getMz(x, z) + + var sum float64 + + for i := range funcs { + sum += funcs[i](mz) * gnx[i] + } + + return sum +} // Composition1 is the "Composition Function 1" of CEC2020. func Composition1(x []float64) float64 { return 0 }