net.sourceforge.cilib.functions.continuous.unconstrained.Schwefel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cilib-library Show documentation
Show all versions of cilib-library Show documentation
A library of composable components enabling simpler Computational Intelligence
The newest version!
/** __ __
* _____ _/ /_/ /_ Computational Intelligence Library (CIlib)
* / ___/ / / / __ \ (c) CIRG @ UP
* / /__/ / / / /_/ / http://cilib.net
* \___/_/_/_/_.___/
*/
package net.sourceforge.cilib.functions.continuous.unconstrained;
import net.sourceforge.cilib.functions.ContinuousFunction;
import net.sourceforge.cilib.type.types.container.Vector;
/**
* Schwefel function.
*
*
* Characteristics:
*
* - Multimodal
* - Separable
* - Discontinuous
*
*
* f(x) = 0; x = (-420.9687,...,-420.9687);
*
* x e [-512.03,511.97]
*
* R(-512.03, 511.97)^30
*
*/
public class Schwefel extends ContinuousFunction {
private static final long serialVersionUID = 3835871629510784855L;
/**
* {@inheritDoc}
*/
@Override
public Double f(Vector input) {
double sum = 0;
for (int i = 0; i < input.size(); ++i) {
sum += -input.doubleValueOf(i) * Math.sin(Math.sqrt(Math.abs(input.doubleValueOf(i))));
}
return sum + input.size() * 4.18982887272434686131e+02;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy