net.sourceforge.cilib.pso.pbestupdate.BoundedDominantPersonalBestUpdateStrategy Maven / Gradle / Ivy
/** __ __
* _____ _/ /_/ /_ Computational Intelligence Library (CIlib)
* / ___/ / / / __ \ (c) CIRG @ UP
* / /__/ / / / /_/ / http://cilib.net
* \___/_/_/_/_.___/
*/
package net.sourceforge.cilib.pso.pbestupdate;
import net.sourceforge.cilib.entity.EntityType;
import net.sourceforge.cilib.pso.particle.Particle;
import net.sourceforge.cilib.problem.solution.InferiorFitness;
import net.sourceforge.cilib.type.types.Types;
/**
* Implementation of {@link PersonalBestUpdateStrategy} where a
* {@link Particle}'s guide can get updated if the new guide is not dominated by
* the current guide, i.e. both of the guides are non-dominated. If both guides
* are non-dominated the new guide is selected.
*/
public class BoundedDominantPersonalBestUpdateStrategy extends DominantPersonalBestUpdateStrategy {
/**
* {@inheritDoc}
*/
@Override
public PersonalBestUpdateStrategy getClone() {
return this;
}
/**
* {@inheritDoc}
*/
@Override
public void updatePersonalBest(Particle particle) {
if (!Types.isInsideBounds(particle.getPosition())) {
particle.getProperties().put(EntityType.FITNESS, InferiorFitness.instance());
return;
}
super.updatePersonalBest(particle);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy