![JAR search and dependency download from the Maven repository](/logo.png)
net.sourceforge.cilib.functions.continuous.unconstrained.Beale 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
/** __ __
* _____ _/ /_/ /_ Computational Intelligence Library (CIlib)
* / ___/ / / / __ \ (c) CIRG @ UP
* / /__/ / / / /_/ / http://cilib.net
* \___/_/_/_/_.___/
*/
package net.sourceforge.cilib.functions.continuous.unconstrained;
import com.google.common.base.Preconditions;
import net.sourceforge.cilib.functions.ContinuousFunction;
import net.sourceforge.cilib.type.types.container.Vector;
/**
* Beale Function.
*
* Reference: S.K. Mishra, Some New Test Functions
* for Global Optimization and Performance of Repulsive Particle Swarm Methods
* North-Eastern Hill University, India, 2002
*
* Minimum:
*
* - ƒ(x*) = 0
* - x* = (3, 0.5)
* - for x1, x2 in [-4.5, 4.5]
*
*
*
* Characteristics:
*
* - Only defined for 2 dimensions
* - Unimodal
* - Separable
* - Regular
*
*
*
* R(-4.5,4.5)^2
*
*/
public class Beale implements ContinuousFunction {
private static final long serialVersionUID = -7803711986955989075L;
/**
* {@inheritDoc}
*/
@Override
public Double apply(Vector input) {
Preconditions.checkArgument(input.size() == 2, "Beale function is only defined for 2 dimensions");
double x1 = input.doubleValueOf(0);
double x2 = input.doubleValueOf(1);
return (1.5 - x1 + x1 * x2) * (1.5 - x1 + x1 * x2) + (2.25 - x1 + x1 * x2 * x2) * (2.25 - x1 + x1 * x2 * x2) + (2.625 - x1 + x1 * x2 * x2 * x2) * (2.625 - x1 + x1 * x2 * x2 * x2);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy