move flush
diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/NelderMeadAlgorithm.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/NelderMeadAlgorithm.java
index 3ce018a..dfaf715 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/NelderMeadAlgorithm.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/NelderMeadAlgorithm.java
@@ -412,6 +412,8 @@
 			if(AutomaticExperimentManager.QUIT_NOW) break;

 			*/

 		}

+		fn.getValue(start).copy();

+		fn.done();

 	}

 

 	private void limit(double []vals) {

diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexAlgorithmExecuter.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexAlgorithmExecuter.java
index e0964b8..6ca1359 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexAlgorithmExecuter.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexAlgorithmExecuter.java
@@ -264,7 +264,9 @@
 //				Activator.logInformation(" Error in validation data set is: " + result.getValidationError());

 				resultWriter.write(error+"");

 				resultWriter.write(LS);

-				resultWriter.flush();

+				

+				// after exp is done

+				// resultWriter.flush(); 

 				

 				// TODO: GUI output here

 				

@@ -334,6 +336,16 @@
 			simulation.simulationSleep = false;

 			return simulation;

 		}

+

+		@Override

+		public void done() {

+			try {

+				resultWriter.flush();

+			} catch(IOException ioe) {

+				ioe.printStackTrace();

+			}

+			

+		}

 	}

 }

 

diff --git a/org.eclipse.stem/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexFunction.java b/org.eclipse.stem/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexFunction.java
index 6651274..55cf153 100644
--- a/org.eclipse.stem/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexFunction.java
+++ b/org.eclipse.stem/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexFunction.java
@@ -18,4 +18,5 @@
 

 public interface SimplexFunction {

 	public ErrorResult getValue(double[] parameters); 

+	public void done();

 }