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

This commit is contained in:
leo 2023-02-06 22:25:49 +01:00
parent b785da87e9
commit 3922e86625
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

@ -162,8 +162,13 @@ func SchwefelModified(x []float64) float64 {
return 418.9829*fnx - sum
}
// Schaffer is the "Expanded Schaffer's Function" of CEC2020.
func Schaffer(x []float64) float64 { return 0 }
// Schaffer is the Schaffer's function.
func Schaffer(x, y float64) float64 {
return 0.5 + (math.Pow(math.Sin(math.Sqrt(math.Pow(x, 2)+math.Pow(y, 2))-0.5), 2) / (1 + 0.001*(math.Pow(x, 2)+math.Pow(y, 2))))
}
// SchafferExpanded is the "Expanded Schaffer's Function" of CEC2020.
func SchafferExpanded(x []float64) float64 { return 0 }
// Weierstrass is the "Weierstrass Function" of CEC2020 with a=0.5, b=3 and
// kmax=20.