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

This commit is contained in:
leo 2023-02-08 01:14:33 +01:00
parent 6782702f16
commit a9135c535f
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

@ -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 }