Addition to statistics interface.
This commit is contained in:
parent
170c92046d
commit
7d7dcb5ce0
@ -262,6 +262,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
||||
resultPop = goParams.getOptimizer().getAllSolutions().getSolutions();
|
||||
}
|
||||
} else resultPop = goParams.getOptimizer().getAllSolutions().getSolutions();
|
||||
m_Statistics.postProcessingPerformed(resultPop);
|
||||
|
||||
}
|
||||
setOptRunning(false); // normal finish
|
||||
|
@ -127,7 +127,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
if (dataListeners==null) {
|
||||
dataListeners=new LinkedList<InterfaceStatisticsListener>();
|
||||
}
|
||||
if (!dataListeners.contains(l)) dataListeners.add(l);
|
||||
if (l!=null && !dataListeners.contains(l)) dataListeners.add(l);
|
||||
}
|
||||
|
||||
public boolean removeDataListener(InterfaceStatisticsListener l) {
|
||||
@ -349,15 +349,28 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
if (finalObjectData==null) finalObjectData = new ArrayList<Object[]>();
|
||||
finalObjectData.add(currentStatObjectData);
|
||||
|
||||
if (printFinalVerbosity()) printToTextListener(".");
|
||||
if (!printRunStoppedVerbosity() && printFinalVerbosity()) printToTextListener(".");
|
||||
// if (currentBestFit!= null) {
|
||||
// if (printRunStoppedVerbosity()) printToTextListener(" Best Fitness: " + BeanInspector.toString(currentBestFit) + "\n");
|
||||
// }
|
||||
|
||||
fireDataListenersStartStop(optRunsPerformed, normal, false);
|
||||
}
|
||||
|
||||
public void postProcessingPerformed(Population resultPop) { // called from processor
|
||||
if (!printRunStoppedVerbosity() && printFinalVerbosity() && optRunsPerformed >= m_StatsParams.getMultiRuns()) printToTextListener("\n");
|
||||
if (printRunStoppedVerbosity()) {
|
||||
if (resultPop!=null && (resultPop.size()>0)) {
|
||||
printToTextListener("Resulting population: \n");
|
||||
for (int i=0; i<resultPop.size(); i++) {
|
||||
printToTextListener(AbstractEAIndividual.getDefaultStringRepresentation(resultPop.getEAIndividual(i)));
|
||||
printToTextListener("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (optRunsPerformed >= m_StatsParams.getMultiRuns()) {
|
||||
if (printFinalVerbosity()) printToTextListener("\n");
|
||||
finalizeOutput();
|
||||
}
|
||||
fireDataListenersStartStop(optRunsPerformed, normal, false);
|
||||
}
|
||||
|
||||
private PopulationInterface makeStatsPop() {
|
||||
|
@ -16,6 +16,7 @@ import java.util.List;
|
||||
|
||||
import eva2.server.go.IndividualInterface;
|
||||
import eva2.server.go.PopulationInterface;
|
||||
import eva2.server.go.populations.Population;
|
||||
import eva2.server.go.problems.InterfaceAdditionalPopulationInformer;
|
||||
import eva2.server.go.strategies.InterfaceOptimizer;
|
||||
/*==========================================================================*
|
||||
@ -44,4 +45,5 @@ public interface InterfaceStatistics {
|
||||
public IndividualInterface getRunBestSolution(); // return the best fitness of the last run (may not be equal to the last population)
|
||||
public IndividualInterface getBestSolution(); // returns the best overall solution
|
||||
public double[] getBestFitness(); // returns the best overall fitness
|
||||
public void postProcessingPerformed(Population resultPop); // called from processor
|
||||
}
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import eva2.server.go.IndividualInterface;
|
||||
import eva2.server.go.PopulationInterface;
|
||||
import eva2.server.go.individuals.AbstractEAIndividual;
|
||||
import eva2.server.go.populations.Population;
|
||||
import eva2.server.go.problems.InterfaceAdditionalPopulationInformer;
|
||||
import eva2.server.go.strategies.InterfaceOptimizer;
|
||||
|
||||
@ -85,6 +86,7 @@ public class StatisticsDummy implements InterfaceStatistics, InterfaceTextListen
|
||||
}
|
||||
|
||||
public void stopOptPerformed(boolean normal, String stopMessage) {}
|
||||
public void postProcessingPerformed(Population resultPop) {}
|
||||
|
||||
public void print(String str) {
|
||||
if (consoleOut) System.out.print(str);
|
||||
|
Loading…
x
Reference in New Issue
Block a user