![JAR search and dependency download from the Maven repository](/logo.png)
net.sourceforge.cilib.ff.iterationstrategies.StandardFireflyIterationStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cilib-library Show documentation
Show all versions of cilib-library Show documentation
A library of composable components enabling simpler Computational Intelligence
/** __ __
* _____ _/ /_/ /_ 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:
*
* - For each Fireflyi
*
* - For each other Fireflyj
-
*
* - If Intensityj > Intensityi
*
* - Move Fireflyi toward Fireflyj
* according to Attractivenessj
*
* - Evaluate fitness and intensity of Fireflyi
*
*
*
* @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