Index: branches/HeuristicLab.DiversityAnalysis/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/TSPPopulationDiversityAnalyzer.cs
===================================================================
--- branches/HeuristicLab.DiversityAnalysis/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/TSPPopulationDiversityAnalyzer.cs	(revision 4432)
+++ branches/HeuristicLab.DiversityAnalysis/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/TSPPopulationDiversityAnalyzer.cs	(revision 4501)
@@ -22,5 +22,7 @@
 using System;
 using System.Linq;
+using HeuristicLab.Analysis;
 using HeuristicLab.Core;
+using HeuristicLab.Common;
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.PermutationEncoding;
@@ -29,4 +31,5 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using System.Data;
 
 namespace HeuristicLab.Problems.TravelingSalesman {
@@ -41,59 +44,51 @@
     // - iterations sampling
     // - view
-
+    // - implement data structure for population diversity details
+
+    public const string PermutationKey = "Permutation";
     public ScopeTreeLookupParameter<Permutation> PermutationParameter {
-      get { return (ScopeTreeLookupParameter<Permutation>)Parameters["Permutation"]; }
-    }
+      get { return (ScopeTreeLookupParameter<Permutation>)Parameters[PermutationKey]; }
+    }
+    public const string QualityKey = "Quality";
     public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
-      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
-    }
+      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters[QualityKey]; }
+    }
+
+    public const string StoreCompleteHistoryKey = "StoreCompleteHistory";
     public ValueParameter<BoolValue> StoreCompleteHistoryParameter {
-      get { return (ValueParameter<BoolValue>)Parameters["StoreCompleteHistory"]; }
-    }
+      get { return (ValueParameter<BoolValue>)Parameters[StoreCompleteHistoryKey]; }
+    }
+
+    public const string SimilaritiesKey = "Similarities";
     public ValueParameter<ItemList<DoubleMatrix>> SimilaritiesParameter {
-      get { return (ValueParameter<ItemList<DoubleMatrix>>)Parameters["Similarities"]; }
-    }
+      get { return (ValueParameter<ItemList<DoubleMatrix>>)Parameters[SimilaritiesKey]; }
+    }
+    public const string MaximumSimilaritiesKey = "MaximumSimilarities";
     public ValueParameter<ItemList<DoubleArray>> MaximumSimilaritiesParameter {
-      get { return (ValueParameter<ItemList<DoubleArray>>)Parameters["MaximumSimilarities"]; }
-    }
-    public ValueParameter<ItemList<DoubleValue>> AverageMaximumSimilaritiesParameter {
-      get { return (ValueParameter<ItemList<DoubleValue>>)Parameters["AverageMaximumSimilarities"]; }
-    }
-    public ValueParameter<ItemList<DoubleValue>> AverageSimilaritiesParameter {
-      get { return (ValueParameter<ItemList<DoubleValue>>)Parameters["AverageSimilarities"]; }
+      get { return (ValueParameter<ItemList<DoubleArray>>)Parameters[MaximumSimilaritiesKey]; }
+    }
+
+    public const string CurrentAverageSimilarityKey = "Current Average Population Similarity";
+    public const string AverageSimilarityProgressKey = "Average Population Similarity Progress";
+    public const string CurrentAverageMaximumSimilarityKey = "Current Average Maximum Population Similarity";
+    public const string AverageMaximumSimilarityProgressKey = "Average Maximum Population Similarity Progress";
+
+    public const string ResultsKey = "Results";
+    public ValueLookupParameter<ResultCollection> ResultsParameter {
+      get { return (ValueLookupParameter<ResultCollection>)Parameters[ResultsKey]; }
     }
 
     public TSPPopulationDiversityAnalyzer()
       : base() {
-      Parameters.Add(new ScopeTreeLookupParameter<Permutation>("Permutation", "The TSP solutions given in path representation from which the best solution should be analyzed."));
-      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the TSP solutions which should be analyzed."));
-      Parameters.Add(new ValueParameter<BoolValue>("StoreCompleteHistory", "Flag that denotes whether the complete history of similarity values shall be stored.", new BoolValue(true)));
-      Parameters.Add(new ValueParameter<ItemList<DoubleMatrix>>("Similarities", "The similarities of the TSP solutions which should be analyzed."));
-      Parameters.Add(new ValueParameter<ItemList<DoubleArray>>("MaximumSimilarities", "The maximum similarities of the TSP solutions which should be analyzed."));
-      Parameters.Add(new ValueParameter<ItemList<DoubleValue>>("AverageMaximumSimilarities", "The average maximum similarities of the TSP solutions which should be analyzed."));
-      Parameters.Add(new ValueParameter<ItemList<DoubleValue>>("AverageSimilarities", "The average similarities of the TSP solutions which should be analyzed."));
+      Parameters.Add(new ScopeTreeLookupParameter<Permutation>(PermutationKey, "The TSP solutions given in path representation from which the best solution should be analyzed."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(QualityKey, "The qualities of the TSP solutions which should be analyzed."));
+      Parameters.Add(new ValueParameter<BoolValue>(StoreCompleteHistoryKey, "Flag that denotes whether the complete history of similarity values shall be stored.", new BoolValue(true)));
+      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection in which the population diversity analysis results should be stored."));
+
+      Parameters.Add(new ValueParameter<ItemList<DoubleMatrix>>(SimilaritiesKey, "The similarities of the TSP solutions which should be analyzed."));
+      Parameters.Add(new ValueParameter<ItemList<DoubleArray>>(MaximumSimilaritiesKey, "The maximum similarities of the TSP solutions which should be analyzed."));
     }
 
     public override IOperation Apply() {
-
-      #region testing
-      /*
-      Permutation permutationA = new Permutation(PermutationTypes.Absolute, new int[] { 0, 5, 4, 3, 2, 1 });
-      Permutation permutationB = new Permutation(PermutationTypes.Absolute, new int[] { 0, 3, 2, 4, 5, 1 });
-      Permutation permutationC = new Permutation(PermutationTypes.Absolute, new int[] { 3, 2, 4, 5, 1, 0 });
-      Permutation permutationD = new Permutation(PermutationTypes.Absolute, new int[] { 3, 2, 4, 5, 0, 1 });
-      int[] edgesA = CalculateEdgesVector(permutationA);
-      int[] edgesB = CalculateEdgesVector(permutationB);
-      int[] edgesC = CalculateEdgesVector(permutationC);
-      int[] edgesD = CalculateEdgesVector(permutationD);
-      double s = CalculateSimilarity(edgesA, edgesB);
-      s = CalculateSimilarity(edgesA, edgesA);
-      s = CalculateSimilarity(edgesB, edgesB);
-      s = CalculateSimilarity(edgesC, edgesC);
-      s = CalculateSimilarity(edgesD, edgesD);
-      s = CalculateSimilarity(edgesB, edgesC);
-      s = CalculateSimilarity(edgesC, edgesD);
-      */
-      #endregion
 
       ItemArray<Permutation> permutations = PermutationParameter.ActualValue;
@@ -102,4 +97,6 @@
       DoubleValue[] qualitiesArray = qualities.ToArray();
       int cities = permutationsArray.Length;
+      ResultCollection results = ResultsParameter.ActualValue;
+
       #region sort permutations array
       for (int i = 0; i < cities; i++) {
@@ -148,6 +145,4 @@
         SimilaritiesParameter.Value = new ItemList<DoubleMatrix>();
         MaximumSimilaritiesParameter.Value = new ItemList<DoubleArray>();
-        AverageMaximumSimilaritiesParameter.Value = new ItemList<DoubleValue>();
-        AverageSimilaritiesParameter.Value = new ItemList<DoubleValue>();
       }
       if (!StoreCompleteHistoryParameter.Value.Value && SimilaritiesParameter.Value.Count > 0) {
@@ -157,6 +152,31 @@
       SimilaritiesParameter.Value.Add(similarities);
       MaximumSimilaritiesParameter.Value.Add(maxSimilarities);
-      AverageMaximumSimilaritiesParameter.Value.Add(averageMaximumSimilarity);
-      AverageSimilaritiesParameter.Value.Add(averageSimilarity);
+
+      #region Store average similarity values
+      if (results.ContainsKey(CurrentAverageSimilarityKey))
+        results[CurrentAverageSimilarityKey].Value = averageSimilarity;
+      else
+        results.Add(new Result(CurrentAverageSimilarityKey, averageSimilarity));
+
+      if (!results.ContainsKey(AverageSimilarityProgressKey))
+        results.Add(new Result(AverageSimilarityProgressKey, new Analysis.DataTable(AverageSimilarityProgressKey)));
+      Analysis.DataTable averageSimilarityProgressDataTable = (Analysis.DataTable)(results[AverageSimilarityProgressKey].Value);
+      if (averageSimilarityProgressDataTable.Rows.Count == 0)
+        averageSimilarityProgressDataTable.Rows.Add(new Analysis.DataRow(AverageSimilarityProgressKey));
+      averageSimilarityProgressDataTable.Rows[AverageSimilarityProgressKey].Values.Add(averageSimilarity.Value);
+      #endregion
+      #region Store average maximum similarity values
+      if (results.ContainsKey(CurrentAverageMaximumSimilarityKey))
+        results[CurrentAverageMaximumSimilarityKey].Value = averageMaximumSimilarity;
+      else
+        results.Add(new Result(CurrentAverageMaximumSimilarityKey, averageMaximumSimilarity));
+
+      if (!results.ContainsKey(AverageMaximumSimilarityProgressKey))
+        results.Add(new Result(AverageMaximumSimilarityProgressKey, new Analysis.DataTable(AverageMaximumSimilarityProgressKey)));
+      Analysis.DataTable averageMaximumSimilarityProgressDataTable = (Analysis.DataTable)(results[AverageMaximumSimilarityProgressKey].Value);
+      if (averageMaximumSimilarityProgressDataTable.Rows.Count == 0)
+        averageMaximumSimilarityProgressDataTable.Rows.Add(new Analysis.DataRow(AverageMaximumSimilarityProgressKey));
+      averageMaximumSimilarityProgressDataTable.Rows[AverageMaximumSimilarityProgressKey].Values.Add(averageMaximumSimilarity.Value);
+      #endregion
 
       return base.Apply();
Index: branches/HeuristicLab.DiversityAnalysis/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj
===================================================================
--- branches/HeuristicLab.DiversityAnalysis/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj	(revision 4432)
+++ branches/HeuristicLab.DiversityAnalysis/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj	(revision 4501)
@@ -97,4 +97,7 @@
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="HeuristicLab.Analysis-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Analysis-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
Index: branches/HeuristicLab.DiversityAnalysis/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLabProblemsTravelingSalesmanPlugin.cs.frame
===================================================================
--- branches/HeuristicLab.DiversityAnalysis/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLabProblemsTravelingSalesmanPlugin.cs.frame	(revision 4432)
+++ branches/HeuristicLab.DiversityAnalysis/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLabProblemsTravelingSalesmanPlugin.cs.frame	(revision 4501)
@@ -28,4 +28,5 @@
   [Plugin("HeuristicLab.Problems.TravelingSalesman", "3.3.0.$WCREV$")]
   [PluginFile("HeuristicLab.Problems.TravelingSalesman-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Analysis", "3.3")]
   [PluginDependency("HeuristicLab.Collections", "3.3")]
   [PluginDependency("HeuristicLab.Common", "3.3")]
Index: branches/HeuristicLab.DiversityAnalysis/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
===================================================================
--- branches/HeuristicLab.DiversityAnalysis/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs	(revision 4432)
+++ branches/HeuristicLab.DiversityAnalysis/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs	(revision 4501)
@@ -322,4 +322,5 @@
       TSPPopulationDiversityAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
       TSPPopulationDiversityAnalyzer.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
+      TSPPopulationDiversityAnalyzer.ResultsParameter.ActualName = "Results";
     }
     private void ParameterizeOperators() {
