diff --git a/bench/cec2020/benchFunctions.go b/bench/cec2020/benchFunctions.go index 4c45833..783e447 100644 --- a/bench/cec2020/benchFunctions.go +++ b/bench/cec2020/benchFunctions.go @@ -3,6 +3,8 @@ package cec2020 +import "math" + // void sphere_func (double *, double *, int , double *,double *, int, int); // Sphere // void ellips_func(double *, double *, int , double *,double *, int, int); // Ellipsoidal // void bent_cigar_func(double *, double *, int , double *,double *, int, int); // Discus @@ -30,7 +32,15 @@ package cec2020 // void dixon_price_func(double *, double *, int , double *,double *, int, int); // Dixon and Price // BentCigar is the "Bent Cigar Function" of CEC2020. -func BentCigar(x []float64) float64 { return 0 } +func BentCigar(x []float64) float64 { + var sum float64 + + for i := 1; i < len(x); i++ { + sum += math.Pow(x[i], 2) + } + + return (1000000 * sum) + math.Pow(x[0], 2) +} // Schwefel is the "Shifted and Rotated Schwefel's Function" of CEC2020. func Schwefel(x []float64) float64 { return 0 }