cec2020: implement Griewank 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
ce1b587b22
commit
6b20fc8ea5
@ -19,7 +19,19 @@ func HGBat(x []float64) float64 { return 0 }
|
|||||||
func Rosenbrock(x []float64) float64 { return 0 }
|
func Rosenbrock(x []float64) float64 { return 0 }
|
||||||
|
|
||||||
// Griewank is the "Griewank's Function" of CEC2020.
|
// Griewank is the "Griewank's Function" of CEC2020.
|
||||||
func Griewank(x []float64) float64 { return 0 }
|
// ref: https://www.sfu.ca/~ssurjano/griewank.html
|
||||||
|
func Griewank(x []float64) float64 {
|
||||||
|
var sum float64
|
||||||
|
|
||||||
|
var prod float64
|
||||||
|
|
||||||
|
for i := range x {
|
||||||
|
sum += math.Pow(x[i], 2) / 4000
|
||||||
|
prod -= math.Cos(x[i] / math.Sqrt(float64(i)))
|
||||||
|
}
|
||||||
|
|
||||||
|
return sum - prod + 1
|
||||||
|
}
|
||||||
|
|
||||||
// Ackley is the "Ackley's Function" of CEC2020.
|
// Ackley is the "Ackley's Function" of CEC2020.
|
||||||
func Ackley(x []float64) float64 { return 0 }
|
func Ackley(x []float64) float64 { return 0 }
|
||||||
|
Loading…
Reference in New Issue
Block a user