Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs	(revision 3996)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs	(revision 4022)
@@ -246,5 +246,5 @@
 
       #region validation best model
-      int targetVariableIndex = ProblemData.Dataset.GetVariableIndex(ProblemData.TargetVariable.Value);
+      string targetVariable = ProblemData.TargetVariable.Value;
       int validationStart = ValidiationSamplesStart.Value;
       int validationEnd = ValidationSamplesEnd.Value;
@@ -257,16 +257,9 @@
       OnlineMeanSquaredErrorEvaluator mseEvaluator = new OnlineMeanSquaredErrorEvaluator();
       foreach (var scaledTree in scaledTrees) {
-        mseEvaluator.Reset();
-        IEnumerable<double> estimatedValidationValues = SymbolicExpressionTreeInterpreter.GetSymbolicExpressionTreeValues(scaledTree, ProblemData.Dataset, Enumerable.Range(validationStart, validationEnd - validationStart));
-        IEnumerable<double> originalValidationValues = ProblemData.Dataset.GetEnumeratedVariableValues(targetVariableIndex, validationStart, validationEnd);
-        var estimatedEnumerator = estimatedValidationValues.GetEnumerator();
-        var originalEnumerator = originalValidationValues.GetEnumerator();
-        while (estimatedEnumerator.MoveNext() & originalEnumerator.MoveNext()) {
-          double estimated = estimatedEnumerator.Current;
-          if (double.IsNaN(estimated)) estimated = upperEstimationLimit;
-          else estimated = Math.Min(upperEstimationLimit, Math.Max(lowerEstimationLimit, estimated));
-          mseEvaluator.Add(originalEnumerator.Current, estimated);
-        }
-        double validationMse = mseEvaluator.MeanSquaredError;
+        double validationMse = SymbolicRegressionMeanSquaredErrorEvaluator.Calculate(SymbolicExpressionTreeInterpreter, scaledTree,
+          lowerEstimationLimit, upperEstimationLimit,
+          ProblemData.Dataset, targetVariable,
+          validationStart, validationEnd);
+
         if (validationMse < bestValidationMse) {
           bestValidationMse = validationMse;
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableTreeNode.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableTreeNode.cs	(revision 3997)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableTreeNode.cs	(revision 4022)
@@ -30,5 +30,5 @@
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
   [StorableClass]
-  public sealed class VariableTreeNode : SymbolicExpressionTreeTerminalNode {
+  public class VariableTreeNode : SymbolicExpressionTreeTerminalNode {
     public new Variable Symbol {
       get { return (Variable)base.Symbol; }
@@ -48,8 +48,8 @@
 
 
-    private VariableTreeNode() { }
+    protected VariableTreeNode() { }
 
     // copy constructor
-    private VariableTreeNode(VariableTreeNode original)
+    protected VariableTreeNode(VariableTreeNode original)
       : base(original) {
       weight = original.weight;
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs	(revision 3997)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs	(revision 4022)
@@ -30,19 +30,7 @@
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
   [StorableClass]
-  public sealed class LaggedVariableTreeNode : SymbolicExpressionTreeTerminalNode {
+  public sealed class LaggedVariableTreeNode : VariableTreeNode {
     public new LaggedVariable Symbol {
       get { return (LaggedVariable)base.Symbol; }
-    }
-    [Storable]
-    private double weight;
-    public double Weight {
-      get { return weight; }
-      set { weight = value; }
-    }
-    [Storable]
-    private string variableName;
-    public string VariableName {
-      get { return variableName; }
-      set { variableName = value; }
     }
     [Storable]
@@ -58,6 +46,4 @@
     private LaggedVariableTreeNode(LaggedVariableTreeNode original)
       : base(original) {
-      weight = original.weight;
-      variableName = original.variableName;
       lag = original.lag;
     }
@@ -73,6 +59,4 @@
     public override void ResetLocalParameters(IRandom random) {
       base.ResetLocalParameters(random);
-      weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightNu, Symbol.WeightSigma);
-      variableName = Symbol.VariableNames.SelectRandom(random);
       lag = random.Next(Symbol.MinLag, Symbol.MaxLag + 1);
     }
@@ -80,8 +64,5 @@
     public override void ShakeLocalParameters(IRandom random, double shakingFactor) {
       base.ShakeLocalParameters(random, shakingFactor);
-      double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorNu, Symbol.WeightManipulatorSigma);
-      weight = weight + x * shakingFactor;
-      variableName = Symbol.VariableNames.SelectRandom(random);
-      lag = lag + random.Next(-1, 2);
+      lag = Math.Min(Symbol.MaxLag, Math.Max(Symbol.MinLag, lag + random.Next(-1, 2)));
     }
 
@@ -92,5 +73,6 @@
 
     public override string ToString() {
-      return weight.ToString("E4") + " " + variableName + " (t" + (lag > 0 ? "+" : "") + lag + ")";
+      return base.ToString() +
+        " (t" + (lag > 0 ? "+" : "") + lag + ")";
     }
   }
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs	(revision 3993)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs	(revision 4022)
@@ -34,5 +34,5 @@
   [StorableClass]
   [Item("Variable", "Represents a variable value.")]
-  public sealed class Variable : Symbol {
+  public class Variable : Symbol {
     #region Properties
     [Storable]
@@ -94,6 +94,7 @@
     }
     #endregion
-    public Variable()
-      : base("Variable", "Represents a variable value.") {
+    public Variable() : this("Variable", "Represents a variable value.") { }
+    public Variable(string name, string description)
+      : base(name, description) {
       weightNu = 1.0;
       weightSigma = 1.0;
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariable.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariable.cs	(revision 3993)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariable.cs	(revision 4022)
@@ -34,46 +34,46 @@
   [StorableClass]
   [Item("LaggedVariable", "Represents a variable value with a time offset.")]
-  public sealed class LaggedVariable : Symbol {
-    #region Properties
-    [Storable]
-    private double weightNu;
-    public double WeightNu {
-      get { return weightNu; }
-      set { weightNu = value; }
-    }
-    [Storable]
-    private double weightSigma;
-    public double WeightSigma {
-      get { return weightSigma; }
-      set {
-        if (weightSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
-        weightSigma = value;
-      }
-    }
-    [Storable]
-    private double weightManipulatorNu;
-    public double WeightManipulatorNu {
-      get { return weightManipulatorNu; }
-      set { weightManipulatorNu = value; }
-    }
-    [Storable]
-    private double weightManipulatorSigma;
-    public double WeightManipulatorSigma {
-      get { return weightManipulatorSigma; }
-      set {
-        if (weightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
-        weightManipulatorSigma = value;
-      }
-    }
-    private List<string> variableNames;
-    [Storable]
-    public IEnumerable<string> VariableNames {
-      get { return variableNames; }
-      set {
-        if (value == null) throw new ArgumentNullException();
-        variableNames.Clear();
-        variableNames.AddRange(value);
-      }
-    }
+  public sealed class LaggedVariable : Variable {
+    //#region Properties
+    //[Storable]
+    //private double weightNu;
+    //public double WeightNu {
+    //  get { return weightNu; }
+    //  set { weightNu = value; }
+    //}
+    //[Storable]
+    //private double weightSigma;
+    //public double WeightSigma {
+    //  get { return weightSigma; }
+    //  set {
+    //    if (weightSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
+    //    weightSigma = value;
+    //  }
+    //}
+    //[Storable]
+    //private double weightManipulatorNu;
+    //public double WeightManipulatorNu {
+    //  get { return weightManipulatorNu; }
+    //  set { weightManipulatorNu = value; }
+    //}
+    //[Storable]
+    //private double weightManipulatorSigma;
+    //public double WeightManipulatorSigma {
+    //  get { return weightManipulatorSigma; }
+    //  set {
+    //    if (weightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
+    //    weightManipulatorSigma = value;
+    //  }
+    //}
+    //private List<string> variableNames;
+    //[Storable]
+    //public IEnumerable<string> VariableNames {
+    //  get { return variableNames; }
+    //  set {
+    //    if (value == null) throw new ArgumentNullException();
+    //    variableNames.Clear();
+    //    variableNames.AddRange(value);
+    //  }
+    //}
     [Storable]
     private int minLag;
@@ -88,13 +88,13 @@
       set { maxLag = value; }
     }
-    #endregion
+    //#endregion
     public LaggedVariable()
       : base("LaggedVariable", "Represents a variable value with a time offset.") {
-      weightNu = 1.0;
-      weightSigma = 1.0;
-      weightManipulatorNu = 0.0;
-      weightManipulatorSigma = 1.0;
-      variableNames = new List<string>();
-      minLag = 0; maxLag = 0;
+      //weightNu = 1.0;
+      //weightSigma = 1.0;
+      //weightManipulatorNu = 0.0;
+      //weightManipulatorSigma = 1.0;
+      //variableNames = new List<string>();
+      minLag = -1; maxLag = -1;
     }
 
@@ -105,9 +105,9 @@
     public override IDeepCloneable Clone(Cloner cloner) {
       LaggedVariable clone = (LaggedVariable)base.Clone(cloner);
-      clone.weightNu = weightNu;
-      clone.weightSigma = weightSigma;
-      clone.variableNames = new List<string>(variableNames);
-      clone.weightManipulatorNu = weightManipulatorNu;
-      clone.weightManipulatorSigma = weightManipulatorSigma;
+      //clone.weightNu = weightNu;
+      //clone.weightSigma = weightSigma;
+      //clone.variableNames = new List<string>(variableNames);
+      //clone.weightManipulatorNu = weightManipulatorNu;
+      //clone.weightManipulatorSigma = weightManipulatorSigma;
       clone.minLag = minLag;
       clone.maxLag = maxLag;
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs	(revision 3996)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs	(revision 4022)
@@ -21,4 +21,5 @@
 
 using System;
+using System.Linq;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 using HeuristicLab.Common;
@@ -97,4 +98,6 @@
     private Instruction[] code;
     private int pc;
+    private double[] argumentStack = new double[ARGUMENT_STACK_SIZE];
+    private int argStackPointer;
 
     public override bool CanChangeName {
@@ -140,9 +143,6 @@
     }
 
-    private double[] argumentStack = new double[ARGUMENT_STACK_SIZE];
-    private int argStackPointer;
-
-    public double Evaluate() {
-      var currentInstr = code[pc++];
+    private double Evaluate() {
+      Instruction currentInstr = code[pc++];
       switch (currentInstr.opCode) {
         case OpCodes.Add: {
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 4022)
@@ -28,4 +28,5 @@
 namespace HeuristicLab.Problems.DataAnalysis {
   public interface IOnlineEvaluator {
+    double Value { get; }
     void Reset();
     void Add(double original, double estimated);
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineMeanAndVarianceCalculator.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineMeanAndVarianceCalculator.cs	(revision 4022)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineMeanAndVarianceCalculator.cs	(revision 4022)
@@ -0,0 +1,77 @@
+﻿#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 OnlineMeanAndVarianceCalculator {
+
+    private double m_oldM, m_newM, m_oldS, m_newS;
+    private int n;
+
+    public double Variance {
+      get {
+        return (n > 1) ? m_newS / (n - 1) : 0.0;
+      }
+    }
+
+    public double Mean {
+      get {
+        return (n > 0) ? m_newM : 0.0;
+      }
+    }
+
+    public OnlineMeanAndVarianceCalculator() {
+      Reset();
+    }
+
+    public void Reset() {
+      n = 0;
+    }
+
+    public void Add(double x) {
+      if (double.IsNaN(x) || double.IsInfinity(x)) {
+        throw new ArgumentException("Mean and variance are not defined for NaN or infinity elements");
+      } else {
+        n++;
+        // See Knuth TAOCP vol 2, 3rd edition, page 232
+        if (n == 1) {
+          m_oldM = m_newM = x;
+          m_oldS = 0.0;
+        } else {
+          m_newM = m_oldM + (x - m_oldM) / n;
+          m_newS = m_oldS + (x - m_oldM) * (x - m_newM);
+
+          // set up for next iteration
+          m_oldM = m_newM;
+          m_oldS = m_newS;
+        }
+      }
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineNormalizedMeanSquaredErrorEvaluator.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineNormalizedMeanSquaredErrorEvaluator.cs	(revision 4022)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineNormalizedMeanSquaredErrorEvaluator.cs	(revision 4022)
@@ -0,0 +1,70 @@
+﻿#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 OnlineNormalizedMeanSquaredErrorEvaluator : IOnlineEvaluator {
+    private OnlineMeanAndVarianceCalculator meanSquaredErrorCalculator;
+    private OnlineMeanAndVarianceCalculator originalVarianceCalculator;
+
+    public double NormalizedMeanSquaredError {
+      get {
+        return meanSquaredErrorCalculator.Mean / originalVarianceCalculator.Variance;
+      }
+    }
+
+    public OnlineNormalizedMeanSquaredErrorEvaluator() {
+      meanSquaredErrorCalculator = new OnlineMeanAndVarianceCalculator();
+      originalVarianceCalculator = new OnlineMeanAndVarianceCalculator();
+      Reset();
+    }
+
+    #region IOnlineEvaluator Members
+    public double Value {
+      get { return NormalizedMeanSquaredError; }
+    }
+
+    public void Reset() {
+      meanSquaredErrorCalculator.Reset();
+      originalVarianceCalculator.Reset();
+    }
+
+    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;
+        meanSquaredErrorCalculator.Add(error * error);
+        originalVarianceCalculator.Add(original);
+      }
+    }
+    #endregion
+  }
+}
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 4022)
@@ -47,5 +47,8 @@
     }
 
-    #region IPairedEnumerableEvaluator Members
+    #region IOnlineEvaluator Members
+    public double Value {
+      get { return MeanAbsolutePercentageError; }
+    }
     public void Reset() {
       n = 0;
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleNMSEEvaluator.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleNMSEEvaluator.cs	(revision 3462)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleNMSEEvaluator.cs	(revision 4022)
@@ -50,6 +50,14 @@
 
     public static double Calculate(IEnumerable<double> original, IEnumerable<double> estimated) {
-      double mse = SimpleMSEEvaluator.Calculate(original, estimated);
-      return mse / original.Variance();
+      OnlineNormalizedMeanSquaredErrorEvaluator nmseEvaluator = new OnlineNormalizedMeanSquaredErrorEvaluator();
+      var originalEnumerator = original.GetEnumerator();
+      var estimatedEnumerator = estimated.GetEnumerator();
+      while (originalEnumerator.MoveNext() & estimatedEnumerator.MoveNext()) {
+        nmseEvaluator.Add(originalEnumerator.Current, estimatedEnumerator.Current);
+      }
+      if (originalEnumerator.MoveNext() || estimatedEnumerator.MoveNext()) {
+        throw new ArgumentException("Number of elements in original and estimated enumerations doesn't match.");
+      }
+      return nmseEvaluator.NormalizedMeanSquaredError;
     }
   }
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 4022)
@@ -48,4 +48,7 @@
 
     #region IOnlineEvaluator Members
+    public double Value {
+      get { return MeanSquaredError; }
+    }
     public void Reset() {
       n = 0;
@@ -56,5 +59,5 @@
       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");
+        throw new ArgumentException("Mean squared error is not defined for NaN or infinity elements");
       } else {
         double error = estimated - original;
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 4022)
@@ -61,4 +61,7 @@
 
     #region IOnlineEvaluator Members
+    public double Value {
+      get { return RSquared; }
+    }
     public void Reset() {
       sum_sq_x = 0.0;
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblemData.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblemData.cs	(revision 3933)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblemData.cs	(revision 4022)
@@ -39,5 +39,5 @@
     #region default data
     // y = x^4 + x^3 + x^2 + x
-    private readonly double[,] kozaF1 = new double[,] {
+    private static double[,] kozaF1 = new double[,] {
 {2.017885919,	-1.449165046},
 {1.30060506,	-1.344523885},
@@ -185,4 +185,23 @@
     }
 
+    public DataAnalysisProblemData(Dataset dataset, IEnumerable<string> inputVariables, string targetVariable,
+      int trainingSamplesStart, int trainingSamplesEnd, int testSamplesStart, int testSamplesEnd) {
+      var inputVariablesList = new CheckedItemList<StringValue>(inputVariables.Select(x => new StringValue(x)));
+      StringValue targetVariableValue = new StringValue(targetVariable);
+      var validTargetVariables = new ItemSet<StringValue>();
+      foreach (var variable in dataset.VariableNames)
+        if (variable != targetVariable)
+          validTargetVariables.Add(new StringValue(variable));
+      validTargetVariables.Add(targetVariableValue);
+      Parameters.Add(new ValueParameter<Dataset>("Dataset", dataset));
+      Parameters.Add(new ValueParameter<ICheckedItemList<StringValue>>("InputVariables", inputVariablesList.AsReadOnly()));
+      Parameters.Add(new ConstrainedValueParameter<StringValue>("TargetVariable", validTargetVariables, targetVariableValue));
+      Parameters.Add(new ValueParameter<IntValue>("TrainingSamplesStart", new IntValue(trainingSamplesStart)));
+      Parameters.Add(new ValueParameter<IntValue>("TrainingSamplesEnd", new IntValue(trainingSamplesEnd)));
+      Parameters.Add(new ValueParameter<IntValue>("TestSamplesStart", new IntValue(testSamplesStart)));
+      Parameters.Add(new ValueParameter<IntValue>("TestSamplesEnd", new IntValue(testSamplesEnd)));
+      RegisterParameterEventHandlers();
+      RegisterParameterValueEventHandlers();
+    }
 
     [StorableConstructor]
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj	(revision 3999)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj	(revision 4022)
@@ -84,4 +84,6 @@
     <None Include="HeuristicLabProblemsDataAnalysisPlugin.cs.frame" />
     <None Include="Properties\AssemblyInfo.frame" />
+    <Compile Include="Evaluators\OnlineMeanAndVarianceCalculator.cs" />
+    <Compile Include="Evaluators\OnlineNormalizedMeanSquaredErrorEvaluator.cs" />
     <Compile Include="DataAnalysisSolution.cs" />
     <Compile Include="CsvFileParser.cs" />
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/Symbols/LaggedVariableView.Designer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/Symbols/LaggedVariableView.Designer.cs	(revision 4022)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/Symbols/LaggedVariableView.Designer.cs	(revision 4022)
@@ -0,0 +1,155 @@
+﻿#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
+
+namespace HeuristicLab.Problems.DataAnalysis.Views.Symbolic.Symbols {
+  partial class LaggedVariableView {
+    /// <summary> 
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary> 
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      if (disposing && (components != null)) {
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Component Designer generated code
+
+    /// <summary> 
+    /// Required method for Designer support - do not modify 
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent() {
+      this.minTimeOffsetLabel = new System.Windows.Forms.Label();
+      this.maxTimeOffsetLabel = new System.Windows.Forms.Label();
+      this.minTimeOffsetTextBox = new System.Windows.Forms.TextBox();
+      this.maxTimeOffsetTextBox = new System.Windows.Forms.TextBox();
+      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
+      this.SuspendLayout();
+      // 
+      // initializationGroupBox
+      // 
+      this.initializationGroupBox.Location = new System.Drawing.Point(3, 131);
+      this.initializationGroupBox.Size = new System.Drawing.Size(399, 73);
+      // 
+      // mutationGroupBox
+      // 
+      this.mutationGroupBox.Location = new System.Drawing.Point(6, 210);
+      this.mutationGroupBox.Size = new System.Drawing.Size(396, 73);
+      // 
+      // initialFrequencyLabel
+      // 
+      this.initialFrequencyLabel.Location = new System.Drawing.Point(3, 56);
+      this.toolTip.SetToolTip(this.initialFrequencyLabel, "Relative frequency of the symbol in randomly created trees");
+      // 
+      // initialFrequencyTextBox
+      // 
+      this.errorProvider.SetIconAlignment(this.initialFrequencyTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.initialFrequencyTextBox.Size = new System.Drawing.Size(285, 20);
+      // 
+      // nameTextBox
+      // 
+      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
+      this.nameTextBox.Size = new System.Drawing.Size(285, 20);
+      // 
+      // descriptionTextBox
+      // 
+      this.errorProvider.SetIconAlignment(this.descriptionTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.descriptionTextBox.Size = new System.Drawing.Size(285, 20);
+      // 
+      // minTimeOffsetLabel
+      // 
+      this.minTimeOffsetLabel.AutoSize = true;
+      this.minTimeOffsetLabel.Location = new System.Drawing.Point(3, 82);
+      this.minTimeOffsetLabel.Name = "minTimeOffsetLabel";
+      this.minTimeOffsetLabel.Size = new System.Drawing.Size(81, 13);
+      this.minTimeOffsetLabel.TabIndex = 10;
+      this.minTimeOffsetLabel.Text = "Min. time offset:";
+      // 
+      // maxTimeOffsetLabel
+      // 
+      this.maxTimeOffsetLabel.AutoSize = true;
+      this.maxTimeOffsetLabel.Location = new System.Drawing.Point(3, 108);
+      this.maxTimeOffsetLabel.Name = "maxTimeOffsetLabel";
+      this.maxTimeOffsetLabel.Size = new System.Drawing.Size(84, 13);
+      this.maxTimeOffsetLabel.TabIndex = 11;
+      this.maxTimeOffsetLabel.Text = "Max. time offset:";
+      // 
+      // minTimeOffsetTextBox
+      // 
+      this.minTimeOffsetTextBox.Location = new System.Drawing.Point(117, 79);
+      this.minTimeOffsetTextBox.Name = "minTimeOffsetTextBox";
+      this.minTimeOffsetTextBox.Size = new System.Drawing.Size(285, 20);
+      this.minTimeOffsetTextBox.TabIndex = 12;
+      this.minTimeOffsetTextBox.TextChanged += new System.EventHandler(this.minTimeOffsetTextBox_TextChanged);
+      // 
+      // maxTimeOffsetTextBox
+      // 
+      this.maxTimeOffsetTextBox.Location = new System.Drawing.Point(117, 105);
+      this.maxTimeOffsetTextBox.Name = "maxTimeOffsetTextBox";
+      this.maxTimeOffsetTextBox.Size = new System.Drawing.Size(285, 20);
+      this.maxTimeOffsetTextBox.TabIndex = 13;
+      this.maxTimeOffsetTextBox.TextChanged += new System.EventHandler(this.maxTimeOffsetTextBox_TextChanged);
+      // 
+      // LaggedVariableView
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.maxTimeOffsetTextBox);
+      this.Controls.Add(this.minTimeOffsetTextBox);
+      this.Controls.Add(this.maxTimeOffsetLabel);
+      this.Controls.Add(this.minTimeOffsetLabel);
+      this.Name = "LaggedVariableView";
+      this.Size = new System.Drawing.Size(408, 292);
+      this.Controls.SetChildIndex(this.initializationGroupBox, 0);
+      this.Controls.SetChildIndex(this.initialFrequencyTextBox, 0);
+      this.Controls.SetChildIndex(this.initialFrequencyLabel, 0);
+      this.Controls.SetChildIndex(this.nameLabel, 0);
+      this.Controls.SetChildIndex(this.descriptionLabel, 0);
+      this.Controls.SetChildIndex(this.nameTextBox, 0);
+      this.Controls.SetChildIndex(this.descriptionTextBox, 0);
+      this.Controls.SetChildIndex(this.mutationGroupBox, 0);
+      this.Controls.SetChildIndex(this.minTimeOffsetLabel, 0);
+      this.Controls.SetChildIndex(this.maxTimeOffsetLabel, 0);
+      this.Controls.SetChildIndex(this.minTimeOffsetTextBox, 0);
+      this.Controls.SetChildIndex(this.maxTimeOffsetTextBox, 0);
+      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
+      this.ResumeLayout(false);
+      this.PerformLayout();
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.Label minTimeOffsetLabel;
+    private System.Windows.Forms.Label maxTimeOffsetLabel;
+    private System.Windows.Forms.TextBox minTimeOffsetTextBox;
+    private System.Windows.Forms.TextBox maxTimeOffsetTextBox;
+
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/Symbols/LaggedVariableView.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/Symbols/LaggedVariableView.cs	(revision 4022)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/Symbols/LaggedVariableView.cs	(revision 4022)
@@ -0,0 +1,115 @@
+﻿#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.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using HeuristicLab.MainForm;
+using HeuristicLab.MainForm.WindowsForms;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Core.Views;
+using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
+
+namespace HeuristicLab.Problems.DataAnalysis.Views.Symbolic.Symbols {
+  [View("LaggedVariable View")]
+  [Content(typeof(LaggedVariable), true)]
+  public partial class LaggedVariableView : VariableView {
+    public new LaggedVariable Content {
+      get { return (LaggedVariable)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public LaggedVariableView() {
+      InitializeComponent();
+    }
+
+    protected override void RegisterContentEvents() {
+      base.RegisterContentEvents();
+      Content.Changed += new EventHandler(Content_Changed);
+    }
+
+    protected override void DeregisterContentEvents() {
+      base.DeregisterContentEvents();
+      Content.Changed -= new EventHandler(Content_Changed);
+    }
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      UpdateControl();
+    }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+      minTimeOffsetTextBox.Enabled = Content != null;
+      maxTimeOffsetTextBox.Enabled = Content != null;
+    }
+
+    #region content event handlers
+    private void Content_Changed(object sender, EventArgs e) {
+      UpdateControl();
+    }
+    #endregion
+
+    #region control event handlers
+
+    private void minTimeOffsetTextBox_TextChanged(object sender, EventArgs e) {
+      int timeOffset;
+      if (int.TryParse(minTimeOffsetTextBox.Text, out timeOffset) && timeOffset < 0) {
+        Content.MinLag = timeOffset;
+        errorProvider.SetError(minTimeOffsetTextBox, string.Empty);
+      } else {
+        errorProvider.SetError(minTimeOffsetTextBox, "Time offset must be a negative value.");
+      }
+    }
+
+    private void maxTimeOffsetTextBox_TextChanged(object sender, EventArgs e) {
+      int timeOffset;
+      if (int.TryParse(maxTimeOffsetTextBox.Text, out timeOffset) && timeOffset < 0) {
+        Content.MaxLag = timeOffset;
+        errorProvider.SetError(maxTimeOffsetTextBox, string.Empty);
+      } else {
+        errorProvider.SetError(maxTimeOffsetTextBox, "Time offset must be a negative value.");
+      }
+    }
+
+    #endregion
+
+    #region helpers
+    private void UpdateControl() {
+      if (Content == null) {
+        minTimeOffsetTextBox.Text = string.Empty;
+        maxTimeOffsetTextBox.Text = string.Empty;
+      } else {
+        minTimeOffsetTextBox.Text = Content.MinLag.ToString();
+        maxTimeOffsetTextBox.Text = Content.MaxLag.ToString();
+      }
+      SetEnabledStateOfControls();
+    }
+    #endregion
+
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/HeuristicLab.Problems.DataAnalysis.Views-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/HeuristicLab.Problems.DataAnalysis.Views-3.3.csproj	(revision 3975)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/HeuristicLab.Problems.DataAnalysis.Views-3.3.csproj	(revision 4022)
@@ -172,4 +172,10 @@
       <DependentUpon>ConstantView.cs</DependentUpon>
     </Compile>
+    <Compile Include="Symbolic\Symbols\LaggedVariableView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="Symbolic\Symbols\LaggedVariableView.Designer.cs">
+      <DependentUpon>LaggedVariableView.cs</DependentUpon>
+    </Compile>
     <Compile Include="Symbolic\Symbols\VariableView.cs">
       <SubType>UserControl</SubType>
@@ -252,4 +258,9 @@
       <Name>HeuristicLab.Problems.DataAnalysis-3.3</Name>
     </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Symbolic\Symbols\LaggedVariableView.resx">
+      <DependentUpon>LaggedVariableView.cs</DependentUpon>
+    </EmbeddedResource>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Compiler/SymbolicExpressionTreeCompiler.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Compiler/SymbolicExpressionTreeCompiler.cs	(revision 3747)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Compiler/SymbolicExpressionTreeCompiler.cs	(revision 4022)
@@ -37,7 +37,9 @@
       List<Instruction> code = new List<Instruction>();
       entryPoint.Clear();
-      // compile main body
-      code.AddRange(Compile(tree.Root.SubTrees[0].SubTrees[0], opCodeMapper));
-      // compile branches
+      // compile main body branches
+      foreach (var branch in tree.Root.SubTrees[0].SubTrees) {
+        code.AddRange(Compile(branch, opCodeMapper));
+      }      
+      // compile function branches
       var functionBranches = from node in tree.IterateNodesPrefix()
                              where node.Symbol is Defun
