![JAR search and dependency download from the Maven repository](/logo.png)
net.sourceforge.cilib.niching.merging.detection.DiversityBasedMergeDetection 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.niching.merging.detection;
import net.sourceforge.cilib.algorithm.population.PopulationBasedAlgorithm;
import net.sourceforge.cilib.controlparameter.ConstantControlParameter;
import net.sourceforge.cilib.controlparameter.ControlParameter;
import net.sourceforge.cilib.measurement.single.diversity.Diversity;
import net.sourceforge.cilib.measurement.single.diversity.centerinitialisationstrategies.GBestCenterInitialisationStrategy;
public class DiversityBasedMergeDetection extends MergeDetection {
private Diversity diversityMeasure;
private ControlParameter threshold;
/**
* Default constructor.
*/
public DiversityBasedMergeDetection() {
this.threshold = ConstantControlParameter.of(0.1);
this.diversityMeasure = new Diversity();
this.diversityMeasure.setPopulationCenter(new GBestCenterInitialisationStrategy());
}
/**
* Determines if two swarms should be merged based on whether they overlap and
* if the diversity of the first swarm is below a threshold.
* @param a
* @param b
* @return
*/
@Override
public Boolean f(PopulationBasedAlgorithm a, PopulationBasedAlgorithm b) {
return diversityMeasure.getValue(a).doubleValue() < threshold.getParameter();
}
public Diversity getDiversityMeasure() {
return diversityMeasure;
}
public void setDiversityMeasure(Diversity diversityMeasure) {
this.diversityMeasure = diversityMeasure;
}
public ControlParameter getThreshold() {
return threshold;
}
public void setThreshold(ControlParameter threshold) {
this.threshold = threshold;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy