net.sourceforge.cilib.functions.continuous.unconstrained.Booth Maven / Gradle / Ivy
/** __ __
* _____ _/ /_/ /_ 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;
import com.google.common.base.Preconditions;
/**
* Booth 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* = (1,3)
* - for x1, x2 in [-10,10]
*
*
*
* Characteristics:
*
* - Only defined for 2 dimensions
* - Unimodal
* - Seperable
* - Regular
*
*
*
* R(-10,10)^2
*
*/
public class Booth extends ContinuousFunction {
private static final long serialVersionUID = -7803711986955989075L;
/**
* {@inheritDoc}
*/
@Override
public Double f(Vector input) {
Preconditions.checkArgument(input.size() == 2, "Booth function is only defined for 2 dimensions");
double x1 = input.doubleValueOf(0);
double x2 = input.doubleValueOf(1);
return (x1+2*x2-7)*(x1+2*x2-7) + (2*x1+x2-5)*(2*x1+x2-5);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy