Index: branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/WindowedSymbolTreeNode.cs
===================================================================
--- branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableTreeNodeBase.cs	(revision 17362)
+++ branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/WindowedSymbolTreeNode.cs	(revision 17573)
@@ -20,4 +20,5 @@
 #endregion
 
+using System;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -25,44 +26,53 @@
 using HEAL.Attic;
 using HeuristicLab.Random;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableType("B92EF904-18EC-41FC-9123-9B9293246815")]
-  public abstract class VariableTreeNodeBase : SymbolicExpressionTreeTerminalNode, IVariableTreeNode {
-    public new VariableBase Symbol {
-      get { return (VariableBase)base.Symbol; }
+  [StorableType("E79432BB-414D-4535-8751-D0139AF048E1")]
+  public class WindowedSymbolTreeNode : SymbolicExpressionTreeNode, IWindowedSymbolTreeNode {
+    public new WindowedSymbol Symbol {
+      get { return (WindowedSymbol)base.Symbol; }
     }
     [Storable]
-    private double weight;
-    public double Weight {
-      get { return weight; }
-      set { weight = value; }
+    private double offset;
+    public double Offset {
+      get { return offset; }
+      set { offset = Math.Min(Math.Max(value, 0.0), 1.0); }     
     }
     [Storable]
-    private string variableName;
-    public string VariableName {
-      get { return variableName; }
-      set { variableName = value; }
+    private double length;
+    public double Length {
+      get { return length; }
+      set { length = Math.Min(Math.Max(value, 0.0), 1.0); }
     }
 
     [StorableConstructor]
-    protected VariableTreeNodeBase(StorableConstructorFlag _) : base(_) { }
-    protected VariableTreeNodeBase(VariableTreeNodeBase original, Cloner cloner)
+    protected WindowedSymbolTreeNode(StorableConstructorFlag _) : base(_) { }
+    protected WindowedSymbolTreeNode(WindowedSymbolTreeNode original, Cloner cloner)
       : base(original, cloner) {
-      weight = original.weight;
-      variableName = original.variableName;
+      offset = original.offset;
+      length = original.length;
     }
-    protected VariableTreeNodeBase() { }
-    protected VariableTreeNodeBase(VariableBase variableSymbol) : base(variableSymbol) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new WindowedSymbolTreeNode(this, cloner);
+    }
+
+    public WindowedSymbolTreeNode(WindowedSymbol windowedSymbol) : base(windowedSymbol) {
+      if (!windowedSymbol.EnableWindowing) {
+        Offset = 0.0;
+        Length = 1.0;
+      }
+    }
 
     public override bool HasLocalParameters {
-      get { return true; }
+      get { return Symbol.EnableWindowing; }
     }
 
     public override void ResetLocalParameters(IRandom random) {
       base.ResetLocalParameters(random);
-      weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma);
 
-#pragma warning disable 612, 618
-      variableName = Symbol.VariableNames.SelectRandom(random);
-#pragma warning restore 612, 618
+      if (Symbol.EnableWindowing) {
+        Offset = NormalDistributedRandom.NextDouble(random, Symbol.OffsetMu, Symbol.OffsetSigma);
+        Length = NormalDistributedRandom.NextDouble(random, Symbol.LengthMu, Symbol.LengthSigma);
+      }
     }
 
@@ -70,33 +80,14 @@
       base.ShakeLocalParameters(random, shakingFactor);
 
-      // 50% additive & 50% multiplicative (TODO: BUG in if statement below -> fix in HL 4.0!)
-      if (random.NextDouble() < 0) {
-        double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma);
-        weight = weight + x * shakingFactor;
-      } else {
-        double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeWeightManipulatorSigma);
-        weight = weight * x;
-      }
-
-      if (Symbol.VariableChangeProbability >= 1.0) {
-        // old behaviour for backwards compatibility
-        #region Backwards compatible code, remove with 3.4
-#pragma warning disable 612, 618
-        variableName = Symbol.VariableNames.SelectRandom(random);
-#pragma warning restore 612, 618
-        #endregion
-      } else if (random.NextDouble() < Symbol.VariableChangeProbability) {
-        var oldName = variableName;
-        variableName = Symbol.VariableNames.SampleRandom(random);
-        if (oldName != variableName) {
-          // re-initialize weight if the variable is changed
-          weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma);
-        }
+      if (Symbol.EnableWindowing) { 
+        Offset += NormalDistributedRandom.NextDouble(random, Symbol.ManipulatorOffsetMu, Symbol.ManipulatorOffsetSigma) * shakingFactor;
+        Length += NormalDistributedRandom.NextDouble(random, Symbol.ManipulatorLengthMu, Symbol.ManipulatorLengthSigma) * shakingFactor;
       }
     }
 
     public override string ToString() {
-      if (weight.IsAlmost(1.0)) return variableName;
-      else return weight.ToString("E4") + " " + variableName;
+      return Symbol.EnableWindowing 
+        ? base.ToString() + $"[{Offset} : {Length}]" 
+        : base.ToString();
     }
   }
