Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs	(revision 7997)
@@ -147,5 +147,4 @@
         throw new ArgumentException("Cannot create trees of depth " + maxDepth + " or smaller because of grammar constraints.", "maxDepth");
 
-
       int arity = seedNode.Grammar.GetMaximumSubtreeCount(seedNode.Symbol);
       // Throw an exception if the seedNode happens to be a terminal, since in this case we cannot grow a tree.
@@ -161,5 +160,6 @@
           .Where(s => seedNode.Grammar.IsAllowedChildSymbol(seedNode.Symbol, s, i))
           .ToList();
-        var selectedSymbol = possibleSymbols.SelectRandom(random);
+        var weights = possibleSymbols.Select(s => s.InitialFrequency);
+        var selectedSymbol = possibleSymbols.SelectRandom(weights, random);
         var tree = selectedSymbol.CreateTreeNode();
         if (tree.HasLocalParameters) tree.ResetLocalParameters(random);
@@ -192,6 +192,6 @@
         if (!possibleSymbols.Any())
           throw new InvalidOperationException("No symbols are available for the tree.");
-
-        var selectedSymbol = possibleSymbols.SelectRandom(random);
+        var weights = possibleSymbols.Select(s => s.InitialFrequency);
+        var selectedSymbol = possibleSymbols.SelectRandom(weights, random);
         var tree = selectedSymbol.CreateTreeNode();
         if (tree.HasLocalParameters) tree.ResetLocalParameters(random);
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/GrowTreeCreator.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/GrowTreeCreator.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/GrowTreeCreator.cs	(revision 7997)
@@ -160,5 +160,6 @@
           .Where(s => seedNode.Grammar.IsAllowedChildSymbol(seedNode.Symbol, s, i))
           .ToList();
-        var selectedSymbol = possibleSymbols.SelectRandom(random);
+        var weights = possibleSymbols.Select(s => s.InitialFrequency);
+        var selectedSymbol = possibleSymbols.SelectRandom(weights, random);
         var tree = selectedSymbol.CreateTreeNode();
         if (tree.HasLocalParameters) tree.ResetLocalParameters(random);
@@ -189,5 +190,6 @@
         if (!possibleSymbols.Any())
           throw new InvalidOperationException("No symbols are available for the tree.");
-        var selectedSymbol = possibleSymbols.SelectRandom(random);
+        var weights = possibleSymbols.Select(s => s.InitialFrequency);
+        var selectedSymbol = possibleSymbols.SelectRandom(weights, random);
         var tree = selectedSymbol.CreateTreeNode();
         if (tree.HasLocalParameters) tree.ResetLocalParameters(random);
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs	(revision 7997)
@@ -34,5 +34,5 @@
   [StorableClass]
   [Item("ProbabilisticTreeCreator", "An operator that creates new symbolic expression trees with uniformly distributed length")]
-  public class ProbabilisticTreeCreator : SymbolicExpressionTreeCreator,
+  public class ProbabilisticTreeCreator : TracingSymbolicExpressionTreeCreator,
     ISymbolicExpressionTreeSizeConstraintOperator, ISymbolicExpressionTreeGrammarBasedOperator {
     private const int MAX_TRIES = 100;
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/TracingSymbolicExpressionTreeCrossover.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/TracingSymbolicExpressionTreeCrossover.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/TracingSymbolicExpressionTreeCrossover.cs	(revision 7997)
@@ -25,5 +25,5 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Data;
+using HeuristicLab.EvolutionaryTracking;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
@@ -127,6 +127,6 @@
       // compare the two nodes lists and check the difference (comparing node references so we avoid false functional identity). 
       // if no difference is found, then it is assumed that the whole tree was swapped with itself (it can happen), so the index is 0
-      int i = 0, min = Math.Min(nodes0.Count, nodes1.Count);
-      for (; i != min; ++i)
+      int i, min = Math.Min(nodes0.Count, nodes1.Count);
+      for (i = 0; i != min; ++i)
         if (nodes0[i] != nodes1[i]) break;
       if (i == min) i = 0;
@@ -134,5 +134,5 @@
       // add heredity information into the global variables
       GlobalTraceMap[Child] = originalParents; // map child to its corresponding parents from the previous generation
-      GlobalFragmentMap[Child] = new IntValue(i); // map child to the index of its fragment
+      GlobalFragmentMap[Child] = new GenericWrapper<ISymbolicExpressionTreeNode>(nodes1[i]); // map child to the index of its fragment
       return base.Apply();
     }
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/GenericWrapper.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/GenericWrapper.cs	(revision 7997)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/GenericWrapper.cs	(revision 7997)
@@ -0,0 +1,30 @@
+﻿using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  [Item("Generic wrapper", "Wrapper class for non-item HeuristicLab objects")]
+  public class GenericWrapper<T> : NamedItem where T : class {
+    public T Content { get; private set; }
+
+    private GenericWrapper() {
+    }
+
+    public GenericWrapper(T content) {
+      Content = content;
+    }
+
+    [StorableConstructor]
+    protected GenericWrapper(bool serializing)
+      : base(serializing) {
+    }
+
+    private GenericWrapper(GenericWrapper<T> original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GenericWrapper<T>(this, cloner);
+    }
+  }
+}
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj	(revision 7997)
@@ -180,4 +180,5 @@
     <Compile Include="Crossovers\AssortativeSymbolicExpressionTreeCrossover.cs" />
     <Compile Include="Crossovers\TracingSymbolicExpressionTreeCrossover.cs" />
+    <Compile Include="GenericWrapper.cs" />
     <Compile Include="Interfaces\IReadOnlySymbol.cs" />
     <Compile Include="Interfaces\ISymbolicExpressionGrammar.cs" />
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj.user
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj.user	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj.user	(revision 7997)
@@ -7,5 +7,5 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
     <StartAction>Program</StartAction>
-    <StartProgram>C:\Users\Bogdan\Desktop\Trunk\sources\bin\HeuristicLab 3.3.exe</StartProgram>
+    <StartProgram>C:\Users\bburlacu\Desktop\HL-Core\Trunk\sources\bin\HeuristicLab 3.3.exe</StartProgram>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/TracingSymbolicExpressionTreeManipulator.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/TracingSymbolicExpressionTreeManipulator.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/TracingSymbolicExpressionTreeManipulator.cs	(revision 7997)
@@ -21,8 +21,8 @@
 
 using System;
-using System.Linq;
+using System.Collections.Generic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Data;
+using HeuristicLab.EvolutionaryTracking;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
@@ -109,12 +109,12 @@
         GlobalTraceMap[tree] = new ItemList<IItem> { original };
       }
-      var nodes0 = tree.IterateNodesBreadth().ToList();
+      var nodes0 = tree.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>;
       Manipulate(RandomParameter.ActualValue, tree);
-      var nodes1 = tree.IterateNodesBreadth().ToList();
+      var nodes1 = tree.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>;
       int i, min = Math.Max(nodes0.Count, nodes1.Count);
       for (i = 0; i != min; ++i)
         if (nodes0[i] != nodes1[i]) break;
       if (i == min) i = 0;
-      GlobalFragmentMap[tree] = new IntValue(i);
+      GlobalFragmentMap[tree] = new GenericWrapper<ISymbolicExpressionTreeNode>(nodes1[i]);
 
       return base.Apply();
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Plugin.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Plugin.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Plugin.cs	(revision 7997)
@@ -26,5 +26,5 @@
 
 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
-  [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.2.7800")]
+  [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.2.7817")]
   [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll", PluginFileType.Assembly)]
   [PluginDependency("HeuristicLab.Analysis", "3.3")]
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.cs	(revision 7997)
@@ -88,5 +88,5 @@
     // TODO: Put event handlers of child controls here.
     private void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs e) {
-      // the hierarchy goes like this: VisualGenealogyGraphNode --> GenealogyGraphNode --> symbolicExpressionTree
+      // the type hierarchy goes like this: VisualGenealogyGraphNode --> GenealogyGraphNode --> symbolicExpressionTree
       var visualGenealogyGraphNode = (VisualGenealogyGraphNode)sender;
       var genealogyGraphNode = (GenealogyGraphNode)visualGenealogyGraphNode.Data;
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeFragmentsAnalyzer.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeFragmentsAnalyzer.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeFragmentsAnalyzer.cs	(revision 7997)
@@ -20,5 +20,4 @@
 #endregion
 
-using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -32,6 +31,7 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-// type definitions for ease of use
+// type definitions for convenience
 using CloneMapType = HeuristicLab.Core.ItemDictionary<HeuristicLab.Core.IItem, HeuristicLab.Core.IItem>;
+using SymbolicExpressionTreeNodeItem = HeuristicLab.EvolutionaryTracking.GenericWrapper<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.SymbolicExpressionTreeNode>;
 using TraceMapType = HeuristicLab.Core.ItemDictionary<HeuristicLab.Core.IItem, HeuristicLab.Core.IItemList<HeuristicLab.Core.IItem>>;
 
@@ -41,5 +41,5 @@
   /// (Tracking of genetic variance and heredity)
   /// </summary>
-  /// [Item("SymbolicExpressionTreeGenealogyAnalyzer", "An operator that tracks tree lengths of Symbolic Expression Trees")]
+  [Item("SymbolicExpressionTreeFragmentsAnalyzer", "An operator that provides statistics about crossover fragments")]
   [StorableClass]
   public sealed class SymbolicExpressionTreeFragmentsAnalyzer : SingleSuccessorOperator, IAnalyzer {
@@ -47,4 +47,7 @@
     private const string UpdateCounterParameterName = "UpdateCounter";
     private const string ResultsParameterName = "Results";
+    private const string SecondaryTraceMapParameterName = "SecondaryTraceMap";
+    private const string SecondaryFragmentMapParameterName = "SecondaryFragmentMap";
+    private const string SecondaryCloneMapParameterName = "SecondaryCloneMap";
     private const string GlobalTraceMapParameterName = "GlobalTraceMap";
     private const string GlobalCloneMapParameterName = "GlobalCloneMap";
@@ -53,4 +56,5 @@
     private const string FragmentStatisticsParameterName = "FragmentStatistics";
     private const string FragmentLengthsDistributionParametersName = "FragmentLengths";
+    private const string FragmentFrequenciesParameterName = "FragmentFrequencies";
 
     #region Parameter properties
@@ -64,4 +68,8 @@
       get { return (LookupParameter<ResultCollection>)Parameters[ResultsParameterName]; }
     }
+    public LookupParameter<IntValue> GenerationsParameter {
+      get { return (LookupParameter<IntValue>)Parameters[GenerationsParameterName]; }
+    }
+    // tracking structures
     public LookupParameter<TraceMapType> GlobalTraceMapParameter {
       get { return (LookupParameter<TraceMapType>)Parameters[GlobalTraceMapParameterName]; }
@@ -73,6 +81,6 @@
       get { return (LookupParameter<CloneMapType>)Parameters[GlobalFragmentMapParameterName]; }
     }
-    public LookupParameter<IntValue> GenerationsParameter {
-      get { return (LookupParameter<IntValue>)Parameters[GenerationsParameterName]; }
+    public LookupParameter<ItemList<ItemList<IItem>>> FragmentFrequenciesParameter {
+      get { return (LookupParameter<ItemList<ItemList<IItem>>>)Parameters[FragmentFrequenciesParameterName]; }
     }
     public LookupParameter<DataTable> FragmentStatisticsParameter {
@@ -81,4 +89,16 @@
     public LookupParameter<DataTable> FragmentLengthsParameter {
       get { return (LookupParameter<DataTable>)Parameters[FragmentLengthsDistributionParametersName]; }
+    }
+    // auxiliary structures for tracking fragments and individuals from the previous generation
+    // (this is needed because tracking is done in connection to the current generation, i.e., for 
+    // counting "successful" offspring and fragments
+    public LookupParameter<TraceMapType> SecondaryTraceMapParameter {
+      get { return (LookupParameter<TraceMapType>)Parameters[SecondaryTraceMapParameterName]; }
+    }
+    public LookupParameter<CloneMapType> SecondaryFragmentMapParameter {
+      get { return (LookupParameter<CloneMapType>)Parameters[SecondaryFragmentMapParameterName]; }
+    }
+    public LookupParameter<CloneMapType> SecondaryCloneMapParameter {
+      get { return (LookupParameter<CloneMapType>)Parameters[SecondaryCloneMapParameterName]; }
     }
     #endregion
@@ -103,4 +123,16 @@
       get { return GlobalTraceMapParameter.ActualValue; }
     }
+    public TraceMapType SecondaryTraceMap {
+      get { return SecondaryTraceMapParameter.ActualValue; }
+      set { SecondaryTraceMapParameter.ActualValue = value; }
+    }
+    public CloneMapType SecondaryFragmentMap {
+      get { return SecondaryFragmentMapParameter.ActualValue; }
+      set { SecondaryFragmentMapParameter.ActualValue = value; }
+    }
+    public CloneMapType SecondaryCloneMap {
+      get { return SecondaryCloneMapParameter.ActualValue; }
+      set { SecondaryCloneMapParameter.ActualValue = value; }
+    }
     public CloneMapType GlobalFragmentMap {
       get { return GlobalFragmentMapParameter.ActualValue; }
@@ -114,4 +146,7 @@
     public DataTable FragmentLengths {
       get { return FragmentLengthsParameter.ActualValue; }
+    }
+    public ItemList<ItemList<IItem>> FragmentFrequencies {
+      get { return FragmentFrequenciesParameter.ActualValue; }
     }
     #endregion
@@ -129,13 +164,21 @@
     public SymbolicExpressionTreeFragmentsAnalyzer()
       : base() {
+      // analyzer update counter and update interval
       Parameters.Add(new ValueParameter<IntValue>(UpdateIntervalParameterName, "The interval in which the tree length analysis should be applied.", new IntValue(1)));
       Parameters.Add(new ValueParameter<IntValue>(UpdateCounterParameterName, "The value which counts how many times the operator was called since the last update", new IntValue(0)));
+      // tracking
       Parameters.Add(new LookupParameter<TraceMapType>(GlobalTraceMapParameterName, "A global cache containing the whole genealogy."));
       Parameters.Add(new LookupParameter<CloneMapType>(GlobalCloneMapParameterName, "A global map keeping track of trees and their clones (made during selection)."));
       Parameters.Add(new LookupParameter<CloneMapType>(GlobalFragmentMapParameterName, "A global map keeping track of tree fragments received via crossover."));
+      // secondary tracking 
+      Parameters.Add(new LookupParameter<TraceMapType>(SecondaryTraceMapParameterName, "Parameter to store the trace map from the previous generation"));
+      Parameters.Add(new LookupParameter<CloneMapType>(SecondaryCloneMapParameterName, "Parameter to store the clone map from the previous generation"));
+      Parameters.Add(new LookupParameter<CloneMapType>(SecondaryFragmentMapParameterName, "Parameter to store the fragment map from the previous generation"));
+      // other params
       Parameters.Add(new ValueLookupParameter<ResultCollection>(ResultsParameterName, "The results collection where the analysis values should be stored."));
       Parameters.Add(new LookupParameter<IntValue>(GenerationsParameterName, "The number of generations so far."));
       Parameters.Add(new LookupParameter<DataTable>(FragmentStatisticsParameterName, "The data table to store the fragment statistics."));
       Parameters.Add(new LookupParameter<DataTable>(FragmentLengthsDistributionParametersName, "The data table to store the distribution of fragment lengths."));
+      Parameters.Add(new LookupParameter<ItemList<ItemList<IItem>>>(FragmentFrequenciesParameterName, "A data structure for fragment frequencies"));
       UpdateCounterParameter.Hidden = true;
       UpdateIntervalParameter.Hidden = true;
@@ -154,4 +197,7 @@
       if (!Parameters.ContainsKey(FragmentLengthsDistributionParametersName)) {
         Parameters.Add(new LookupParameter<DataTable>(FragmentLengthsDistributionParametersName, "The data table to store the distribution of fragment lengths."));
+      }
+      if (!Parameters.ContainsKey(FragmentFrequenciesParameterName)) {
+        Parameters.Add(new LookupParameter<ItemList<ItemList<IItem>>>(FragmentFrequenciesParameterName, "A data structure for fragment frequencies"));
       }
     }
@@ -179,8 +225,15 @@
           results.Add(new Result("Fragment Statistics", FragmentStatistics));
         }
-        if (FragmentLengths == null) {
-          FragmentLengthsParameter.ActualValue = new DataTable("Fragment and Tree Lengths", "Distribution of the lengths of the trees sampled by crossover");
-          FragmentLengths.VisualProperties.XAxisTitle = "Tree/fragment length";
-          results.Add(new Result("Fragment Lengths", FragmentLengths));
+        if (FragmentFrequencies == null) {
+          FragmentFrequenciesParameter.ActualValue = new ItemList<ItemList<IItem>>();
+        }
+        if (SecondaryTraceMap == null) {
+          SecondaryTraceMap = new TraceMapType();
+        }
+        if (SecondaryCloneMap == null) {
+          SecondaryCloneMap = new CloneMapType();
+        }
+        if (SecondaryFragmentMap == null) {
+          SecondaryFragmentMap = new CloneMapType();
         }
 
@@ -189,100 +242,63 @@
         while (gScope.Parent != null) gScope = gScope.Parent;
 
-        #region Fragment Statistics
-        #region Table data
-        if (!FragmentLengths.Rows.ContainsKey("Parent lengths distribution")) {
-          var parentLenghtsRow = new DataRow("Parent lengths distribution");
-          parentLenghtsRow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
-          parentLenghtsRow.VisualProperties.StartIndexZero = true;
-          parentLenghtsRow.VisualProperties.ScaleFactor = 1.0;
-          FragmentLengths.Rows.Add(parentLenghtsRow);
-        }
-        if (!FragmentLengths.Rows.ContainsKey("Child lengths distribution")) {
-          var treeLengthsRow = new DataRow("Child lengths distribution");
-          treeLengthsRow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
-          treeLengthsRow.VisualProperties.StartIndexZero = true;
-          treeLengthsRow.VisualProperties.ScaleFactor = 1.0;
-          FragmentLengths.Rows.Add(treeLengthsRow);
-        }
-        if (!FragmentLengths.Rows.ContainsKey("Fragment lengths distribution")) {
-          var fragmentLengthsRow = new DataRow("Fragment lengths distribution");
-          fragmentLengthsRow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
-          fragmentLengthsRow.VisualProperties.StartIndexZero = true; 
-          fragmentLengthsRow.VisualProperties.ScaleFactor = 1.0;
-          FragmentLengths.Rows.Add(fragmentLengthsRow);
-        }
-        // fragments
-        if (!FragmentStatistics.Rows.ContainsKey("Average fragment length")) {
-          var row = new DataRow("Average fragment length") { VisualProperties = { StartIndexZero = true } };
-          FragmentStatistics.Rows.Add(row);
-        }
-        // child trees
-        if (!FragmentStatistics.Rows.ContainsKey("Average child length")) {
-          var row = new DataRow("Average child length") { VisualProperties = { StartIndexZero = true } };
-          FragmentStatistics.Rows.Add(row);
-        }
-
-        // parents
-        if (!FragmentStatistics.Rows.ContainsKey("Average parent length")) {
-          var row = new DataRow("Average parent length") { VisualProperties = { StartIndexZero = true } };
-          FragmentStatistics.Rows.Add(row);
-        }
-        // exact similarity
-        if (!FragmentStatistics.Rows.ContainsKey("Similarity (exact)")) {
-          var row = new DataRow("Similarity (exact)") { VisualProperties = { StartIndexZero = true } };
-          FragmentStatistics.Rows.Add(row);
-        }
-        #endregion
-
-        var fragments = new List<ISymbolicExpressionTreeNode>();
-        var parents = new List<ISymbolicExpressionTree>();
-        var trees = (from s in gScope.SubScopes select s.Variables.First().Value as ISymbolicExpressionTree).ToList();
-
-        foreach (var tree in trees.Where(x => GlobalTraceMap.ContainsKey(x))) {
-          if (GlobalTraceMap[tree].Count == 2) { // crossover 
-            var parent0 = (ISymbolicExpressionTree)GlobalTraceMap[tree][0];
-            var nodes = tree.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>;
-            var index = ((IntValue)GlobalFragmentMap[tree]).Value;
-            var fragment = nodes[index];
-            if (fragment == null) throw new ArgumentException("Fragment not found");
-            parents.Add(parent0);
-            fragments.Add(fragment);
-          } else { // crossover followed by mutation
-            // maybe mutation fragments should be also taken into account?
-            var parent0 = (ISymbolicExpressionTree)GlobalTraceMap[tree][0];
-            if (!GlobalFragmentMap.ContainsKey(parent0)) throw new ArgumentException("Fragment not found");
-            var nodes = parent0.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>;
-            var index = ((IntValue)GlobalFragmentMap[parent0]).Value;
-            var fragment = nodes[index];
-            fragments.Add(fragment);
-            if (!GlobalTraceMap.ContainsKey(parent0)) throw new ArgumentException("Parent information not found");
-            parents.Add(parent0);
+        // for this kind of tracking/analysis, we need at least 2 successive generations of crossover
+        if (Generations.Value > 1) {
+          #region Fragment Statistics
+          InitializeRows();
+          // create a dictionary for fast lookup of parents (to see which children from the previous generation become parents, and count their fragments)
+          var parentsLookup = new Dictionary<ISymbolicExpressionTree, bool>();
+          foreach (var parent in GlobalTraceMap.Values.SelectMany(x => x.Cast<ISymbolicExpressionTree>())) {
+            if (!parentsLookup.ContainsKey(parent)) {
+              parentsLookup.Add(parent, true);
+            }
           }
-        }
-        //var zeros = new List<int>(Enumerable.Repeat<int>(0, 201));
-        //var lengths = (from t in fragments
-        //               let len = t.GetLength()
-        //               orderby len
-        //               group len by len into g
-        //               select new Tuple<int,int>(g.First(), g.Count()));
-        //foreach (var len in lengths)
-        //  zeros[len.Item1] = len.Item2;
-        FragmentLengths.Rows["Parent lengths distribution"].Values.Replace(parents.Select(x => (double)x.Length));
-        FragmentLengths.Rows["Child lengths distribution"].Values.Replace(trees.Select(x => (double)x.Length));
-        FragmentLengths.Rows["Fragment lengths distribution"].Values.Replace(fragments.Select(x => (double)x.GetLength()));
-
-        // write values to file
-        double a1 = fragments.Average(x => x.GetLength());
-        double a2 = trees.Average(x => x.Length);
-        double a3 = parents.Average(x => x.Length);
-        double s1 = CalculateSimilarity(fragments, (int)SymbolicExpressionTreeMatching.SimilarityLevel.Exact);
-
-
-        FragmentStatistics.Rows["Average fragment length"].Values.Add(a1);
-        FragmentStatistics.Rows["Average child length"].Values.Add(a2);
-        FragmentStatistics.Rows["Average parent length"].Values.Add(a3);
-        FragmentStatistics.Rows["Similarity (exact)"].Values.Add(s1);
-
-        #endregion
+          // the same, for fast lookup of clones (might not be needed after all)
+          var clonesLookup = new Dictionary<ISymbolicExpressionTree, bool>();
+          foreach (var original in GlobalCloneMap.Values.Cast<ISymbolicExpressionTree>()) {
+            if (!clonesLookup.ContainsKey(original)) {
+              clonesLookup.Add(original, true);
+            }
+          }
+          var goodFragments = new List<ISymbolicExpressionTreeNode>();
+          var goodParents = new List<ISymbolicExpressionTree>();
+          var goodChildren = new List<ISymbolicExpressionTree>();
+          // take all individuals that have received a fragment in the previous generation
+          foreach (var m in SecondaryFragmentMap) {
+            var individual = m.Key as ISymbolicExpressionTree;
+            // check if the individual became a parent in the current generation,
+            // by checking if it appears among the parents from the current generation trace map
+            if (parentsLookup.ContainsKey(individual)) {
+              var fragmentItem = m.Value as SymbolicExpressionTreeNodeItem;
+              goodFragments.Add(fragmentItem.Content);
+              goodParents.AddRange(SecondaryTraceMap[individual].Cast<ISymbolicExpressionTree>());
+              goodChildren.Add(individual);
+            }
+          }
+          var allFragments = SecondaryFragmentMap.Values.Select(x => ((SymbolicExpressionTreeNodeItem)x).Content as ISymbolicExpressionTreeNode).ToList();
+          var allParents = SecondaryTraceMap.Values.SelectMany(x => x.Cast<ISymbolicExpressionTree>()).ToList();
+          var allChildren = SecondaryFragmentMap.Keys.Select(x => x as ISymbolicExpressionTree).ToList();
+
+          FragmentStatistics.Rows["Fragment lengths (good)"].Values.Add(goodFragments.Average(x => x.GetLength()));
+          FragmentStatistics.Rows["Fragment lengths (all)"].Values.Add(allFragments.Average(x => x.GetLength()));
+          FragmentStatistics.Rows["Parent lengths (good)"].Values.Add(goodParents.Average(x => x.Length));
+          FragmentStatistics.Rows["Parent lengths (all)"].Values.Add(allParents.Average(x => x.Length));
+          FragmentStatistics.Rows["Child lengths (good)"].Values.Add(goodChildren.Average(x => x.Length));
+          FragmentStatistics.Rows["Child lengths (all)"].Values.Add(allChildren.Average(x => x.Length));
+          //FragmentStatistics.Rows["Exact similarity (good fragments)"].Values.Add(CalculateSimilarity(goodFragments, (int)SymbolicExpressionTreeMatching.SimilarityLevel.Exact));
+          //FragmentStatistics.Rows["Exact similarity (all fragments)"].Values.Add(CalculateSimilarity(allFragments, (int)SymbolicExpressionTreeMatching.SimilarityLevel.Exact));
+
+          //WriteFragmentFrequencies(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\FragmentFrequencies.dat");
+          #endregion
+        }
+        // save the current generation so it can be compared to the following one, next time the analyzer is applied 
+        SecondaryTraceMap.Clear();
+        foreach (var m in GlobalTraceMap)
+          SecondaryTraceMap.Add(m.Key, m.Value);
+        SecondaryCloneMap.Clear();
+        foreach (var m in GlobalCloneMap)
+          SecondaryCloneMap.Add(m.Key, m.Value);
+        SecondaryFragmentMap.Clear();
+        foreach (var m in GlobalFragmentMap)
+          SecondaryFragmentMap.Add(m.Key, m.Value);
 
         // clear the global maps to save memory
@@ -296,60 +312,57 @@
     }
 
+    private void InitializeRows() {
+      if (!FragmentStatistics.Rows.ContainsKey("Parent lengths (good)")) {
+        FragmentStatistics.Rows.Add(new DataRow("Parent lengths (good)") {
+          VisualProperties = { StartIndexZero = true }
+        });
+      }
+      if (!FragmentStatistics.Rows.ContainsKey("Parent lengths (all)")) {
+        FragmentStatistics.Rows.Add(new DataRow("Parent lengths (all)") {
+          VisualProperties = { StartIndexZero = true }
+        });
+      }
+      if (!FragmentStatistics.Rows.ContainsKey("Child lengths (good)")) {
+        FragmentStatistics.Rows.Add(new DataRow("Child lengths (good)") {
+          VisualProperties = { StartIndexZero = true }
+        });
+      }
+      if (!FragmentStatistics.Rows.ContainsKey("Child lengths (all)")) {
+        FragmentStatistics.Rows.Add(new DataRow("Child lengths (all)") {
+          VisualProperties = { StartIndexZero = true }
+        });
+      }
+      if (!FragmentStatistics.Rows.ContainsKey("Fragment lengths (good)")) {
+        FragmentStatistics.Rows.Add(new DataRow("Fragment lengths (good)") {
+          VisualProperties = { StartIndexZero = true }
+        });
+      }
+      if (!FragmentStatistics.Rows.ContainsKey("Fragment lengths (all)")) {
+        FragmentStatistics.Rows.Add(new DataRow("Fragment lengths (all)") {
+          VisualProperties = { StartIndexZero = true }
+        });
+      }
+      // exact similarity
+      if (!FragmentStatistics.Rows.ContainsKey("Exact similarity (good fragments)")) {
+        FragmentStatistics.Rows.Add(new DataRow("Exact similarity (good fragments)") {
+          VisualProperties = { StartIndexZero = true }
+        });
+      }
+      if (!FragmentStatistics.Rows.ContainsKey("Exact similarity (all fragments)")) {
+        FragmentStatistics.Rows.Add(new DataRow("Exact similarity (all fragments)") {
+          VisualProperties = { StartIndexZero = true }
+        });
+      }
+    }
+
+    private void WriteFragmentFrequencies(string path) {
+      using (var file = new System.IO.StreamWriter(path)) {
+        foreach (var f in FragmentFrequencies) {
+          file.WriteLine(((SymbolicExpressionTreeNodeItem)f[0]).Content.GetLength() + " " + ((IntValue)f[1]).Value);
+        }
+      }
+    }
+
     #region Similarity computations
-    #region Obsolete code
-    private void CalculateDiversityIndicators(IEnumerable<ISymbolicExpressionTreeNode> fragments, out double a, out double b, out double c) {
-      //var frags = fragments.Where(x => x.GetLength() > 1).ToList();
-      var frags = fragments.ToList();
-      var sieve = new bool[frags.Count];
-      int max = 0;
-      for (int i = 0; i != frags.Count - 1; ++i) {
-        if (sieve[i]) continue;
-        int count = 0;
-        for (int j = i + 1; j != frags.Count; ++j) {
-          if (sieve[j]) continue;
-          if (frags[i].IsSimilarTo(frags[j], (int)SymbolicExpressionTreeMatching.SimilarityLevel.Exact)) {
-            ++count;
-            sieve[i] = true;
-            sieve[j] = true;
-          }
-        }
-        if (max < count) max = count;
-      }
-      a = (double)sieve.Count(x => x) / sieve.Length;
-      sieve = new bool[frags.Count];
-      max = 0;
-      for (int i = 0; i != frags.Count - 1; ++i) {
-        if (sieve[i]) continue;
-        int count = 0;
-        for (int j = i + 1; j != frags.Count; ++j) {
-          if (sieve[j]) continue;
-          if (frags[i].IsSimilarTo(frags[j], (int)SymbolicExpressionTreeMatching.SimilarityLevel.High)) {
-            ++count;
-            sieve[i] = true;
-            sieve[j] = true;
-          }
-        }
-        if (max < count) max = count;
-      }
-      b = (double)sieve.Count(x => x) / sieve.Length;
-      sieve = new bool[frags.Count];
-      max = 0;
-      for (int i = 0; i != frags.Count - 1; ++i) {
-        if (sieve[i]) continue;
-        int count = 0;
-        for (int j = i + 1; j != frags.Count; ++j) {
-          if (sieve[j]) continue;
-          if (frags[i].IsSimilarTo(frags[j], (int)SymbolicExpressionTreeMatching.SimilarityLevel.Relaxed)) {
-            ++count;
-            sieve[i] = true;
-            sieve[j] = true;
-          }
-        }
-        if (max < count) max = count;
-      }
-      c = (double)sieve.Count(x => x) / max;
-    }
-    #endregion
-
     /// <summary>
     /// Provide a measure of how similar the fragments that get passed by crossover from one generation to the next are. 
@@ -358,5 +371,5 @@
     /// <param name="mode">The similarity mode (0 - exact, 1 - high, 2 - relaxed)</param>
     /// <returns>The average number of similar fragments</returns>
-    private double CalculateSimilarity(List<ISymbolicExpressionTreeNode> fragments, int mode) {
+    private static double CalculateSimilarity(IList<ISymbolicExpressionTreeNode> fragments, int mode) {
       var visited = new bool[fragments.Count];
       int groups = 0;
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeGenealogyAnalyzer.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeGenealogyAnalyzer.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeGenealogyAnalyzer.cs	(revision 7997)
@@ -21,5 +21,4 @@
 
 using System;
-using System.Collections.Generic;
 using System.Drawing;
 using System.Globalization;
@@ -111,5 +110,4 @@
     }
     #endregion
-
     #region Properties
     public bool EnabledByDefault {
@@ -256,5 +254,10 @@
           label = (generation * qualities.Count + i + 1).ToString(CultureInfo.InvariantCulture);
           if (!graph.HasNode(child)) {
-            var node = new GenealogyGraphNode(child) { Quality = qualities[child], Label = label, Rank = generation, IsElite = i < Elites.Value };
+            var node = new GenealogyGraphNode(child) {
+              Quality = qualities[child],
+              Label = label,
+              Rank = generation,
+              IsElite = i < Elites.Value
+            };
             graph.AddNode(node);
           }
@@ -263,5 +266,5 @@
 
           foreach (var parent in parents) {
-            object data = ((List<ISymbolicExpressionTreeNode>)child.IterateNodesBreadth())[((IntValue)GlobalFragmentMap[child]).Value];
+            object data = ((GenericWrapper<ISymbolicExpressionTreeNode>)GlobalFragmentMap[child]).Content;
             graph.AddArc(parent, child, null, data);
             if (GlobalTraceMap.ContainsKey(parent)) {
@@ -269,7 +272,7 @@
               var node = new GenealogyGraphNode(parent) { Quality = quality, Label = "", Rank = generation - 0.5 };
               graph.AddNode(node);
-              var pp = GlobalTraceMap[parent].Cast<ISymbolicExpressionTree>();
+              var pp = GlobalTraceMap[parent].Cast<SymbolicExpressionTree>();
               foreach (var p in pp) {
-                data = ((List<ISymbolicExpressionTreeNode>)parent.IterateNodesBreadth())[((IntValue)GlobalFragmentMap[parent]).Value];
+                data = ((GenericWrapper<SymbolicExpressionTreeNode>)GlobalFragmentMap[parent]).Content;
                 graph.AddArc(p, parent, null, data);
               }
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeRelativeLengthAnalyzer.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeRelativeLengthAnalyzer.cs	(revision 7997)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeRelativeLengthAnalyzer.cs	(revision 7997)
@@ -0,0 +1,240 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Random;
+using HeuristicLab.Selection;
+
+namespace HeuristicLab.EvolutionaryTracking.Analyzers {
+  /// <summary>
+  /// An analyzer that adapts selection pressure based on average three length
+  /// </summary>
+  [Item("SymbolicExpressionTreeRelativeLengthAnalyzer", "An analyzer that adapts selection pressure based on average three length")]
+  [StorableClass]
+  class SymbolicExpressionTreeRelativeLengthAnalyzer : SingleSuccessorOperator, IAnalyzer {
+    private const string UpdateIntervalParameterName = "UpdateInterval";
+    private const string UpdateCounterParameterName = "UpdateCounter";
+    private const string ResultsParameterName = "Results";
+    private const string GenerationsParameterName = "Generations";
+
+    private const string ExpectedAverageTreeLenghtParameterName = "ExpectedAverageTreeLength";
+    private const string RandomSelectionWindowSizeParameterName = "RandomSelectionWindowSize";
+    private const string RandomSelectionGenerationsCounterParameterName = "RandomSelectionGenerationsCounter";
+    private const string UpperBoundingFactorParameterName = "UpperBoundingFactor";
+    private const string LowerBoundingFactorParameterName = "LowerBoundingFactor";
+    private const string ActualTournamentGroupSizeParameterName = "TournamentGroupSize";
+
+    readonly MersenneTwister _random = new MersenneTwister(12345);
+
+    #region Parameter properties
+    public ValueParameter<IntValue> UpdateIntervalParameter {
+      get { return (ValueParameter<IntValue>)Parameters[UpdateIntervalParameterName]; }
+    }
+    public ValueParameter<IntValue> UpdateCounterParameter {
+      get { return (ValueParameter<IntValue>)Parameters[UpdateCounterParameterName]; }
+    }
+    public LookupParameter<ResultCollection> ResultsParameter {
+      get { return (LookupParameter<ResultCollection>)Parameters[ResultsParameterName]; }
+    }
+    public LookupParameter<IntValue> GenerationsParameter {
+      get { return (LookupParameter<IntValue>)Parameters[GenerationsParameterName]; }
+    }
+    public ValueParameter<DoubleValue> ExpectedAverageTreeLengthParameter {
+      get { return (ValueParameter<DoubleValue>)Parameters[ExpectedAverageTreeLenghtParameterName]; }
+    }
+    public ValueParameter<DoubleValue> UpperBoundingFactorParameter {
+      get { return (ValueParameter<DoubleValue>)Parameters[UpperBoundingFactorParameterName]; }
+    }
+    public ValueParameter<DoubleValue> LowerBoundingFactorParameter {
+      get { return (ValueParameter<DoubleValue>)Parameters[LowerBoundingFactorParameterName]; }
+    }
+    public ValueParameter<IntValue> RandomSelectionWindowSizeParameter {
+      get { return (ValueParameter<IntValue>)Parameters[RandomSelectionWindowSizeParameterName]; }
+    }
+    public ValueParameter<IntValue> RandomSelectionGenerationsCounterParameter {
+      get { return (ValueParameter<IntValue>)Parameters[RandomSelectionGenerationsCounterParameterName]; }
+    }
+    public ValueParameter<IntValue> ActualTournamentGroupSizeParameter {
+      get { return (ValueParameter<IntValue>)Parameters[ActualTournamentGroupSizeParameterName]; }
+    }
+    #endregion
+
+    #region Parameters
+    public bool EnabledByDefault {
+      get { return true; }
+    }
+    public IntValue UpdateInterval {
+      get { return UpdateIntervalParameter.Value; }
+    }
+    public IntValue UpdateCounter {
+      get { return UpdateCounterParameter.Value; }
+    }
+    public ResultCollection Results {
+      get { return ResultsParameter.ActualValue; }
+    }
+    public IntValue Generations {
+      get { return GenerationsParameter.ActualValue; }
+    }
+    public DoubleValue ExpectedAverageTreeLength {
+      get { return (DoubleValue)ExpectedAverageTreeLengthParameter.ActualValue; }
+    }
+    public IntValue RandomSelectionWindowSize {
+      get { return (IntValue)RandomSelectionWindowSizeParameter.ActualValue; }
+    }
+    public IntValue RandomSelectionGenerationsCounter {
+      get { return (IntValue)RandomSelectionGenerationsCounterParameter.ActualValue; }
+    }
+    public IntValue ActualTournamentGroupSize {
+      get { return (IntValue)ActualTournamentGroupSizeParameter.ActualValue; }
+      set { ActualTournamentGroupSizeParameter.ActualValue = value; }
+    }
+    public DoubleValue LowerBoundingFactor {
+      get { return (DoubleValue)LowerBoundingFactorParameter.ActualValue; }
+    }
+    public DoubleValue UpperBoundingFactor {
+      get { return (DoubleValue)UpperBoundingFactorParameter.ActualValue; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    private SymbolicExpressionTreeRelativeLengthAnalyzer(bool deserializing)
+      : base() {
+    }
+    private SymbolicExpressionTreeRelativeLengthAnalyzer(SymbolicExpressionTreeRelativeLengthAnalyzer original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicExpressionTreeRelativeLengthAnalyzer(this, cloner);
+    }
+    public SymbolicExpressionTreeRelativeLengthAnalyzer()
+      : base() {
+      Parameters.Add(new ValueParameter<IntValue>(UpdateIntervalParameterName, "The interval in which the tree length analysis should be applied.", new IntValue(1)));
+      Parameters.Add(new ValueParameter<IntValue>(UpdateCounterParameterName, "The value which counts how many times the operator was called since the last update", new IntValue(0)));
+      Parameters.Add(new ValueLookupParameter<ResultCollection>(ResultsParameterName, "The results collection where the analysis values should be stored."));
+      Parameters.Add(new LookupParameter<IntValue>(GenerationsParameterName, "The number of generations so far."));
+      Parameters.Add(new ValueParameter<DoubleValue>(ExpectedAverageTreeLenghtParameterName, "The expected statistical average of the tree length for given grammar and depth and random trees", new DoubleValue(0)));
+      Parameters.Add(new ValueParameter<DoubleValue>(UpperBoundingFactorParameterName, "Multiplier for the expected average size, giving the upper bound of the average size length", new DoubleValue(3.0)));
+      Parameters.Add(new ValueParameter<DoubleValue>(LowerBoundingFactorParameterName, "Multiplier for the expected average size, giving the lower bound of the average size length", new DoubleValue(2.0)));
+      Parameters.Add(new ValueParameter<IntValue>(RandomSelectionWindowSizeParameterName, "Maximum window for random selection (in generations)"));
+      Parameters.Add(new ValueParameter<IntValue>(RandomSelectionGenerationsCounterParameterName, "Counter for the consecutive random selection generations"));
+      Parameters.Add(new ValueParameter<IntValue>(ActualTournamentGroupSizeParameterName, "Parameter to store the actual tournament size so we can reuse it later.", new IntValue(0)));
+
+      UpdateCounterParameter.Hidden = true;
+      UpdateIntervalParameter.Hidden = true;
+    }
+    #region After deserialization code
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      // check if all the parameters are present and accounted for 
+      if (!Parameters.ContainsKey(UpdateIntervalParameterName)) {
+        Parameters.Add(new ValueParameter<IntValue>(UpdateIntervalParameterName, "The interval in which the tree length analysis should be applied.", new IntValue(1)));
+      }
+      if (!Parameters.ContainsKey(UpdateCounterParameterName)) {
+        Parameters.Add(new ValueParameter<IntValue>(UpdateCounterParameterName, "The value which counts how many times the operator was called since the last update", new IntValue(0)));
+        UpdateCounterParameter.Hidden = true;
+      }
+    }
+    #endregion
+    #region IStatefulItem members
+    public override void InitializeState() {
+      base.InitializeState();
+      UpdateCounter.Value = 0;
+    }
+
+    public override void ClearState() {
+      base.ClearState();
+      UpdateCounter.Value = 0;
+    }
+    #endregion
+
+    public override IOperation Apply() {
+      UpdateCounter.Value++;
+      if (UpdateCounter.Value == UpdateInterval.Value) {
+        UpdateCounter.Value = 0;
+
+        var gaContext = ExecutionContext.Parent.Parent;
+        var selectorParameter = gaContext.Parameters["Selector"];
+        var selector = selectorParameter.ActualValue as TournamentSelector;
+        var gScope = ExecutionContext.Scope;
+        while (gScope.Parent != null) gScope = gScope.Parent;
+
+        if (Generations.Value == 0) {
+          UpdateCounter.Value = 0; // reset the update counter
+          if (ActualTournamentGroupSize.Value == 0)
+            ActualTournamentGroupSize = new IntValue(selector.GroupSizeParameter.Value.Value);
+          else
+            selector.GroupSizeParameter.Value = ActualTournamentGroupSize;
+
+          // check the threshhold value by simulating the average tree length using the GrowTreeCreator
+          var randomTrees = new List<ISymbolicExpressionTree>();
+
+          var problemContext = gaContext.Parent;
+
+          var grammar = (ISymbolicExpressionGrammar)problemContext.Parameters["SymbolicExpressionTreeGrammar"].ActualValue;
+          var maxDepth = (IntValue)problemContext.Parameters["MaximumSymbolicExpressionTreeDepth"].ActualValue;
+
+          long length = 0;
+          const uint size = 1000;
+          for (int i = 0; i != size; ++i) {
+            randomTrees.Add(GrowTreeCreator.Create(_random, grammar, 0, maxDepth.Value));
+            length += randomTrees.Last().Length;
+          }
+          ExpectedAverageTreeLength.Value = (double)length / size;
+
+          return base.Apply();
+        } else if (Generations.Value >= 10) {
+          // this should provide a bloat control mechanism while allowing population diversity to increase
+          double currentAverageTreeLength = (from s in gScope.SubScopes
+                                             let tree = s.Variables.First().Value as ISymbolicExpressionTree
+                                             select tree.Length).Average();
+
+          double expectedAverage = ExpectedAverageTreeLength.Value;
+
+          if (currentAverageTreeLength >= UpperBoundingFactor.Value * expectedAverage) {
+            SetGroupSize(selector, 1);
+          }
+          if (RandomSelectionGenerationsCounter.Value == RandomSelectionWindowSize.Value ||
+              currentAverageTreeLength <= LowerBoundingFactor.Value * expectedAverage) {
+
+            SetGroupSize(selector, ActualTournamentGroupSize.Value);
+            RandomSelectionGenerationsCounter.Value = 0;
+          } else {
+            RandomSelectionGenerationsCounter.Value++;
+          }
+        }
+      }
+      return base.Apply();
+    }
+
+    void SetGroupSize(TournamentSelector ts, int value) {
+      ts.GroupSizeParameter.Value = new IntValue(value);
+    }
+  }
+}
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/HeuristicLab.EvolutionaryTracking-3.4.csproj
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/HeuristicLab.EvolutionaryTracking-3.4.csproj	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/HeuristicLab.EvolutionaryTracking-3.4.csproj	(revision 7997)
@@ -73,4 +73,8 @@
     <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
+    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
@@ -86,4 +90,5 @@
     <Compile Include="Analyzers\SymbolicExpressionTreeFragmentsAnalyzer.cs" />
     <Compile Include="Analyzers\SymbolicExpressionTreeGenealogyAnalyzer.cs" />
+    <Compile Include="Analyzers\SymbolicExpressionTreeRelativeLengthAnalyzer.cs" />
     <Compile Include="GenealogyGraph.cs" />
     <Compile Include="Interfaces\IGenealogyGraph.cs" />
@@ -97,4 +102,8 @@
       <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project>
       <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Selection\3.3\HeuristicLab.Selection-3.3.csproj">
+      <Project>{2C36CD4F-E5F5-43A4-801A-201EA895FE17}</Project>
+      <Name>HeuristicLab.Selection-3.3</Name>
     </ProjectReference>
   </ItemGroup>
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Plugin.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Plugin.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Plugin.cs	(revision 7997)
@@ -26,5 +26,5 @@
   /// Plugin class for HeuristicLab.Selection plugin.
   /// </summary>
-  [Plugin("HeuristicLab.Selection", "3.3.6.7800")]
+  [Plugin("HeuristicLab.Selection", "3.3.6.7817")]
   [PluginFile("HeuristicLab.Selection-3.3.dll", PluginFileType.Assembly)]
   [PluginDependency("HeuristicLab.Collections", "3.3")]
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/ProportionalSelector.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/ProportionalSelector.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/ProportionalSelector.cs	(revision 7997)
@@ -26,5 +26,4 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
@@ -103,5 +102,5 @@
           // map the selected (cloned) tree to the original tree
           var original = scopes[index].Variables.First().Value;
-          var clone = selected[i].Variables.First().Value; 
+          var clone = selected[i].Variables.First().Value;
           GlobalCloneMap.Add(clone, original);
         } else {
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RandomSelector.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RandomSelector.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RandomSelector.cs	(revision 7997)
@@ -21,4 +21,5 @@
 
 using System.Collections.Generic;
+using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -69,7 +70,12 @@
 
       for (int i = 0; i < count; i++) {
-        if (copy)
-          selected[i] = (IScope)scopes[random.Next(scopes.Count)].Clone();
-        else {
+        if (copy) {
+          int index = random.Next(scopes.Count);
+          selected[i] = (IScope)scopes[index].Clone();
+          // map the selected (cloned) tree to the original tree
+          var original = scopes[index].Variables.First().Value;
+          var clone = selected[i].Variables.First().Value;
+          GlobalCloneMap.Add(clone, original);
+        } else {
           int index = random.Next(scopes.Count);
           selected[i] = scopes[index];
Index: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Selector.cs
===================================================================
--- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Selector.cs	(revision 7994)
+++ branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Selector.cs	(revision 7997)
@@ -23,5 +23,4 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Operators;
 using HeuristicLab.Parameters;
@@ -74,8 +73,5 @@
         while (gScope.Parent != null) gScope = gScope.Parent;
         gScope.Variables.Add(new Variable(GlobalCloneMapParameterName, new CloneMapType()));
-      } else {
-        GlobalCloneMap.Clear();
       }
-
       IScope[] selected = Select(scopes);
 
