Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.Designer.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.Designer.cs	(revision 15697)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.Designer.cs	(revision 16692)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs	(revision 15697)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs	(revision 16692)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,16 +20,10 @@
 #endregion
 
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using HeuristicLab.Common;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
 using HeuristicLab.Problems.DataAnalysis.Symbolic.Views;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views {
   public partial class InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView : InteractiveSymbolicDataAnalysisSolutionSimplifierView {
-    private readonly ConstantTreeNode constantNode;
-    private readonly SymbolicExpressionTree tempTree;
-
     public new SymbolicTimeSeriesPrognosisSolution Content {
       get { return (SymbolicTimeSeriesPrognosisSolution)base.Content; }
@@ -38,99 +32,14 @@
 
     public InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView()
-      : base() {
+      : base(new SymbolicRegressionSolutionImpactValuesCalculator()) {
       InitializeComponent();
       this.Caption = "Interactive Time-Series Prognosis Solution Simplifier";
-
-      constantNode = ((ConstantTreeNode)new Constant().CreateTreeNode());
-      ISymbolicExpressionTreeNode root = new ProgramRootSymbol().CreateTreeNode();
-      ISymbolicExpressionTreeNode start = new StartSymbol().CreateTreeNode();
-      root.AddSubtree(start);
-      tempTree = new SymbolicExpressionTree(root);
-    }
-
-    protected override Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree) {
-      var interpreter = Content.Model.Interpreter;
-      var rows = Content.ProblemData.TrainingIndices;
-      var dataset = Content.ProblemData.Dataset;
-      var targetVariable = Content.ProblemData.TargetVariable;
-      var targetValues = dataset.GetDoubleValues(targetVariable, rows);
-      var originalOutput = interpreter.GetSymbolicExpressionTreeValues(tree, dataset, rows).ToArray();
-
-      var impactAndReplacementValues = new Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>>();
-      List<ISymbolicExpressionTreeNode> nodes = tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPostfix().ToList();
-      OnlineCalculatorError errorState;
-      double originalR = OnlinePearsonsRCalculator.Calculate(targetValues, originalOutput, out errorState);
-      if (errorState != OnlineCalculatorError.None) originalR = 0.0;
-
-      foreach (ISymbolicExpressionTreeNode node in nodes) {
-        var parent = node.Parent;
-        constantNode.Value = CalculateReplacementValue(node, tree);
-        ISymbolicExpressionTreeNode replacementNode = constantNode;
-        SwitchNode(parent, node, replacementNode);
-        var newOutput = interpreter.GetSymbolicExpressionTreeValues(tree, dataset, rows);
-        double newR = OnlinePearsonsRCalculator.Calculate(targetValues, newOutput, out errorState);
-        if (errorState != OnlineCalculatorError.None) newR = 0.0;
-
-        // impact = 0 if no change
-        // impact < 0 if new solution is better
-        // impact > 0 if new solution is worse
-        double impact = (originalR*originalR) - (newR*newR);
-        impactAndReplacementValues[node] = new Tuple<double, double>(impact, constantNode.Value);
-        SwitchNode(parent, replacementNode, node);
-      }
-      return impactAndReplacementValues;
     }
 
     protected override void UpdateModel(ISymbolicExpressionTree tree) {
-      var model = new SymbolicTimeSeriesPrognosisModel(tree, Content.Model.Interpreter);
+      var model = new SymbolicTimeSeriesPrognosisModel(Content.ProblemData.TargetVariable, tree, Content.Model.Interpreter);
       model.Scale(Content.ProblemData);
       Content.Model = model;
     }
-
-    protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) {
-      var replacementValues = new Dictionary<ISymbolicExpressionTreeNode, double>();
-      foreach (var componentBranch in tree.Root.GetSubtree(0).Subtrees)
-        foreach (ISymbolicExpressionTreeNode node in componentBranch.IterateNodesPrefix()) {
-          replacementValues[node] = CalculateReplacementValue(node, tree);
-        }
-      return replacementValues;
-    }
-
-    protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree) {
-      var impactAndReplacementValues = CalculateImpactAndReplacementValues(tree);
-      return impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1); // item1 of the tuple is the impact value
-    }
-
-    private double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree) {
-      // remove old ADFs
-      while (tempTree.Root.SubtreeCount > 1) tempTree.Root.RemoveSubtree(1);
-      // clone ADFs of source tree
-      for (int i = 1; i < sourceTree.Root.SubtreeCount; i++) {
-        tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone());
-      }
-      var start = tempTree.Root.GetSubtree(0);
-      while (start.SubtreeCount > 0) start.RemoveSubtree(0);
-      start.AddSubtree((ISymbolicExpressionTreeNode)node.Clone());
-      var interpreter = Content.Model.Interpreter;
-      var rows = Content.ProblemData.TrainingIndices;
-      var allPrognosedValues = interpreter.GetSymbolicExpressionTreeValues(tempTree, Content.ProblemData.Dataset, rows);
-
-      return allPrognosedValues.Median();
-    }
-
-
-    private void SwitchNode(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode oldBranch, ISymbolicExpressionTreeNode newBranch) {
-      for (int i = 0; i < root.SubtreeCount; i++) {
-        if (root.GetSubtree(i) == oldBranch) {
-          root.RemoveSubtree(i);
-          root.InsertSubtree(i, newBranch);
-          return;
-        }
-      }
-    }
-
-    protected override void btnOptimizeConstants_Click(object sender, EventArgs e) {
-      throw new NotImplementedException();
-    }
   }
 }
Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/Plugin.cs.frame
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/Plugin.cs.frame	(revision 15697)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/Plugin.cs.frame	(revision 16692)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,7 +26,6 @@
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views {
-  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views", "Provides views for symbolic time-series prognosis problem classes.", "3.4.9.$WCREV$")]
+  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views", "Provides views for symbolic time-series prognosis problem classes.", "3.4.11.$WCREV$")]
   [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views-3.4.dll", PluginFileType.Assembly)]
-  [PluginDependency("HeuristicLab.Common", "3.3")]
   [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
   [PluginDependency("HeuristicLab.Core", "3.3")]
Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/Properties/AssemblyInfo.cs.frame
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/Properties/AssemblyInfo.cs.frame	(revision 15697)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/Properties/AssemblyInfo.cs.frame	(revision 16692)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -31,5 +31,5 @@
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("HeuristicLab")]
-[assembly: AssemblyCopyright("(c) 2002-2015 HEAL")]
+[assembly: AssemblyCopyright("(c) 2002-2018 HEAL")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
@@ -53,3 +53,3 @@
 // by using the '*' as shown below:
 [assembly: AssemblyVersion("3.4.0.0")]
-[assembly: AssemblyFileVersion("3.4.9.$WCREV$")]
+[assembly: AssemblyFileVersion("3.4.11.$WCREV$")]
Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/SymbolicTimeSeriesPrognosisSolutionView.Designer.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/SymbolicTimeSeriesPrognosisSolutionView.Designer.cs	(revision 15697)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/SymbolicTimeSeriesPrognosisSolutionView.Designer.cs	(revision 16692)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/SymbolicTimeSeriesPrognosisSolutionView.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/SymbolicTimeSeriesPrognosisSolutionView.cs	(revision 15697)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/SymbolicTimeSeriesPrognosisSolutionView.cs	(revision 16692)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
