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

This commit is contained in:
leo 2023-02-06 21:48:55 +01:00
parent 83a8c94ea9
commit c5f5be1ca9
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

@ -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 }