Index: trunk/sources/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj
===================================================================
--- trunk/sources/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj	(revision 5371)
+++ trunk/sources/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj	(revision 5373)
@@ -12,5 +12,6 @@
     <AssemblyName>HeuristicLab.Analysis-3.3</AssemblyName>
     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
-    <TargetFrameworkProfile></TargetFrameworkProfile>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
     <FileAlignment>512</FileAlignment>
     <SignAssembly>true</SignAssembly>
@@ -131,4 +132,5 @@
     <Compile Include="QualityAnalysis\BestAverageWorstQualityCalculator.cs" />
     <Compile Include="QualityAnalysis\BestQualityMemorizer.cs" />
+    <Compile Include="QualityAnalysis\QualityDistributionAnalyzer.cs" />
     <Compile Include="QualityAnalysis\QualityAnalyzer.cs" />
     <Compile Include="QualityAnalysis\QualityDifferenceCalculator.cs" />
Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj	(revision 5371)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj	(revision 5373)
@@ -129,4 +129,5 @@
     <Compile Include="Interfaces\ISymbolicExpressionTreeCreator.cs" />
     <Compile Include="Interfaces\ISymbolicExpressionTreeCrossover.cs" />
+    <Compile Include="Interfaces\ISymbolicExpressionTreeNode.cs" />
     <Compile Include="Manipulators\ChangeNodeTypeManipulation.cs" />
     <Compile Include="Interfaces\ISymbolicExpressionTreeManipulator.cs" />
Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeNode.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeNode.cs	(revision 5373)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeNode.cs	(revision 5373)
@@ -0,0 +1,50 @@
+﻿#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.Collections.Generic;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  public interface ISymbolicExpressionTreeNode {
+    ISymbolicExpressionGrammar Grammar { get; }
+
+    Symbol Symbol { get; }
+    bool HasLocalParameters { get; }
+    IEnumerable<Symbol> GetAllowedSymbols(int argumentIndex);
+
+    int GetHeight();
+    int GetSize();
+    int GetMinSubtreeCount();
+    int GetMaxSubtreeCount();
+
+    IEnumerable<SymbolicExpressionTreeNode> IterateNodesPostfix();
+    IEnumerable<SymbolicExpressionTreeNode> IterateNodesPrefix();
+
+    IList<SymbolicExpressionTreeNode> SubTrees { get; }
+    void AddSubTree(SymbolicExpressionTreeNode tree);
+    void InsertSubTree(int index, SymbolicExpressionTreeNode tree);
+    void RemoveSubTree(int index);
+
+    void ResetLocalParameters(IRandom random);
+    void ShakeLocalParameters(IRandom random, double shakingFactor);
+
+
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs	(revision 5371)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs	(revision 5373)
@@ -26,4 +26,5 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
@@ -76,8 +77,5 @@
 
     protected override void RecalculateEstimatedValues() {
-      int minLag = 0;
-      var laggedTreeNodes = Model.SymbolicExpressionTree.IterateNodesPrefix().OfType<LaggedVariableTreeNode>();
-      if (laggedTreeNodes.Any())
-        minLag = laggedTreeNodes.Min(node => node.Lag);
+      int minLag = GetMinimumLagFromTree(Model.SymbolicExpressionTree.Root);
       IEnumerable<double> calculatedValues =
           from x in Model.GetEstimatedValues(ProblemData, 0 - minLag, ProblemData.Dataset.Rows)
@@ -93,4 +91,19 @@
         yield return estimatedValues[row];
     }
+
+    protected int GetMinimumLagFromTree(SymbolicExpressionTreeNode node) {
+      if (node == null) return 0;
+      int lag = 0;
+
+      var laggedTreeNode = node as ILaggedTreeNode;
+      if (laggedTreeNode != null) lag += laggedTreeNode.Lag;
+      if (node.Symbol is Derivative) lag -= 4;
+
+      int subtreeLag = 0;
+      foreach (var subtree in node.SubTrees) {
+        subtreeLag = Math.Min(subtreeLag, GetMinimumLagFromTree(subtree));
+      }
+      return lag + subtreeLag;
+    }
   }
 }
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 5371)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/HeuristicLab.Problems.DataAnalysis.Views-3.3.csproj	(revision 5373)
@@ -205,4 +205,10 @@
       <DependentUpon>LaggedVariableView.cs</DependentUpon>
     </Compile>
+    <Compile Include="Symbolic\Symbols\TimeLagView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="Symbolic\Symbols\TimeLagView.Designer.cs">
+      <DependentUpon>TimeLagView.cs</DependentUpon>
+    </Compile>
     <Compile Include="Symbolic\Symbols\VariableView.cs">
       <SubType>UserControl</SubType>
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/Symbols/TimeLagView.Designer.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/Symbols/TimeLagView.Designer.cs	(revision 5373)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/Symbols/TimeLagView.Designer.cs	(revision 5373)
@@ -0,0 +1,143 @@
+﻿#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 LaggedSymbolView {
+    /// <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();
+      // 
+      // 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);
+      // 
+      // TimeLagView
+      // 
+      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 = "TimeLagView";
+      this.Size = new System.Drawing.Size(408, 141);
+      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.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/TimeLagView.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/Symbols/TimeLagView.cs	(revision 5373)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/Symbols/TimeLagView.cs	(revision 5373)
@@ -0,0 +1,109 @@
+﻿#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.Windows.Forms;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
+using HeuristicLab.MainForm;
+using HeuristicLab.MainForm.WindowsForms;
+using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
+
+namespace HeuristicLab.Problems.DataAnalysis.Views.Symbolic.Symbols {
+  [View("LaggedSymbol View")]
+  [Content(typeof(LaggedSymbol), true)]
+  public partial class LaggedSymbolView : SymbolView {
+    public new LaggedSymbol Content {
+      get { return (LaggedSymbol)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public LaggedSymbolView() {
+      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;
+      minTimeOffsetTextBox.ReadOnly = ReadOnly;
+      maxTimeOffsetTextBox.Enabled = Content != null;
+      maxTimeOffsetTextBox.ReadOnly = ReadOnly;
+    }
+
+    #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/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj	(revision 5371)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj	(revision 5373)
@@ -108,4 +108,7 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Symbolic\Symbols\Derivative.cs" />
+    <Compile Include="Symbolic\Symbols\Integral.cs" />
+    <Compile Include="Symbolic\Symbols\TimeLag.cs" />
     <Compile Include="Symbolic\TypeCoherentExpressionGrammar.cs" />
     <Compile Include="Symbolic\Symbols\Power.cs" />
@@ -133,4 +136,5 @@
     <Compile Include="Evaluators\SimpleVarianceAccountedForEvaluator.cs" />
     <Compile Include="HeuristicLabProblemsDataAnalysisPlugin.cs" />
+    <Compile Include="Interfaces\ILaggedTreeNode.cs" />
     <Compile Include="Interfaces\ISingleObjectiveDataAnalysisProblem.cs" />
     <Compile Include="Interfaces\IDataAnalysisModel.cs" />
@@ -151,6 +155,8 @@
     <Compile Include="Symbolic\SymbolicSimplifier.cs" />
     <Compile Include="Symbolic\Symbols\Addition.cs" />
+    <Compile Include="Symbolic\Symbols\LaggedSymbol.cs" />
     <Compile Include="Symbolic\Symbols\Constant.cs" />
     <Compile Include="Symbolic\Symbols\ConstantTreeNode.cs" />
+    <Compile Include="Symbolic\Symbols\LaggedTreeNode.cs" />
     <Compile Include="Symbolic\Symbols\LaggedVariable.cs" />
     <Compile Include="Symbolic\Symbols\LaggedVariableTreeNode.cs" />
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Interfaces/ILaggedTreeNode.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Interfaces/ILaggedTreeNode.cs	(revision 5373)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Interfaces/ILaggedTreeNode.cs	(revision 5373)
@@ -0,0 +1,28 @@
+﻿#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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+namespace HeuristicLab.Problems.DataAnalysis {
+  public interface ILaggedTreeNode : ISymbolicExpressionTreeNode {
+    int Lag { get; set; }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/FullFunctionalExpressionGrammar.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/FullFunctionalExpressionGrammar.cs	(revision 5371)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/FullFunctionalExpressionGrammar.cs	(revision 5373)
@@ -61,4 +61,12 @@
       var or = new Or();
       var not = new Not();
+
+      var timeLag = new TimeLag();
+      timeLag.InitialFrequency = 0.0;
+      var integral = new Integral();
+      integral.InitialFrequency = 0.0;
+      var derivative = new Derivative();
+      derivative.InitialFrequency = 0.0;
+
       var constant = new Constant();
       constant.MinValue = -20;
@@ -68,6 +76,7 @@
       laggedVariable.InitialFrequency = 0.0;
 
-      var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, pow, exp, @if, gt, lt, and, or, not, constant, variableSymbol, laggedVariable };
-      var unaryFunctionSymbols = new List<Symbol>() { sin, cos, tan, log, exp, not };
+      var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, pow, exp, @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable };
+      var unaryFunctionSymbols = new List<Symbol>() { sin, cos, tan, log, exp, not, timeLag, integral, derivative };
+
       var binaryFunctionSymbols = new List<Symbol>() { pow, gt, lt };
       var functionSymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or };
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs	(revision 5371)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs	(revision 5373)
@@ -67,4 +67,7 @@
 
       public const byte Power = 22;
+      public const byte TimeLag = 23;
+      public const byte Integral = 24;
+      public const byte Derivative = 25;
     }
 
@@ -92,4 +95,7 @@
       { typeof(Argument), OpCodes.Arg },
       { typeof(Power),OpCodes.Power},
+      { typeof(TimeLag), OpCodes.TimeLag}, 
+      { typeof(Integral), OpCodes.Integral},
+      {typeof(Derivative), OpCodes.Derivative},
     };
     private const int ARGUMENT_STACK_SIZE = 1024;
@@ -244,4 +250,48 @@
             else return -1.0;
           }
+        case OpCodes.TimeLag: {
+            var timeLagTreeNode = (LaggedTreeNode)currentInstr.dynamicNode;
+            if (row + timeLagTreeNode.Lag < 0 || row + timeLagTreeNode.Lag >= dataset.Rows)
+              return double.NaN;
+
+            row += timeLagTreeNode.Lag;
+            double result = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer);
+            row -= timeLagTreeNode.Lag;
+            return result;
+          }
+        case OpCodes.Integral: {
+            int nextPc = pc;
+            var timeLagTreeNode = (LaggedTreeNode)currentInstr.dynamicNode;
+            if (row + timeLagTreeNode.Lag < 0 || row + timeLagTreeNode.Lag >= dataset.Rows)
+              return double.NaN;
+            double sum = 0.0;
+            for (int i = 0; i < Math.Abs(timeLagTreeNode.Lag); i++) {
+              row += Math.Sign(timeLagTreeNode.Lag);
+              sum += Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer);
+              pc = nextPc;
+            }
+            row -= timeLagTreeNode.Lag;
+            sum += Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer);
+            return sum;
+          }
+
+        //mkommend: derivate calculation taken from: 
+        //http://www.holoborodko.com/pavel/numerical-methods/numerical-derivative/smooth-low-noise-differentiators/
+        //one sided smooth differentiatior, N = 4
+        // y' = 1/8h (f_i + 2f_i-1, -2 f_i-3 - f_i-4)
+        case OpCodes.Derivative: {
+            if (row - 4 < 0) return double.NaN;
+            int nextPc = pc;
+            double f_0 = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); ; row--;
+            pc = nextPc;
+            double f_1 = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); ; row -= 2;
+            pc = nextPc;
+            double f_3 = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); ; row--;
+            pc = nextPc;
+            double f_4 = Evaluate(dataset, ref row, code, ref pc, argumentStack, ref argStackPointer); ;
+            row += 4;
+
+            return (f_0 + 2 * f_1 - 2 * f_3 - f_4) / 8; // h = 1
+          }
         case OpCodes.Call: {
             // evaluate sub-trees
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Derivative.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Derivative.cs	(revision 5373)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Derivative.cs	(revision 5373)
@@ -0,0 +1,37 @@
+#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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
+  [StorableClass]
+  [Item("Derivative", "Represents the derivative over the specified subtree.")]
+  public sealed class Derivative : Symbol {
+    [StorableConstructor]
+    private Derivative(bool deserializing) : base(deserializing) { }
+    private Derivative(Derivative original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) { return new Derivative(this, cloner); }
+
+    public Derivative() : base("Derivative", "Represents the derivative over the specified subtree.") { }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Integral.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Integral.cs	(revision 5373)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Integral.cs	(revision 5373)
@@ -0,0 +1,36 @@
+#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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
+  [StorableClass]
+  [Item("Integral", "Represents the integral over the specified subtree.")]
+  public sealed class Integral : LaggedSymbol {
+    [StorableConstructor]
+    private Integral(bool deserializing) : base(deserializing) { }
+    private Integral(Integral original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) { return new Integral(this, cloner); }
+
+    public Integral() : base("Integral", "Represents the integral over the specified subtree.") { }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedSymbol.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedSymbol.cs	(revision 5373)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedSymbol.cs	(revision 5373)
@@ -0,0 +1,44 @@
+﻿using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
+  [StorableClass]
+  [Item("LaggedSymbol", "Represents a symblol whose evaluation is shifted.")]
+  public abstract class LaggedSymbol : Symbol {
+    [Storable]
+    private int minLag;
+    public virtual int MinLag {
+      get { return minLag; }
+      set { minLag = value; }
+    }
+    [Storable]
+    private int maxLag;
+    public virtual int MaxLag {
+      get { return maxLag; }
+      set { maxLag = value; }
+    }
+
+    [StorableConstructor]
+    protected LaggedSymbol(bool deserializing) : base(deserializing) { }
+    protected LaggedSymbol(LaggedSymbol original, Cloner cloner)
+      : base(original, cloner) {
+      minLag = original.minLag;
+      maxLag = original.maxLag;
+    }
+    protected LaggedSymbol()
+      : base("LaggedSymbol", "Represents a symbol whose evaluation is shifted.") {
+      minLag = -1; maxLag = -1;
+    }
+    protected LaggedSymbol(string name, string description)
+      : base(name, description) {
+      minLag = -1; maxLag = -1;
+    }
+
+    public override SymbolicExpressionTreeNode CreateTreeNode() {
+      return new LaggedTreeNode(this);
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedTreeNode.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedTreeNode.cs	(revision 5373)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedTreeNode.cs	(revision 5373)
@@ -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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
+  [StorableClass]
+  public class LaggedTreeNode : SymbolicExpressionTreeNode, ILaggedTreeNode {
+    public new LaggedSymbol Symbol {
+      get { return (LaggedSymbol)base.Symbol; }
+    }
+    [Storable]
+    private int lag;
+    public int Lag {
+      get { return lag; }
+      set { lag = value; }
+    }
+
+    [StorableConstructor]
+    protected LaggedTreeNode(bool deserializing) : base(deserializing) { }
+    protected LaggedTreeNode(LaggedTreeNode original, Cloner cloner)
+      : base(original, cloner) {
+      lag = original.lag;
+    }
+    public LaggedTreeNode(LaggedSymbol timeLagSymbol) : base(timeLagSymbol) { }
+
+    public override bool HasLocalParameters {
+      get { return true; }
+    }
+
+    public override void ResetLocalParameters(IRandom random) {
+      base.ResetLocalParameters(random);
+      lag = random.Next(Symbol.MinLag, Symbol.MaxLag + 1);
+    }
+
+    public override void ShakeLocalParameters(IRandom random, double shakingFactor) {
+      base.ShakeLocalParameters(random, shakingFactor);
+      lag = Math.Min(Symbol.MaxLag, Math.Max(Symbol.MinLag, lag + random.Next(-1, 2)));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new LaggedTreeNode(this, cloner);
+    }
+
+    public override string ToString() {
+      return base.ToString() + " " + lag.ToString();
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs	(revision 5371)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs	(revision 5373)
@@ -26,5 +26,5 @@
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
   [StorableClass]
-  public sealed class LaggedVariableTreeNode : VariableTreeNode {
+  public sealed class LaggedVariableTreeNode : VariableTreeNode, ILaggedTreeNode {
     public new LaggedVariable Symbol {
       get { return (LaggedVariable)base.Symbol; }
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/TimeLag.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/TimeLag.cs	(revision 5373)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/TimeLag.cs	(revision 5373)
@@ -0,0 +1,37 @@
+﻿#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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
+  [StorableClass]
+  [Item("TimeLag", "Represents a symblol whose evaluation is shifted.")]
+  public sealed class TimeLag : LaggedSymbol {
+    [StorableConstructor]
+    private TimeLag(bool deserializing) : base(deserializing) { }
+    private TimeLag(TimeLag original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) { return new TimeLag(this, cloner); }
+
+    public TimeLag() : base("TimeLag", "Represents a symblol whose evaluation is shifted.") { }
+  }
+}
