Index: branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/AlgorithmBehaviorHelpers.cs
===================================================================
--- branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/AlgorithmBehaviorHelpers.cs	(revision 8267)
+++ branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/AlgorithmBehaviorHelpers.cs	(revision 8268)
@@ -54,4 +54,15 @@
           subtours.Add(schema);
         }
+      }
+      return subtours;
+    }
+
+    public static List<IntArray> ExtractSubtours(Permutation permutation, int length) {
+      var subtours = new List<IntArray>();
+      int i = 2;
+      for (int j = 0; j < permutation.Count(); j++) { // visit all positions in the permutation
+        var schema = new IntArray(i);
+        for (int k = 0; k < i; k++) schema[k] = permutation[(j + k) % permutation.Length]; // copy edge to schema
+        subtours.Add(schema);
       }
       return subtours;
Index: branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/Analyzers/AlleleOccurencesInGenerationsAnalyzer.cs
===================================================================
--- branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/Analyzers/AlleleOccurencesInGenerationsAnalyzer.cs	(revision 8268)
+++ branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/Analyzers/AlleleOccurencesInGenerationsAnalyzer.cs	(revision 8268)
@@ -0,0 +1,162 @@
+﻿#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.PermutationEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.TravelingSalesman;
+
+namespace HeuristicLab.Analysis.AlgorithmBehavior {
+
+  /// <summary>
+  /// An operator that analyzes the quality of schemas.
+  /// </summary>
+  [Item("AlleleOccurencesInGenerationsAnalyzer", "An operator that analyzes broken inheritance of building blocks.")]
+  [StorableClass]
+  public sealed class AlleleOccurencesInGenerationsAnalyzer : SingleSuccessorOperator, IAnalyzer {
+    private const string ResultsParameterName = "Results";
+    private const string PopulationGraphResultParameterName = "PopulationGraph";
+    private const string SchemataParameterName = "Schemata";
+    private const string SchemaOccurenceInGenerationsMatrixParameterName = "SchemaOccurenceInGenerationsMatrix";
+    private const string QualitiesParameterName = "Qualities";
+    private const string DistanceMatrixParameterName = "DistanceMatrix";
+    private const string GenerationsParameterName = "Generations";
+    private const string BestSolutionParameterName = "Best TSP Solution";
+
+    #region IAnalyzer Members
+    public bool EnabledByDefault {
+      get { return true; }
+    }
+    #endregion
+
+    #region Parameter properties
+    public ILookupParameter<ResultCollection> ResultsParameter {
+      get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; }
+    }
+    public ILookupParameter<DistanceMatrix> DistanceMatrixParameter {
+      get { return (ILookupParameter<DistanceMatrix>)Parameters[DistanceMatrixParameterName]; }
+    }
+    public ILookupParameter<IntValue> GenerationsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters[GenerationsParameterName]; }
+    }
+    #endregion
+
+    #region Properties
+    public ResultCollection Results {
+      get { return ResultsParameter.ActualValue; }
+    }
+    public DistanceMatrix DistanceMatrix {
+      get { return DistanceMatrixParameter.ActualValue; }
+    }
+    public HeuristicLab.Analysis.DataTable Qualities {
+      get { return ((HeuristicLab.Analysis.DataTable)ResultsParameter.ActualValue[QualitiesParameterName].Value); }
+    }
+    public PathTSPTour BestSolution {
+      get { return ((PathTSPTour)ResultsParameter.ActualValue[BestSolutionParameterName].Value); }
+    }
+    #endregion
+
+    [StorableConstructor]
+    private AlleleOccurencesInGenerationsAnalyzer(bool deserializing) : base(deserializing) { }
+    private AlleleOccurencesInGenerationsAnalyzer(AlleleOccurencesInGenerationsAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    public AlleleOccurencesInGenerationsAnalyzer()
+      : base() {
+      Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The results collection where the analysis values should be stored."));
+      Parameters.Add(new LookupParameter<DistanceMatrix>(DistanceMatrixParameterName, "The distance matrix of the TSP."));
+      Parameters.Add(new LookupParameter<IntValue>(GenerationsParameterName, "Nr of generations."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new AlleleOccurencesInGenerationsAnalyzer(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var graph = (GenealogyGraph<Permutation>)Results[PopulationGraphResultParameterName].Value;
+      var subtours = AlgorithmBehaviorHelpers.ExtractSubtours(BestSolution.Permutation, 2);
+
+      Dictionary<IntArray, Dictionary<int, List<int>>> occurences = new Dictionary<IntArray, Dictionary<int, List<int>>>();
+      foreach (var s in subtours) {
+        occurences.Add(s, new Dictionary<int, List<int>>());
+      }
+
+      for (int i = 0; i < GenerationsParameter.ActualValue.Value; i++) {
+        var individuals = graph.Values.Where(x => x.Rank.Contains(i) || x.Rank.Contains(i + 0.5));
+        foreach (var subtour in subtours) {
+          int cnt = 0;
+          double quality = 0.0;
+          foreach (var individual in individuals) {
+            var ind = (IntArray)individual.Data;
+            if (AlgorithmBehaviorHelpers.IsSubtour(subtour, (Permutation)ind)) {
+              cnt++;
+              quality += TSPDistanceMatrixEvaluator.Apply(DistanceMatrix, (Permutation)individual.Data);
+            }
+          }
+
+          List<int> vals = new List<int>();
+          vals.Add(cnt);
+          if (cnt != 0) {
+            double avgQuality = quality / cnt;
+            double qualityRatio = avgQuality / Qualities.Rows["CurrentAverageQuality"].Values[i] * 100;
+            vals.Add((int)qualityRatio);
+          }
+          occurences[subtour][i] = vals;
+        }
+      }
+
+      var schemataMatrix = new Dictionary<IntArray, string>(new SchemaEqualityComparer());
+      foreach (var ind in occurences.Keys) {
+        if (!schemataMatrix.ContainsKey(ind)) {
+          string result = string.Empty;
+          foreach (var res in occurences[ind]) {
+            result += res.Key + ": ";
+            foreach (var r in res.Value) {
+              result += r.ToString() + ", ";
+            }
+            result += "; ";
+          }
+          schemataMatrix.Add(ind, result);
+        }
+      }
+
+      // order schemas according to their global occurrence count
+      var sortedSchemataMatrix = schemataMatrix.OrderByDescending(x => x.Value[0]).ToDictionary(x => x.Key, x => x.Value);
+
+      var stringMatrix = new StringMatrix(sortedSchemataMatrix.Keys.Count, 2);
+      for (int i = 0; i < sortedSchemataMatrix.Keys.Count; i++) {
+        var element = sortedSchemataMatrix.ElementAt(i);
+        stringMatrix[i, 0] = new Permutation(PermutationTypes.RelativeUndirected, element.Key).ToString();
+        stringMatrix[i, 1] = element.Value;
+      }
+      stringMatrix.ColumnNames = new[] { "Schema", "SchemaCountOverGeneration" };
+
+      Results.Add(new Result(SchemaOccurenceInGenerationsMatrixParameterName, stringMatrix));
+
+      return base.Apply();
+    }
+  }
+}
Index: branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/HeuristicLab.Analysis.AlgorithmBehavior-3.3.csproj
===================================================================
--- branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/HeuristicLab.Analysis.AlgorithmBehavior-3.3.csproj	(revision 8267)
+++ branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/HeuristicLab.Analysis.AlgorithmBehavior-3.3.csproj	(revision 8268)
@@ -100,4 +100,5 @@
     <Compile Include="Analyzers\BrokenInteritanceSchemaAnalyzer.cs" />
     <Compile Include="Analyzers\BestIndividualWildcardAnalyzer.cs" />
+    <Compile Include="Analyzers\AlleleOccurencesInGenerationsAnalyzer.cs" />
     <Compile Include="Creators\BestIndividualSchemataCreator.cs" />
     <Compile Include="Analyzers\BestIndividualQualityAnalyzer.cs" />
