net.sourceforge.cilib.functions.continuous.unconstrained.Central2PeakTrap 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;
/**
* The Central Two-Peak Trap Function.
*
* Global Minimum:
*
* - f(x*) = -200
* - x* = 20
* - for x_i in [0, 20]
*
*
* Local Minimum:
*
* - f(x*) = -160
* - x* = 10
* - for x_i in [0, 20]
*
*
*
* Characteristics:
*
* - One-dimensional only
* - Multimodal
* - Seperable
* - One global minimum on the boundary, and a local minimum that may trap algorithms
*
*
*
* R(0,20)^1
*
*/
public class Central2PeakTrap extends ContinuousFunction {
/**
* {@inheritDoc}
*/
@Override
public Double f(Vector input) {
Preconditions.checkArgument(input.size() == 1, "Central2PeakTrap function is only defined for 1 dimension");
double x = input.doubleValueOf(0);
if (x < 0)
return 0.0;
else if (x<=10)
return -160/10*x;
else if (x <= 15)
return -160/5*(15-x);
else if (x <= 20)
return -200/5*(x-15);
else
return -200.0;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy