Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineMeanAbsolutePercentageErrorEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineMeanAbsolutePercentageErrorEvaluator.cs	(revision 3996)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineMeanAbsolutePercentageErrorEvaluator.cs	(revision 3996)
@@ -0,0 +1,69 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+
+namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
+  public class OnlineMeanAbsolutePercentageErrorEvaluator : IOnlineEvaluator {
+
+    private double sre;
+    private int n;
+    public double MeanAbsolutePercentageError {
+      get {
+        if (n < 1)
+          throw new InvalidOperationException("No elements");
+        else
+          return sre / n;
+      }
+    }
+
+    public OnlineMeanAbsolutePercentageErrorEvaluator() {
+      Reset();
+    }
+
+    #region IPairedEnumerableEvaluator Members
+    public void Reset() {
+      n = 0;
+      sre = 0.0;
+    }
+
+    public void Add(double original, double estimated) {
+      if (double.IsNaN(estimated) || double.IsInfinity(estimated) ||
+          double.IsNaN(original) || double.IsInfinity(original)) {
+        throw new ArgumentException("Relative error is not defined for variables with NaN or infinity values.");
+      } else {
+        if (!original.IsAlmost(0.0)) {
+          sre += Math.Abs((estimated - original) / original);
+          n++;
+        }
+      }
+    }
+
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineMeanSquaredErrorEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineMeanSquaredErrorEvaluator.cs	(revision 3996)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineMeanSquaredErrorEvaluator.cs	(revision 3996)
@@ -0,0 +1,67 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+
+namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
+  public class OnlineMeanSquaredErrorEvaluator : IOnlineEvaluator {
+
+    private double sse;
+    private int n;
+    public double MeanSquaredError {
+      get {
+        if (n < 1)
+          throw new InvalidOperationException("No elements");
+        else
+          return sse / n;
+      }
+    }
+
+    public OnlineMeanSquaredErrorEvaluator() {
+      Reset();
+    }
+
+    #region IOnlineEvaluator Members
+    public void Reset() {
+      n = 0;
+      sse = 0.0;
+    }
+
+    public void Add(double original, double estimated) {
+      if (double.IsNaN(estimated) || double.IsInfinity(estimated) ||
+          double.IsNaN(original) || double.IsInfinity(original)) {
+            throw new ArgumentException("Mean squared error is not defined for NaN or infinity elements");
+      } else {
+        double error = estimated - original;
+        sse += error * error;
+        n++;
+      }
+    }
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlinePearsonsRSquaredEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlinePearsonsRSquaredEvaluator.cs	(revision 3996)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlinePearsonsRSquaredEvaluator.cs	(revision 3996)
@@ -0,0 +1,100 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+
+namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
+  public class OnlinePearsonsRSquaredEvaluator : IOnlineEvaluator {
+
+    private double sum_sq_x;
+    private double sum_sq_y;
+    private double sum_coproduct;
+    private double mean_x;
+    private double mean_y;
+    private int n;
+
+    public double RSquared {
+      get {
+        if (n < 1)
+          throw new InvalidOperationException("No elements");
+        else {
+          double pop_sd_x = Math.Sqrt(sum_sq_x / n);
+          double pop_sd_y = Math.Sqrt(sum_sq_y / n);
+          double cov_x_y = sum_coproduct / n;
+
+          if (pop_sd_x.IsAlmost(0.0) || pop_sd_y.IsAlmost(0.0))
+            return 0.0;
+          else {
+            double r = cov_x_y / (pop_sd_x * pop_sd_y);
+            return r * r;
+          }
+        }
+      }
+    }
+
+    public OnlinePearsonsRSquaredEvaluator() { }
+
+    #region IOnlineEvaluator Members
+    public void Reset() {
+      sum_sq_x = 0.0;
+      sum_sq_y = 0.0;
+      sum_coproduct = 0.0;
+      mean_x = 0.0;
+      mean_y = 0.0;
+      n = 0;
+    }
+
+    public void Add(double original, double estimated) {
+      // stable and iterative calculation of R²
+      if (IsInvalidValue(original) || IsInvalidValue(estimated)) {
+        throw new ArgumentException("R² is not defined for variables with NaN or infinity values.");
+      }
+      if (n == 0) {
+        mean_x = original;
+        mean_y = estimated;
+        n = 1;
+      } else {
+        double sweep = (n - 1.0) / n;
+        double delta_x = original - mean_x;
+        double delta_y = estimated - mean_y;
+        sum_sq_x += delta_x * delta_x * sweep;
+        sum_sq_y += delta_y * delta_y * sweep;
+        sum_coproduct += delta_x * delta_y * sweep;
+        mean_x += delta_x / n;
+        mean_y += delta_y / n;
+        n++;
+      }
+    }
+
+    #endregion
+
+    private bool IsInvalidValue(double x) {
+      return double.IsNaN(x) || double.IsInfinity(x);
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMSEEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMSEEvaluator.cs	(revision 3994)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMSEEvaluator.cs	(revision 3996)
@@ -45,6 +45,5 @@
 
     public static double Calculate(IEnumerable<double> original, IEnumerable<double> estimated) {
-      double sse = 0.0;
-      int cnt = 0;
+      var onlineMseEvaluator = new OnlineMeanSquaredErrorEvaluator();
       var originalEnumerator = original.GetEnumerator();
       var estimatedEnumerator = estimated.GetEnumerator();
@@ -52,18 +51,10 @@
         double e = estimatedEnumerator.Current;
         double o = originalEnumerator.Current;
-        if (!double.IsNaN(e) && !double.IsInfinity(e) &&
-            !double.IsNaN(o) && !double.IsInfinity(o)) {
-          double error = e - o;
-          sse += error * error;
-          cnt++;
-        }
+        onlineMseEvaluator.Add(o, e);
       }
       if (estimatedEnumerator.MoveNext() || originalEnumerator.MoveNext()) {
         throw new ArgumentException("Number of elements in original and estimated enumeration doesn't match.");
-      } else if (cnt == 0) {
-        throw new ArgumentException("Mean squared errors is not defined for input vectors of NaN or Inf");
       } else {
-        double mse = sse / cnt;
-        return mse;
+        return onlineMseEvaluator.MeanSquaredError;
       }
     }
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMeanAbsolutePercentageErrorEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMeanAbsolutePercentageErrorEvaluator.cs	(revision 3994)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMeanAbsolutePercentageErrorEvaluator.cs	(revision 3996)
@@ -48,6 +48,5 @@
 
     public static double Calculate(IEnumerable<double> original, IEnumerable<double> estimated) {
-      double sre = 0;
-      int cnt = 0;
+      OnlineMeanAbsolutePercentageErrorEvaluator onlineEvaluator = new OnlineMeanAbsolutePercentageErrorEvaluator();
       var originalEnumerator = original.GetEnumerator();
       var estimatedEnumerator = estimated.GetEnumerator();
@@ -55,16 +54,10 @@
         double e = estimatedEnumerator.Current;
         double o = originalEnumerator.Current;
-        if (!double.IsNaN(e) && !double.IsInfinity(e) &&
-            !double.IsNaN(o) && !double.IsInfinity(o) && !o.IsAlmost(0.0)) {
-          sre += Math.Abs((e - o) / o);
-          cnt++;
-        }
+        onlineEvaluator.Add(o, e);
       }
       if (estimatedEnumerator.MoveNext() || originalEnumerator.MoveNext()) {
         throw new ArgumentException("Number of elements in original and estimated enumeration doesn't match.");
-      } else if (cnt == 0) {
-        throw new ArgumentException("Average relative error is not defined for input vectors of NaN or Inf");
       } else {
-        return sre / cnt;
+        return onlineEvaluator.MeanAbsolutePercentageError;
       }
     }
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleRSquaredEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleRSquaredEvaluator.cs	(revision 3994)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleRSquaredEvaluator.cs	(revision 3996)
@@ -49,50 +49,17 @@
 
     public static double Calculate(IEnumerable<double> original, IEnumerable<double> estimated) {
+      var onlinePearsonRSquaredEvaluator = new OnlinePearsonsRSquaredEvaluator();
       var originalEnumerator = original.GetEnumerator();
       var estimatedEnumerator = estimated.GetEnumerator();
-      originalEnumerator.MoveNext();
-      estimatedEnumerator.MoveNext();
-      double e = estimatedEnumerator.Current;
-      double o = originalEnumerator.Current;
 
-      // stable and iterative calculation of R² in one pass over original and estimated
-      double sum_sq_x = 0.0;
-      double sum_sq_y = 0.0;
-      double sum_coproduct = 0.0;
-      if (IsInvalidValue(o) || IsInvalidValue(e)) {
-        throw new ArgumentException("R² is not defined for variables with NaN or infinity values.");
-      }
-      double mean_x = o;
-      double mean_y = e;
-      int n = 1;
       while (originalEnumerator.MoveNext() & estimatedEnumerator.MoveNext()) {
-        e = estimatedEnumerator.Current;
-        o = originalEnumerator.Current;
-        double sweep = (n - 1.0) / n;
-        if (IsInvalidValue(o) || IsInvalidValue(e)) {
-          throw new ArgumentException("Correlation coefficient is not defined for variables with NaN or infinity values.");
-        }
-        double delta_x = o - mean_x;
-        double delta_y = e - mean_y;
-        sum_sq_x += delta_x * delta_x * sweep;
-        sum_sq_y += delta_y * delta_y * sweep;
-        sum_coproduct += delta_x * delta_y * sweep;
-        mean_x += delta_x / n;
-        mean_y += delta_y / n;
-        n++;
+        double e = estimatedEnumerator.Current;
+        double o = originalEnumerator.Current;
+        onlinePearsonRSquaredEvaluator.Add(o, e);
       }
       if (estimatedEnumerator.MoveNext() || originalEnumerator.MoveNext()) {
         throw new ArgumentException("Number of elements in original and estimated enumeration doesn't match.");
       } else {
-        double pop_sd_x = Math.Sqrt(sum_sq_x / n);
-        double pop_sd_y = Math.Sqrt(sum_sq_y / n);
-        double cov_x_y = sum_coproduct / n;
-
-        if (pop_sd_x.IsAlmost(0.0) || pop_sd_y.IsAlmost(0.0))
-          return 0.0;
-        else {
-          double r = cov_x_y / (pop_sd_x * pop_sd_y);
-          return r * r;
-        }
+        return onlinePearsonRSquaredEvaluator.RSquared;
       }
     }
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Interfaces/IOnlineEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Interfaces/IOnlineEvaluator.cs	(revision 3996)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Interfaces/IOnlineEvaluator.cs	(revision 3996)
@@ -0,0 +1,33 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Problems.DataAnalysis {
+  public interface IOnlineEvaluator {
+    void Reset();
+    void Add(double original, double estimated);
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs	(revision 3994)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs	(revision 3996)
@@ -147,6 +147,6 @@
       switch (currentInstr.opCode) {
         case OpCodes.Add: {
-            double s = 0.0;
-            for (int i = 0; i < currentInstr.nArguments; i++) {
+            double s = Evaluate();
+            for (int i = 1; i < currentInstr.nArguments; i++) {
               s += Evaluate();
             }
