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

net.sourceforge.cilib.ff.iterationstrategies.StandardFireflyIterationStrategy 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.ff.iterationstrategies;


import net.sourceforge.cilib.algorithm.population.AbstractIterationStrategy;
import net.sourceforge.cilib.entity.Topology;
import net.sourceforge.cilib.ff.FFA;
import net.sourceforge.cilib.ff.firefly.Firefly;

/**
 * Implementation of the standard iteration strategy for the Firefly algorithm.
 */
public class StandardFireflyIterationStrategy extends AbstractIterationStrategy {

    /**
     * {@inheritDoc}
     */
    @Override
    public StandardFireflyIterationStrategy getClone() {
        return this;
    }

    /**
     * 

This is the standard Firefly iteration strategy:

*
    *
  1. For each Fireflyi
  2. *
      *
    1. For each other Fireflyj
    2. *
        *
      1. If Intensityj > Intensityi
      2. *
          *
        1. Move Fireflyi toward Fireflyj * according to Attractivenessj
        2. *
        *
      3. Evaluate fitness and intensity of Fireflyi
      4. *
      *
    *
* @param algorithm The algorithm to which an iteration is to be applied. */ @Override public void performIteration(FFA algorithm) { Topology topology = algorithm.getTopology(); for (Firefly current : topology) { for (Firefly other : topology) { if (other.isBrighter(current)) { current.updatePosition(other); boundaryConstraint.enforce(current); current.calculateFitness(); } } } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy