Index: /branches/SimplifierViewsProgress/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs
===================================================================
--- /branches/SimplifierViewsProgress/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs	(revision 15352)
+++ /branches/SimplifierViewsProgress/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs	(revision 15353)
@@ -371,5 +371,6 @@
         contentViews = contentViews.Where(v => v.Content == content);
 
-      var progress = new Progress(progressMessage, ProgressState.Started, progressValue);
+      var progress = new Progress();
+      progress.Start(progressMessage, progressValue);
       foreach (var contentView in contentViews) {
         progressViews.Add(new ProgressView(contentView, progress));
@@ -384,5 +385,6 @@
     /// </summary>
     public IProgress AddOperationProgressToView(Control control, string progressMessage) {
-      var progress = new Progress(progressMessage, ProgressState.Started);
+      var progress = new Progress();
+      progress.Start(progressMessage);
       AddOperationProgressToView(control, progress);
       return progress;
Index: /branches/SimplifierViewsProgress/HeuristicLab.MainForm/3.3/Interfaces/IProgress.cs
===================================================================
--- /branches/SimplifierViewsProgress/HeuristicLab.MainForm/3.3/Interfaces/IProgress.cs	(revision 15352)
+++ /branches/SimplifierViewsProgress/HeuristicLab.MainForm/3.3/Interfaces/IProgress.cs	(revision 15353)
@@ -63,5 +63,7 @@
     /// Starts or restarts a Progress. 
     /// </summary>
-    void Start(string status = null, double progressValue = -1.0);
+    void Start();
+    void Start(string status);
+    void Start(string status, double progressValue);
 
     /// <summary>
Index: /branches/SimplifierViewsProgress/HeuristicLab.MainForm/3.3/Progress.cs
===================================================================
--- /branches/SimplifierViewsProgress/HeuristicLab.MainForm/3.3/Progress.cs	(revision 15352)
+++ /branches/SimplifierViewsProgress/HeuristicLab.MainForm/3.3/Progress.cs	(revision 15353)
@@ -68,9 +68,7 @@
     }
 
-    public Progress(string status = null, ProgressState state = ProgressState.Finished, double progressValue = -1)
-      : base() {
-      this.status = status;
-      this.progressState = state;
-      this.progressValue = progressValue;
+    public Progress() {
+      progressState = ProgressState.Finished;
+      canBeCanceled = false;
     }
 
@@ -85,7 +83,13 @@
     }
 
-    public void Start(string status = null, double progressValue = -1.0) {
+    public void Start() {
+      Start(string.Empty);
+    }
+    public void Start(string status) {
+      Start(status, -1.0);
+    }
+    public void Start(string status, double progressValue) {
       ProgressState = ProgressState.Started;
-      Status = status;
+      Status = status ?? string.Empty;
       ProgressValue = progressValue;
     }
Index: /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicClassificationSolutionSimplifierViewBase.cs
===================================================================
--- /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicClassificationSolutionSimplifierViewBase.cs	(revision 15352)
+++ /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicClassificationSolutionSimplifierViewBase.cs	(revision 15353)
@@ -20,5 +20,4 @@
 #endregion
 
-using System;
 using HeuristicLab.Common;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
@@ -27,6 +26,4 @@
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views {
   public abstract partial class InteractiveSymbolicClassificationSolutionSimplifierViewBase : InteractiveSymbolicDataAnalysisSolutionSimplifierView {
-    private readonly SymbolicClassificationSolutionImpactValuesCalculator calculator;
-
     public new ISymbolicClassificationSolution Content {
       get { return (ISymbolicClassificationSolution)base.Content; }
@@ -34,14 +31,8 @@
     }
 
-    protected override ISymbolicDataAnalysisSolutionImpactValuesCalculator ImpactCalculator {
-      get { return calculator; }
-    }
-
-    public InteractiveSymbolicClassificationSolutionSimplifierViewBase()
-      : base() {
+    protected InteractiveSymbolicClassificationSolutionSimplifierViewBase()
+      : base(new SymbolicClassificationSolutionImpactValuesCalculator()) {
       InitializeComponent();
       this.Caption = "Interactive Classification Solution Simplifier";
-
-      calculator = new SymbolicClassificationSolutionImpactValuesCalculator();
     }
 
@@ -61,8 +52,4 @@
       return model;
     }
-
-    protected override void btnOptimizeConstants_Click(object sender, EventArgs e) {
-
-    }
   }
 }
Index: /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs
===================================================================
--- /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs	(revision 15352)
+++ /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs	(revision 15353)
@@ -21,12 +21,10 @@
 
 using System;
-using System.Threading.Tasks;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.MainForm;
 using HeuristicLab.Problems.DataAnalysis.Symbolic.Views;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views {
   public partial class InteractiveSymbolicRegressionSolutionSimplifierView : InteractiveSymbolicDataAnalysisSolutionSimplifierView {
-    private readonly SymbolicRegressionSolutionImpactValuesCalculator calculator;
-
     public new SymbolicRegressionSolution Content {
       get { return (SymbolicRegressionSolution)base.Content; }
@@ -34,13 +32,8 @@
     }
 
-    protected override ISymbolicDataAnalysisSolutionImpactValuesCalculator ImpactCalculator {
-      get { return calculator; }
-    }
-
     public InteractiveSymbolicRegressionSolutionSimplifierView()
-      : base() {
+      : base(new SymbolicRegressionSolutionImpactValuesCalculator()) {
       InitializeComponent();
       this.Caption = "Interactive Regression Solution Simplifier";
-      calculator = new SymbolicRegressionSolutionImpactValuesCalculator();
     }
 
@@ -51,16 +44,15 @@
     }
 
-    protected override async void btnOptimizeConstants_Click(object sender, EventArgs e) {
+    protected override ISymbolicExpressionTree OptimizeConstants(ISymbolicDataAnalysisModel model, IDataAnalysisProblemData problemData, IProgress progress) {
       const int constOptIterations = 50;
-      var model = Content.Model;
-      Progress.Start("Optimizing Constants ...", 0);
-      await Task.Run(() => {
-        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(model.Interpreter, model.SymbolicExpressionTree, Content.ProblemData, Content.ProblemData.TrainingIndices,
-          applyLinearScaling: true, maxIterations: constOptIterations, updateVariableWeights: true, lowerEstimationLimit: model.LowerEstimationLimit, upperEstimationLimit: model.UpperEstimationLimit,
-          iterationReport: (args, func, iter) => {
-            Progress.ProgressValue = (double)iter / (constOptIterations + 1); // (maxIterations + 1) iterations are reported
-          });
-      });
-      UpdateModel(Content.Model.SymbolicExpressionTree); // UpdateModel calls Progress.Finish
+      var regressionModelModel = (ISymbolicDataAnalysisModel)model.Clone();
+      var regressionProblemData = (IRegressionProblemData)problemData;
+      SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(regressionModelModel.Interpreter, regressionModelModel.SymbolicExpressionTree, regressionProblemData, regressionProblemData.TrainingIndices,
+        applyLinearScaling: true, maxIterations: constOptIterations, updateVariableWeights: true, lowerEstimationLimit: regressionModelModel.LowerEstimationLimit, upperEstimationLimit: regressionModelModel.UpperEstimationLimit,
+        iterationCallback: (args, func, obj) => {
+          // (maxIterations + 2) iterations are reported; Math.Min neccecary because of floating-point inaccuracies
+          progress.ProgressValue = Math.Min(progress.ProgressValue + 1.0 / (constOptIterations + 2), 1);
+        });
+      return model.SymbolicExpressionTree;
     }
   }
Index: /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
===================================================================
--- /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs	(revision 15352)
+++ /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs	(revision 15353)
@@ -156,5 +156,5 @@
       int maxIterations, bool updateVariableWeights = true,
       double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue,
-      bool updateConstantsInTree = true, Action<double[], double, int> iterationReport = null) {
+      bool updateConstantsInTree = true, Action<double[], double, object> iterationCallback = null) {
 
       // numeric constants in the tree become variables for constant opt
@@ -210,14 +210,12 @@
       alglib.ndimensional_pfunc function_cx_1_func = CreatePFunc(func);
       alglib.ndimensional_pgrad function_cx_1_grad = CreatePGrad(func_grad);
-
-      int i = 0;
-      var xrep = new alglib.ndimensional_rep((a, f, o) => {
-        if (iterationReport != null) iterationReport(a, f, i++);
-      });
+      alglib.ndimensional_rep xrep = null;
+      if (iterationCallback != null)
+        xrep = new alglib.ndimensional_rep(iterationCallback);
 
       try {
         alglib.lsfitcreatefg(x, y, c, n, m, k, false, out state);
         alglib.lsfitsetcond(state, 0.0, 0.0, maxIterations);
-        alglib.lsfitsetxrep(state, iterationReport != null);
+        alglib.lsfitsetxrep(state, iterationCallback != null);
         //alglib.lsfitsetgradientcheck(state, 0.001);
         alglib.lsfitfit(state, function_cx_1_func, function_cx_1_grad, xrep, null);
Index: /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs
===================================================================
--- /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs	(revision 15352)
+++ /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs	(revision 15353)
@@ -20,5 +20,4 @@
 #endregion
 
-using System;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
@@ -27,6 +26,4 @@
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views {
   public partial class InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView : InteractiveSymbolicDataAnalysisSolutionSimplifierView {
-    private readonly SymbolicRegressionSolutionImpactValuesCalculator calculator;
-
     public new SymbolicTimeSeriesPrognosisSolution Content {
       get { return (SymbolicTimeSeriesPrognosisSolution)base.Content; }
@@ -34,13 +31,8 @@
     }
 
-    protected override ISymbolicDataAnalysisSolutionImpactValuesCalculator ImpactCalculator {
-      get { return calculator; }
-    }
-
     public InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView()
-      : base() {
+      : base(new SymbolicRegressionSolutionImpactValuesCalculator()) {
       InitializeComponent();
       this.Caption = "Interactive Time-Series Prognosis Solution Simplifier";
-      calculator = new SymbolicRegressionSolutionImpactValuesCalculator();
     }
 
@@ -50,8 +42,4 @@
       Content.Model = model;
     }
-
-    protected override void btnOptimizeConstants_Click(object sender, EventArgs e) {
-
-    }
   }
 }
Index: /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
===================================================================
--- /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs	(revision 15352)
+++ /branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs	(revision 15353)
@@ -38,10 +38,12 @@
     private Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts;
 
-    protected IProgress Progress = new Progress();
+    private readonly ISymbolicDataAnalysisSolutionImpactValuesCalculator impactCalculator;
+
+    private readonly IProgress progress = new Progress();
 
     private enum TreeState { Valid, Invalid }
     private TreeState treeState;
 
-    protected InteractiveSymbolicDataAnalysisSolutionSimplifierView() {
+    protected InteractiveSymbolicDataAnalysisSolutionSimplifierView(ISymbolicDataAnalysisSolutionImpactValuesCalculator impactCalculator) {
       InitializeComponent();
       foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
@@ -49,4 +51,5 @@
       nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>();
       this.Caption = "Interactive Solution Simplifier";
+      this.impactCalculator = impactCalculator;
 
       // initialize the tree modifier that will be used to perform edit operations over the tree
@@ -149,5 +152,5 @@
       Content.ProblemDataChanged += Content_Changed;
       treeChart.Repainted += treeChart_Repainted;
-      MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(grpSimplify, Progress);
+      MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(grpSimplify, progress);
     }
     protected override void DeregisterContentEvents() {
@@ -180,5 +183,5 @@
       treeChart.Tree = tree.Root.SubtreeCount > 1 ? new SymbolicExpressionTree(tree.Root) : new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0));
 
-      Progress.Start("Calculate Impact and Replacement Values ...", 0);
+      progress.Start("Calculate Impact and Replacement Values ...", 0);
       var impactAndReplacementValues = await Task.Run(() => CalculateImpactAndReplacementValues(tree));
       var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2);
@@ -187,5 +190,5 @@
       }
       nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1);
-      Progress.Finish();
+      progress.Finish();
       PaintNodeImpacts();
     }
@@ -195,6 +198,6 @@
       foreach (var node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) {
         double impactValue, replacementValue, newQualityForImpactsCalculation;
-        ImpactCalculator.CalculateImpactAndReplacementValues(Content.Model, node, Content.ProblemData, Content.ProblemData.TrainingIndices, out impactValue, out replacementValue, out newQualityForImpactsCalculation);
-        Progress.ProgressValue += 1.0 / (tree.Length - 2);
+        impactCalculator.CalculateImpactAndReplacementValues(Content.Model, node, Content.ProblemData, Content.ProblemData.TrainingIndices, out impactValue, out replacementValue, out newQualityForImpactsCalculation);
+        progress.ProgressValue += 1.0 / (tree.Length - 2);
         impactAndReplacementValues.Add(node, new Tuple<double, double>(impactValue, replacementValue));
       }
@@ -204,5 +207,7 @@
     protected abstract void UpdateModel(ISymbolicExpressionTree tree);
 
-    protected abstract ISymbolicDataAnalysisSolutionImpactValuesCalculator ImpactCalculator { get; }
+    protected virtual ISymbolicExpressionTree OptimizeConstants(ISymbolicDataAnalysisModel model, IDataAnalysisProblemData problemData, IProgress progress) {
+      return model.SymbolicExpressionTree;
+    }
 
     private static ConstantTreeNode MakeConstantTreeNode(double value) {
@@ -290,5 +295,9 @@
     }
 
-    protected abstract void btnOptimizeConstants_Click(object sender, EventArgs e);
+    private async void btnOptimizeConstants_Click(object sender, EventArgs e) {
+      progress.Start("Optimizing Constants ...", 0);
+      var newTree = await Task.Run(() => OptimizeConstants(Content.Model, Content.ProblemData, progress));
+      UpdateModel(newTree); // UpdateModel calls Progress.Finish (via Content_Changed)
+    }
   }
 }
