net.sourceforge.cilib.functions.continuous.unconstrained.Bohachevsky3 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;
/**
* Bohachevsky 3.
*
* Reference: Global Optimization Meta-Heuristics Website,
* http://www-optima.amp.i.kyoto-u.ac.jp/member/student/hedar/Hedar_files/go.htm
*
* Minimum:
*
* - ƒ(x*) = 0
* - x* = (0, 0)
* - for x1, x2 in [-100, 100]
*
*
*
* Characteristics:
*
* - Only defined for 2 dimensions
* - Unimodal
* - Seperable
* - Regular
*
*
*
* R(-100, 100)^2
*
*/
public class Bohachevsky3 extends ContinuousFunction {
private static final long serialVersionUID = -1572998736995724677L;
/**
* {@inheritDoc}
*/
@Override
public Double f(Vector input) {
Preconditions.checkArgument(input.size() == 2, "Bohachevsky 3 function is only defined for 2 dimensions");
double x = input.doubleValueOf(0);
double y = input.doubleValueOf(1);
return x*x + 2*y*y - 0.3*Math.cos(3*Math.PI*x + 4*Math.PI*y)+0.3;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy