net.sourceforge.cilib.functions.continuous.unconstrained.Easom 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;
/**
* Easom function as taken from
* www-optima.amp.i.kyoto-u.ac.jp/member/student/hedar/Hedar_files/TestGO_files
*
* Minimum:
*
* - ƒ(x*) = -1.0
* - x* = (Pi, Pi)
* - for xi in [-100, 100]
*
*
*
* Characteristics:
*
* - Only defined for 2 dimensions
* - Multimodal
* - Not separable
* - Regular
*
*
*
* R(-100, 100)^2
*
*/
public class Easom extends ContinuousFunction {
private static final long serialVersionUID = 7173528343222997045L;
/**
* {@inheritDoc}
*/
@Override
public Double f(Vector input) {
Preconditions.checkArgument(input.size() == 2, "Easom function is only defined for 2 dimensions");
double powerTerm1 = -((input.doubleValueOf(0)-Math.PI)*(input.doubleValueOf(0)-Math.PI));
double powerTerm2 = -((input.doubleValueOf(1)-Math.PI)*(input.doubleValueOf(1)-Math.PI));
double power = powerTerm1 + powerTerm2;
return -Math.cos(input.doubleValueOf(0)) * Math.cos(input.doubleValueOf(1)) * Math.exp(power);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy