Updating clustering HC

This commit is contained in:
Marcel Kronfeld 2011-05-04 11:47:39 +00:00
parent c95d68941a
commit 886d3fd0e4

View File

@ -33,7 +33,8 @@ import eva2.tools.Pair;
* @author mkron * @author mkron
* *
*/ */
public class ClusteringHillClimbing implements InterfacePopulationChangedEventListener, InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { public class ClusteringHillClimbing implements InterfacePopulationChangedEventListener,
InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer {
transient private InterfacePopulationChangedEventListener m_Listener; transient private InterfacePopulationChangedEventListener m_Listener;
public static final boolean TRACE = false; public static final boolean TRACE = false;
@ -60,6 +61,12 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
hideHideable(); hideHideable();
} }
public ClusteringHillClimbing(int initialPopSize, PostProcessMethod lsMethod) {
this();
setInitialPopSize(initialPopSize);
setLocalSearchMethod(lsMethod);
}
public ClusteringHillClimbing(ClusteringHillClimbing other) { public ClusteringHillClimbing(ClusteringHillClimbing other) {
hideHideable(); hideHideable();
m_Population = (Population)other.m_Population.clone(); m_Population = (Population)other.m_Population.clone();
@ -270,7 +277,7 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
public void freeWilly() {} public void freeWilly() {}
public String getName() { public String getName() {
return "Clustering-HC"; return "ClustHC-"+initialPopSize+"-"+localSearchMethod;
} }
public static String globalInfo() { public static String globalInfo() {
@ -419,15 +426,15 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
} }
public String[] getAdditionalDataHeader() { public String[] getAdditionalDataHeader() {
return new String[]{"numIndies"}; return new String[]{"numIndies", "sigma", "numArchived", "archivedMeanDist"};
} }
public String[] getAdditionalDataInfo() { public String[] getAdditionalDataInfo() {
return new String[]{"The current population size"}; return new String[]{"The current population size", "Current step size in case of stochastic HC", "Number of archived solutions", "Mean distance of archived solutions"};
} }
public Object[] getAdditionalDataValue(PopulationInterface pop) { public Object[] getAdditionalDataValue(PopulationInterface pop) {
return new Object[]{m_Population.size()}; return new Object[]{m_Population.size(), mutator.getSigma(), archive.size(), archive.getPopulationMeasures()[0]};
} }
public boolean isDoReinitialization() { public boolean isDoReinitialization() {