All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.cilib.functions.continuous.unconstrained.Griewank 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;

/**
 * Generalised Griewank function.
 *
 * 

* Characteristics: *

    *
  • Multi-modal
  • *
  • Non-separable
  • *
  • Regular
  • *
* * f(x) = 0; x = (0,0,...,0); * x_i e (-600,600) * * R(-600, 600)^30 * */ public class Griewank extends ContinuousFunction { private static final long serialVersionUID = 1095225532651577254L; /** * {@inheritDoc} */ @Override public Double f(Vector input) { double sumsq = 0; double prod = 1; for (int i = 0; i < input.size(); ++i) { sumsq += input.doubleValueOf(i) * input.doubleValueOf(i); prod *= Math.cos(input.doubleValueOf(i) / Math.sqrt(i + 1)); } return 1 + sumsq * (1.0 / 4000.0) - prod; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy