net.sourceforge.cilib.functions.continuous.unconstrained.Waves 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;
/**
* Waves Function.
*
* Global Minimum:
*
* - f(x,y) = 0
* - Many global minima where ever x = 0
*
*
*
* Characteristics:
*
* - Only defined for 2 dimensions
* - Multimodal
* - Non-Separable
* - One global optimum, and nine local optima
*
*
*
* R(-0.9,1.2), R(-1.2,1.2)
*
*/
public class Waves extends ContinuousFunction {
/**
* {@inheritDoc}
*/
@Override
public Double f(Vector input) {
Preconditions.checkArgument(input.size() == 2, "Waves function is only defined for 2 dimensions");
double x = input.doubleValueOf(0);
double y = input.doubleValueOf(1);
return -(Math.pow(0.3*x, 3)-(y*y-4.5*y*y)*x*y-4.7*Math.cos(3*x-y*y*(2+x))*Math.sin(2.5*Math.PI*x));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy