Index: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/HeuristicLab.Problems.DataAnalysis.Regression-3.3.csproj
===================================================================
--- branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/HeuristicLab.Problems.DataAnalysis.Regression-3.3.csproj	(revision 4340)
+++ branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/HeuristicLab.Problems.DataAnalysis.Regression-3.3.csproj	(revision 4341)
@@ -127,5 +127,7 @@
     </Compile>
     <Compile Include="Symbolic\Analyzers\SymbolicRegressionSolutionLinearScaler.cs" />
-    <Compile Include="Symbolic\Analyzers\SymbolicRegressionTournamentPruning.cs" />
+    <Compile Include="Symbolic\Analyzers\SymbolicRegressionTournamentPruning.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="Symbolic\Analyzers\SymbolicRegressionVariableFrequencyAnalyzer.cs" />
     <Compile Include="Symbolic\Analyzers\ValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs" />
Index: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs
===================================================================
--- branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs	(revision 4340)
+++ branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs	(revision 4341)
@@ -21,19 +21,12 @@
 
 using System;
-using System.Collections.Generic;
 using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.PluginInfrastructure;
 using HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers;
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
@@ -84,10 +77,10 @@
     public SymbolicRegressionProblem()
       : base() {
-      var evaluator = new SymbolicRegressionScaledMeanSquaredErrorEvaluator();
-      Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the error of the regression model should be minimized.", (BoolValue)new BoolValue(false).AsReadOnly()));
+      var evaluator = new SymbolicRegressionPearsonsRSquaredEvaluator();
+      Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the error of the regression model should be minimized.", (BoolValue)new BoolValue(true)));
       Parameters.Add(new ValueParameter<ISymbolicRegressionEvaluator>("Evaluator", "The operator which should be used to evaluate symbolic regression solutions.", evaluator));
       Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The minimal error value that reached by symbolic regression solutions for the problem."));
 
-      evaluator.QualityParameter.ActualName = "TrainingMeanSquaredError";
+      evaluator.QualityParameter.ActualName = "TrainingPearsonR2";
 
       InitializeOperators();
Index: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblemBase.cs
===================================================================
--- branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblemBase.cs	(revision 4340)
+++ branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblemBase.cs	(revision 4341)
@@ -113,4 +113,5 @@
     public ISymbolicExpressionGrammar FunctionTreeGrammar {
       get { return (ISymbolicExpressionGrammar)FunctionTreeGrammarParameter.Value; }
+      private set { FunctionTreeGrammarParameter.Value = value; }
     }
     public override IEnumerable<IOperator> Operators {
@@ -190,4 +191,5 @@
       MaxFunctionDefiningBranchesParameter.ValueChanged += new EventHandler(ArchitectureParameter_ValueChanged);
       SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
+      FunctionTreeGrammarParameter.ValueChanged += new EventHandler(FunctionTreeGrammarParameter_ValueChanged);
     }
 
@@ -211,5 +213,5 @@
       UpdateGrammar();
     }
-    protected virtual void OnGrammarChanged(EventArgs e) { }
+    protected virtual void OnGrammarChanged() { UpdateGrammar(); }
     protected virtual void OnOperatorsChanged(EventArgs e) { RaiseOperatorsChanged(e); }
     protected virtual void OnSolutionCreatorChanged(EventArgs e) {
@@ -231,4 +233,10 @@
 
     #region event handlers
+    private void FunctionTreeGrammarParameter_ValueChanged(object sender, EventArgs e) {
+      if (!(FunctionTreeGrammar is GlobalSymbolicExpressionGrammar))
+        FunctionTreeGrammar = new GlobalSymbolicExpressionGrammar(FunctionTreeGrammar);
+      OnGrammarChanged();
+    }
+
     private void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) {
       OnSolutionCreatorChanged(e);
@@ -287,5 +295,4 @@
       operators = new List<IOperator>();
       operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>().OfType<IOperator>());
-      operators.Add(new SymbolicRegressionTournamentPruning());
       operators.Add(new SymbolicRegressionVariableFrequencyAnalyzer());
       operators.Add(new MinAverageMaxSymbolicExpressionTreeSizeAnalyzer());
Index: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs
===================================================================
--- branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs	(revision 4340)
+++ branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs	(revision 4341)
@@ -26,4 +26,5 @@
 using HeuristicLab.Core;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
 
 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
@@ -50,7 +51,13 @@
 
     protected override void RecalculateEstimatedValues() {
-      estimatedValues = (from x in Model.GetEstimatedValues(ProblemData, 0, ProblemData.Dataset.Rows)
-                         let boundedX = Math.Min(UpperEstimationLimit, Math.Max(LowerEstimationLimit, x))
-                         select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX).ToList();
+      int minLag = 0;
+      var laggedTreeNodes = Model.SymbolicExpressionTree.IterateNodesPrefix().OfType<LaggedVariableTreeNode>();
+      if (laggedTreeNodes.Any())
+        minLag = laggedTreeNodes.Min(node => node.Lag);
+      IEnumerable<double> calculatedValues =
+          from x in Model.GetEstimatedValues(ProblemData, 0 - minLag, ProblemData.Dataset.Rows)
+          let boundedX = Math.Min(UpperEstimationLimit, Math.Max(LowerEstimationLimit, x))
+          select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX;
+      estimatedValues = Enumerable.Repeat(double.NaN, Math.Abs(minLag)).Concat(calculatedValues).ToList();
       OnEstimatedValuesChanged();
     }
Index: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblemData.cs
===================================================================
--- branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblemData.cs	(revision 4340)
+++ branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblemData.cs	(revision 4341)
@@ -69,13 +69,10 @@
       get { return (IValueParameter<Dataset>)Parameters["Dataset"]; }
     }
-
     public IValueParameter<StringValue> TargetVariableParameter {
       get { return (IValueParameter<StringValue>)Parameters["TargetVariable"]; }
     }
-
     public IValueParameter<ICheckedItemList<StringValue>> InputVariablesParameter {
       get { return (IValueParameter<ICheckedItemList<StringValue>>)Parameters["InputVariables"]; }
     }
-
     public IValueParameter<IntValue> TrainingSamplesStartParameter {
       get { return (IValueParameter<IntValue>)Parameters["TrainingSamplesStart"]; }
@@ -204,5 +201,5 @@
 
     [StorableConstructor]
-    private DataAnalysisProblemData(bool deserializing) : base() { }
+    private DataAnalysisProblemData(bool deserializing) : base(deserializing) { }
 
     [StorableHook(HookType.AfterDeserialization)]
@@ -242,12 +239,12 @@
 
     #region parameter value changed event handlers
-    void DatasetParameter_ValueChanged(object sender, EventArgs e) {
-      OnProblemDataChanged(EventArgs.Empty);
-    }
-    void InputVariablesParameter_ValueChanged(object sender, EventArgs e) {
+    private void DatasetParameter_ValueChanged(object sender, EventArgs e) {
+      OnProblemDataChanged(EventArgs.Empty);
+    }
+    private void InputVariablesParameter_ValueChanged(object sender, EventArgs e) {
       RegisterInputVariablesEventHandlers();
       OnProblemDataChanged(EventArgs.Empty);
     }
-    void TargetVariableParameter_ValueChanged(object sender, EventArgs e) {
+    private void TargetVariableParameter_ValueChanged(object sender, EventArgs e) {
       if (TargetVariable != null) {
         RegisterStringValueEventHandlers(TargetVariable);
@@ -255,17 +252,17 @@
       }
     }
-    void TrainingSamplesStartParameter_ValueChanged(object sender, EventArgs e) {
+    private void TrainingSamplesStartParameter_ValueChanged(object sender, EventArgs e) {
       RegisterValueTypeEventHandlers(TrainingSamplesStart);
       OnProblemDataChanged(EventArgs.Empty);
     }
-    void TrainingSamplesEndParameter_ValueChanged(object sender, EventArgs e) {
+    private void TrainingSamplesEndParameter_ValueChanged(object sender, EventArgs e) {
       RegisterValueTypeEventHandlers(TrainingSamplesEnd);
       OnProblemDataChanged(EventArgs.Empty);
     }
-    void TestSamplesStartParameter_ValueChanged(object sender, EventArgs e) {
+    private void TestSamplesStartParameter_ValueChanged(object sender, EventArgs e) {
       RegisterValueTypeEventHandlers(TestSamplesStart);
       OnProblemDataChanged(EventArgs.Empty);
     }
-    void TestSamplesEndParameter_ValueChanged(object sender, EventArgs e) {
+    private void TestSamplesEndParameter_ValueChanged(object sender, EventArgs e) {
       RegisterValueTypeEventHandlers(TestSamplesEnd);
       OnProblemDataChanged(EventArgs.Empty);
@@ -278,6 +275,7 @@
       InputVariables.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<HeuristicLab.Collections.IndexedItem<StringValue>>(InputVariables_ItemsRemoved);
       InputVariables.CheckedItemsChanged += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<HeuristicLab.Collections.IndexedItem<StringValue>>(InputVariables_CheckedItemsChanged);
-      foreach (var item in InputVariables)
+      foreach (var item in InputVariables) {
         item.ValueChanged += new EventHandler(InputVariable_ValueChanged);
+      }
     }
 
@@ -295,5 +293,4 @@
       OnProblemDataChanged(e);
     }
-
     private void InputVariables_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<HeuristicLab.Collections.IndexedItem<StringValue>> e) {
       foreach (var indexedItem in e.Items)
@@ -301,5 +298,4 @@
       OnProblemDataChanged(e);
     }
-
     private void InputVariables_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<HeuristicLab.Collections.IndexedItem<StringValue>> e) {
       foreach (var indexedItem in e.Items)
@@ -307,5 +303,4 @@
       OnProblemDataChanged(e);
     }
-
     private void InputVariables_CollectionReset(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<HeuristicLab.Collections.IndexedItem<StringValue>> e) {
       foreach (var indexedItem in e.OldItems)
@@ -313,30 +308,25 @@
       OnProblemDataChanged(e);
     }
-
-    void InputVariable_ValueChanged(object sender, EventArgs e) {
-      OnProblemDataChanged(e);
-    }
+    private void InputVariable_ValueChanged(object sender, EventArgs e) {
+      OnProblemDataChanged(e);
+    }
+
     #region helper
-
     private void RegisterValueTypeEventHandlers<T>(ValueTypeValue<T> value) where T : struct {
       value.ValueChanged += new EventHandler(value_ValueChanged);
     }
-
     private void DeregisterValueTypeEventHandlers<T>(ValueTypeValue<T> value) where T : struct {
       value.ValueChanged -= new EventHandler(value_ValueChanged);
     }
-
-    void value_ValueChanged(object sender, EventArgs e) {
-      OnProblemDataChanged(e);
-    }
-
     private void RegisterStringValueEventHandlers(StringValue value) {
       value.ValueChanged += new EventHandler(value_ValueChanged);
     }
-
     private void DeregisterStringValueEventHandlers(StringValue value) {
       value.ValueChanged -= new EventHandler(value_ValueChanged);
     }
 
+    private void value_ValueChanged(object sender, EventArgs e) {
+      OnProblemDataChanged(e);
+    }
     #endregion
     #endregion
Index: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/ArithmeticExpressionGrammar.cs
===================================================================
--- branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/ArithmeticExpressionGrammar.cs	(revision 4340)
+++ branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/ArithmeticExpressionGrammar.cs	(revision 4341)
@@ -30,7 +30,4 @@
   [Item("ArithmeticExpressionGrammar", "Represents a grammar for functional expressions using only arithmetic operations.")]
   public class ArithmeticExpressionGrammar : DefaultSymbolicExpressionGrammar {
-    [Storable]
-    private HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable variableSymbol;
-
     public ArithmeticExpressionGrammar()
       : base() {
@@ -49,5 +46,5 @@
       constant.MinValue = -20;
       constant.MaxValue = 20;
-      variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable();
+      var variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable();
 
       var allSymbols = new List<Symbol>() { add, sub, mul, div, constant, variableSymbol };
Index: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/FullFunctionalExpressionGrammar.cs
===================================================================
--- branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/FullFunctionalExpressionGrammar.cs	(revision 4340)
+++ branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/FullFunctionalExpressionGrammar.cs	(revision 4341)
@@ -30,7 +30,4 @@
   [Item("FullFunctionalExpressionGrammar", "Represents a grammar for functional expressions using all available functions.")]
   public class FullFunctionalExpressionGrammar : DefaultSymbolicExpressionGrammar {
-    [Storable]
-    private HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable variableSymbol;
-
     public FullFunctionalExpressionGrammar()
       : base() {
@@ -60,10 +57,13 @@
       constant.MinValue = -20;
       constant.MaxValue = 20;
-      variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable();
+      var variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable();
+      var laggedVariable = new LaggedVariable();
+      laggedVariable.InitialFrequency = 0.0;
 
-      var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, exp, @if, gt, lt, and, or, not, constant, variableSymbol };
+      var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, exp, @if, gt, lt, and, or, not, constant, variableSymbol, laggedVariable };
       var unaryFunctionSymbols = new List<Symbol>() { sin, cos, tan, log, exp, not };
       var binaryFunctionSymbols = new List<Symbol>() { gt, lt };
       var functionSymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or };
+      var terminalSymbols = new List<Symbol>() { variableSymbol, constant, laggedVariable };
 
       foreach (var symb in allSymbols)
@@ -83,10 +83,12 @@
       }
 
+      foreach (var terminalSymbol in terminalSymbols) {
+        SetMinSubtreeCount(terminalSymbol, 0);
+        SetMaxSubtreeCount(terminalSymbol, 0);
+      }
+
       SetMinSubtreeCount(@if, 3);
       SetMaxSubtreeCount(@if, 3);
-      SetMinSubtreeCount(constant, 0);
-      SetMaxSubtreeCount(constant, 0);
-      SetMinSubtreeCount(variableSymbol, 0);
-      SetMaxSubtreeCount(variableSymbol, 0);
+
 
       // allow each symbol as child of the start symbol
