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

net.sourceforge.cilib.functions.continuous.unconstrained.Spherical Maven / Gradle / Ivy

Go to download

A library of composable components enabling simpler Computational Intelligence

There is a newer version: 0.8
Show newest version
/**           __  __
 *    _____ _/ /_/ /_    Computational Intelligence Library (CIlib)
 *   / ___/ / / / __ \   (c) CIRG @ UP
 *  / /__/ / / / /_/ /   http://cilib.net
 *  \___/_/_/_/_.___/
 */
package net.sourceforge.cilib.functions.continuous.unconstrained;

import fj.F;
import net.sourceforge.cilib.functions.ContinuousFunction;
import net.sourceforge.cilib.functions.Differentiable;
import net.sourceforge.cilib.type.types.Numeric;
import net.sourceforge.cilib.type.types.Real;
import net.sourceforge.cilib.type.types.container.Vector;

/**
 * 

Spherical function.

* *

Reference: X. Yao, Y. Liu, G. Liu, Evolutionary Programming * Made Faster, IEEE Transactions on Evolutionary Computation, * 3(2):82--102, 1999

* *

* Characteristics: *

    *
  • Unimodal
  • *
  • Continuous
  • *
  • Separable
  • *
  • Regular
  • *
  • Convex
  • *
*

* * f(x) = 0; x = (0,0,...,0) * x e [-5.12, 5.12] * * R(-5.12, 5.12)^30 * */ public class Spherical implements ContinuousFunction, Differentiable { private static final long serialVersionUID = 5811377575647995206L; /** * {@inheritDoc} */ @Override public Double apply(Vector input) { return input.foldLeft(0.0, new F() { @Override public Double f(Numeric x) { return x.doubleValue() * x.doubleValue(); } }); } /** * {@inheritDoc} */ @Override public Vector getGradient(Vector x) { return x.map(new F() { @Override public Numeric f(Numeric x) { return Real.valueOf(x.doubleValue() * 2); } }); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy