pub fn ackley_param<T: Float + FromPrimitive + Sum>(param: &[T], a: T, b: T, c: T) -> T {
    let num1 = T::from_f64(1.0).unwrap();
    let n = T::from_usize(param.len()).unwrap();
    -a * (-b * ((num1 / n) * param.iter().map(|x| x.powi(2)).sum()).sqrt()).exp()
        - ((num1 / n) * param.iter().map(|x| (c * *x).cos()).sum()).exp()
        + a
        + num1.exp()
}
/// Ackley test function
///
/// The same as `ackley`; however, it allows to set the parameters a, b and c.
Ackley test function
The same as `ackley`; however, it allows to set the parameters a, b and c.
Ackley test function The same as ` ackley ` ; however it allows to set the parameters a b and c .
pub fn ackley_param<T: Float + FromPrimitive + Sum>(param: &[T], a: T, b: T, c: T) -> T {
    let num1 = T::from_f64(1.0).unwrap();
    let n = T::from_usize(param.len()).unwrap();
    -a * (-b * ((num1 / n) * param.iter().map(|x| x.powi(2)).sum()).sqrt()).exp()
        - ((num1 / n) * param.iter().map(|x| (c * *x).cos()).sum()).exp()
        + a
        + num1.exp()
}
pub fn ackley_param < T : Float + FromPrimitive + Sum > ( param : & [ T ] , a : T , b : T , c : T ) -> T { let num1 = T :: from_f64 ( 1.0 ) . unwrap ( ) ; let n = T :: from_usize ( param . len ( ) ) . unwrap ( ) ; - a * ( - b * ( ( num1 / n ) * param . iter ( ) . map ( | x | x . powi ( 2 ) ) . sum ( ) ) . sqrt ( ) ) . exp ( ) - ( ( num1 / n ) * param . iter ( ) . map ( | x | ( c * * x ) . cos ( ) ) . sum ( ) ) . exp ( ) + a + num1 . exp ( ) }
Ackley test function
The same as `ackley`; however, it allows to set the parameters a, b and c.
Ackley test function The same as ` ackley ` ; however it allows to set the parameters a b and c .
param
&[T]
a
T
b
T
c
T
param
&[T]
a
T
b
T
c
T