cec2020: implement HGBat func
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ce615d8a26
commit
de1b2021c5
@ -32,7 +32,22 @@ func HighConditionedElliptic(x []float64) float64 {
|
||||
}
|
||||
|
||||
// HGBat is the "HGBat Function" of CEC2020.
|
||||
func HGBat(x []float64) float64 { return 0 }
|
||||
func HGBat(x []float64) float64 {
|
||||
var sum1 float64
|
||||
|
||||
var sum2 float64
|
||||
|
||||
for i := range x {
|
||||
sum1 += math.Pow(x[i], 2)
|
||||
|
||||
sum2 += x[i]
|
||||
}
|
||||
|
||||
// float64 version of the length of x.
|
||||
fnx := float64(len(x))
|
||||
|
||||
return math.Pow(math.Abs(math.Pow(sum1, 2)-math.Pow(sum2, 2)), 0.5) + (((0.5 * sum1) + sum2) / (fnx + 0.5))
|
||||
}
|
||||
|
||||
// Rosenbrock is the "Rosenbrock's Function" of CEC2020.
|
||||
// ref: https://infinity77.net/global_optimization/test_functions_nd_R.html#go_benchmark.Rosenbrock
|
||||
|
Loading…
Reference in New Issue
Block a user