Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView.cs	(revision 5987)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView.cs	(revision 5993)
@@ -59,8 +59,6 @@
     protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) {
       Dictionary<ISymbolicExpressionTreeNode, double> replacementValues = new Dictionary<ISymbolicExpressionTreeNode, double>();
-      foreach (ISymbolicExpressionTreeNode node in tree.IterateNodesPrefix()) {
-        if (!(node.Symbol is ProgramRootSymbol || node.Symbol is StartSymbol)) {
-          replacementValues[node] = CalculateReplacementValue(node);
-        }
+      foreach (ISymbolicExpressionTreeNode node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) {
+        replacementValues[node] = CalculateReplacementValue(node, tree);
       }
       return replacementValues;
@@ -90,5 +88,5 @@
       foreach (ISymbolicExpressionTreeNode node in nodes) {
         var parent = node.Parent;
-        constantNode.Value = CalculateReplacementValue(node);
+        constantNode.Value = CalculateReplacementValue(node, tree);
         ISymbolicExpressionTreeNode replacementNode = constantNode;
         SwitchNode(parent, node, replacementNode);
@@ -111,5 +109,11 @@
     }
 
-    private double CalculateReplacementValue(ISymbolicExpressionTreeNode node) {
+    private double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree) {
+      // remove old ADFs
+      while (tempTree.Root.SubtreesCount > 1) tempTree.Root.RemoveSubtree(1);
+      // clone ADFs of source tree
+      for (int i = 1; i < sourceTree.Root.SubtreesCount; i++) {
+        tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone());
+      } 
       var start = tempTree.Root.GetSubtree(0);
       while (start.SubtreesCount > 0) start.RemoveSubtree(0);
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs	(revision 5987)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs	(revision 5993)
@@ -60,8 +60,6 @@
     protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) {
       Dictionary<ISymbolicExpressionTreeNode, double> replacementValues = new Dictionary<ISymbolicExpressionTreeNode, double>();
-      foreach (ISymbolicExpressionTreeNode node in tree.IterateNodesPrefix()) {
-        if (!(node.Symbol is ProgramRootSymbol || node.Symbol is StartSymbol)) {
-          replacementValues[node] = CalculateReplacementValue(node);
-        }
+      foreach (ISymbolicExpressionTreeNode node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) {
+        replacementValues[node] = CalculateReplacementValue(node, tree);
       }
       return replacementValues;
@@ -84,5 +82,5 @@
       foreach (ISymbolicExpressionTreeNode node in nodes) {
         var parent = node.Parent;
-        constantNode.Value = CalculateReplacementValue(node);
+        constantNode.Value = CalculateReplacementValue(node, tree);
         ISymbolicExpressionTreeNode replacementNode = constantNode;
         SwitchNode(parent, node, replacementNode);
@@ -100,5 +98,11 @@
     }
 
-    private double CalculateReplacementValue(ISymbolicExpressionTreeNode node) {
+    private double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree) {
+      // remove old ADFs
+      while (tempTree.Root.SubtreesCount > 1) tempTree.Root.RemoveSubtree(1);
+      // clone ADFs of source tree
+      for (int i = 1; i < sourceTree.Root.SubtreesCount; i++) {
+        tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone());
+      }
       var start = tempTree.Root.GetSubtree(0);
       while (start.SubtreesCount > 0) start.RemoveSubtree(0);
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs	(revision 5987)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs	(revision 5993)
@@ -96,11 +96,14 @@
           for (int subTreeIndex = 0; subTreeIndex < parent.SubtreesCount; subTreeIndex++) {
             var child = parent.GetSubtree(subTreeIndex);
-            if (!(child.Symbol is Constant) && nodeImpacts[child].IsAlmost(1.0)) {
+            if (!(child.Symbol is Constant) && nodeImpacts[child].IsAlmost(0.0)) {
               SwitchNodeWithReplacementNode(parent, subTreeIndex);
             }
           }
         }
-        // show only interesting part of solution
-        this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0));
+        // show only interesting part of solution 
+        if (tree.Root.SubtreesCount > 1)
+          this.treeChart.Tree = new SymbolicExpressionTree(tree.Root); // RPB + ADFs
+        else
+          this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); // 1st child of RPB
         this.PaintNodeImpacts();
       }
@@ -126,14 +129,26 @@
         for (int i = 0; i < treeNode.SubtreesCount; i++) {
           ISymbolicExpressionTreeNode subTree = treeNode.GetSubtree(i);
-          if (subTree == visualTreeNode.SymbolicExpressionTreeNode) {
+          // only allow to replace nodes for which a replacement value is known (replacement value for ADF nodes are not available)
+          if (subTree == visualTreeNode.SymbolicExpressionTreeNode && replacementNodes.ContainsKey(subTree)) {
+            double replacementImpact = nodeImpacts.ContainsKey(replacementNodes[subTree]) ? nodeImpacts[replacementNodes[subTree]] : 0.0;
+            double originalImpact = nodeImpacts.ContainsKey(subTree) ? nodeImpacts[subTree] : 0.0;
             SwitchNodeWithReplacementNode(treeNode, i);
-          }
-        }
-      }
-
-      // show only interesting part of solution
-      this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0));
-
-      UpdateModel(tree);
+
+            // show only interesting part of solution 
+            if (tree.Root.SubtreesCount > 1)
+              this.treeChart.Tree = new SymbolicExpressionTree(tree.Root); // RPB + ADFs
+            else
+              this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); // 1st child of RPB
+            if (!(originalImpact.IsAlmost(0.0) && replacementImpact.IsAlmost(0.0))) {
+              // update everything after the change if necessary (impact != 0)            
+              UpdateModel(tree);
+            } else {
+              // both impacts are zero, so we only need to repaint the nodes 
+              PaintNodeImpacts();
+            }
+            return; // break all loops
+          }
+        }
+      }
     }
 
@@ -176,5 +191,5 @@
             visualTree.ToolTip += Environment.NewLine + "Replacement value: " + constantReplacementNode.Value;
           }
-        }
+        } 
       }
       this.PaintCollapsedNodes();
