Optional plotting as post process parameter.
This commit is contained in:
		@@ -31,4 +31,7 @@ public interface InterfacePostProcessParams {
 | 
			
		||||
	public void setPPMethod(PostProcessMethod meth);
 | 
			
		||||
	public PostProcessMethod getPPMethod();
 | 
			
		||||
	public String PPMethodTipText();
 | 
			
		||||
	
 | 
			
		||||
	public boolean isWithPlot();
 | 
			
		||||
	public void setWithPlot(boolean withPlot);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,6 @@ import eva2.tools.Pair;
 | 
			
		||||
public class PostProcess {
 | 
			
		||||
	protected static InterfaceDistanceMetric metric = new PhenotypeMetric();
 | 
			
		||||
	private static final boolean TRACE = false;
 | 
			
		||||
	private static final boolean DRAW_PPPOP = true;
 | 
			
		||||
	
 | 
			
		||||
	// the default mutation step size for HC post processing
 | 
			
		||||
	private static double defaultMutationStepSize = 0.01;
 | 
			
		||||
@@ -888,8 +887,8 @@ public class PostProcess {
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if (listener != null) listener.println("Post processing: " + stepsDone + " steps done.");
 | 
			
		||||
				if (DRAW_PPPOP) {
 | 
			
		||||
					plot = draw("After " + stepsDone + " steps", null, stateBeforeLS, clusteredPop, problem);
 | 
			
		||||
				if (params.isWithPlot()) {
 | 
			
		||||
					plot = draw("After " + stepsDone + " steps ("+ params.getPPMethod() + ")", null, stateBeforeLS, clusteredPop, problem);
 | 
			
		||||
				}
 | 
			
		||||
				// some individuals may have now converged again
 | 
			
		||||
				if (params.getPostProcessClusterSigma() > 0) {
 | 
			
		||||
@@ -901,8 +900,8 @@ public class PostProcess {
 | 
			
		||||
				} else outputPop = clusteredPop;
 | 
			
		||||
			} else outputPop = clusteredPop;
 | 
			
		||||
			
 | 
			
		||||
			if (DRAW_PPPOP) {
 | 
			
		||||
				plot = draw("After " + stepsDone + " steps" + ((params.getPostProcessClusterSigma()>0) ? " and second clustering" : ""), null, outputPop, null, problem);
 | 
			
		||||
			if (params.isWithPlot()) {
 | 
			
		||||
				plot = draw("After " + stepsDone + " steps (" + params.getPPMethod() + ")" + ((params.getPostProcessClusterSigma()>0) ? " and second clustering" : ""), null, outputPop, null, problem);
 | 
			
		||||
			}
 | 
			
		||||
			double upBnd = PhenotypeMetric.norm(outputPop.getWorstEAIndividual().getFitness())*1.1;
 | 
			
		||||
			upBnd = Math.pow(10,Math.floor(Math.log10(upBnd)+1));
 | 
			
		||||
 
 | 
			
		||||
@@ -13,6 +13,7 @@ public class PostProcessParams implements InterfacePostProcessParams, Serializab
 | 
			
		||||
	protected double 			postProcessClusterSigma = 0.05;
 | 
			
		||||
	protected int				printNBest = 10;
 | 
			
		||||
	protected PostProcessMethod	method = PostProcessMethod.nelderMead;
 | 
			
		||||
	private boolean 			withPlot = false;
 | 
			
		||||
	
 | 
			
		||||
	public PostProcessParams() {
 | 
			
		||||
		postProcessSteps = 5000;
 | 
			
		||||
@@ -65,6 +66,7 @@ public class PostProcessParams implements InterfacePostProcessParams, Serializab
 | 
			
		||||
		GenericObjectEditor.setShowProperty(this.getClass(), "postProcessClusterSigma", postProcess);
 | 
			
		||||
		GenericObjectEditor.setShowProperty(this.getClass(), "printNBest", postProcess);
 | 
			
		||||
		GenericObjectEditor.setShowProperty(this.getClass(), "PPMethod", postProcess);
 | 
			
		||||
		GenericObjectEditor.setShowProperty(this.getClass(), "withPlot", postProcess);
 | 
			
		||||
	}
 | 
			
		||||
	public String doPostProcessingTipText() {
 | 
			
		||||
		return "Toggle post processing of the solutions.";
 | 
			
		||||
@@ -125,4 +127,12 @@ public class PostProcessParams implements InterfacePostProcessParams, Serializab
 | 
			
		||||
	public void setPPMethod(PostProcessMethod meth) {
 | 
			
		||||
		method=meth;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public boolean isWithPlot() {
 | 
			
		||||
		return withPlot;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setWithPlot(boolean withPlot) {
 | 
			
		||||
		this.withPlot = withPlot;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user