net.sourceforge.cilib.functions.continuous.unconstrained.ModifiedRastrigin 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;
/**
* Modified Rastrigin function.
*
*
* Reference:
*
*
* Liang, J. J., B. Y. Qu, and P. N. Suganthan.
* "Problem Definitions and Evaluation Criteria for the CEC 2013 Special Session
* on Real-Parameter Optimization." (2013).
*
*
*/
public class ModifiedRastrigin extends ContinuousFunction {
/**
* {@inheritDoc}
*/
@Override
public Double f(Vector input) {
double sum = 0;
for (int i = 0; i < input.size(); ++i) {
sum += Math.cos(2 * Math.PI * input.doubleValueOf(i));
}
return 10 * (input.size() - sum);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy