net.sourceforge.cilib.functions.continuous.unconstrained.Rosenbrock 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;
/**
* Generalised Rosenbrock function.
*
* Reference: X. Yao, Y. Liu, G. Liu, Evolutionary Programming
* Made Faster, IEEE Transactions on Evolutionary Computation,
* 3(2):82--102, 1999
*
*
* Characteristics:
*
* - Unimodal
* - Non Separable
* - Continuous
* - Regular
*
*
*
* f(x) = 0; x = 1
*
* x e [-2.048,2.048]
*
* R(-2.048, 2.048)^30
*
*/
public class Rosenbrock extends ContinuousFunction {
private static final long serialVersionUID = -5850480295351224196L;
/**
* {@inheritDoc}
*/
@Override
public Double f(Vector input) {
double tmp = 0;
for (int i = 0; i < input.size()-1; ++i) {
double a = input.doubleValueOf(i);
double b = input.doubleValueOf(i+1);
tmp += ((100 * (b - a * a) * (b - a * a)) + ((a - 1.0) * (a - 1.0)));
}
return tmp;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy