chore(bench): res -> sum in Schwefel
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
leo 2023-02-04 19:24:50 +01:00
parent 12f0aecd5a
commit fa441d8b1f
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

@ -34,14 +34,14 @@ var FunctionParams = map[string]funcParams{
// Schwefel computes the value of the Schwefel function for x. // Schwefel computes the value of the Schwefel function for x.
func Schwefel(x []float64) float64 { func Schwefel(x []float64) float64 {
// - Domain is | x_i | < 500 // - Domain is | x_i | < 500
// - Global minimum at fmin = -122569.5 at x_i = 420.9687 // - Global minimum at fmin = 0 at x_i = 420.9687
var res float64 var sum float64
for _, val := range x { for _, val := range x {
res += val * math.Sin(math.Sqrt(math.Abs(val))) sum += val * math.Sin(math.Sqrt(math.Abs(val)))
} }
return 418.9829*float64(len(x)) - res return 418.9829*float64(len(x)) - sum
} }
// DeJong1st computes the value of the 1st De Jong function for x. // DeJong1st computes the value of the 1st De Jong function for x.