net.sourceforge.cilib.pso.dynamic.responsestrategies.ReinitialisationReevaluationReactionStrategy 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
The newest version!
/** __ __
* _____ _/ /_/ /_ Computational Intelligence Library (CIlib)
* / ___/ / / / __ \ (c) CIRG @ UP
* / /__/ / / / /_/ / http://cilib.net
* \___/_/_/_/_.___/
*/
package net.sourceforge.cilib.pso.dynamic.responsestrategies;
import fj.data.List;
import net.sourceforge.cilib.algorithm.population.SinglePopulationBasedAlgorithm;
import net.sourceforge.cilib.entity.*;
import net.sourceforge.cilib.pso.particle.Particle;
/**
* This reaction strategy reinitialises the specified
* {@code ratio} of randomly chosen entities in the given {@link Topology}.
*
* @param some {@link PopulationBasedAlgorithm}
*/
public class ReinitialisationReevaluationReactionStrategy extends ReinitialisationReactionStrategy {
public ReinitialisationReevaluationReactionStrategy() {
super();
}
public ReinitialisationReevaluationReactionStrategy(ReinitialisationReactionStrategy rhs) {
super(rhs);
}
@Override
public ReinitialisationReevaluationReactionStrategy getClone() {
return new ReinitialisationReevaluationReactionStrategy(this);
}
/**
* Reinitialise the {@link Entity entities} inside the topology.
*
* {@inheritDoc}
*/
@Override
public > void performReaction(A algorithm) {
List
entities = algorithm.getTopology();
int reinitializeCount = (int) Math.floor(reinitialisationRatio * entities.length());
reinitialise(entities, reinitializeCount);
//update the particles and neighbourhoodbest
algorithm.performIteration();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy