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

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

/**
 * Modified Schaffer Function 4.
 *
 * 

* Characteristics: *

    *
  • Multi-modal
  • *
  • Non-Seperable
  • *
  • Not Regular
  • *
*

* *

* Reference: * @article{ * mishra-some, * title={{Some new test functions for global optimization and performance of repulsive particle swarm method}}, * author={Mishra, S.K. and Campus, N.} * } *

*/ public class ModifiedSchaffer4 extends ContinuousFunction { /** * {@inheritDoc} */ @Override public Double f(Vector input) { double sum = 0.0; double square1, square2, numerator, denominator; for (int j = 0; j < input.size() - 1; j++) { square1 = input.doubleValueOf(j) * input.doubleValueOf(j); square2 = input.doubleValueOf(j + 1) * input.doubleValueOf(j + 1); numerator = Math.pow(Math.cos(Math.sin(Math.abs(square1 - square2))), 2) - 0.5; denominator = Math.pow((1 + 0.001 * (square1 + square2)), 2); sum += 0.5 + (numerator / denominator); } return new Double(sum); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy