Index: /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/WeightedParentsDiversityComparator.cs
===================================================================
--- /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/WeightedParentsDiversityComparator.cs	(revision 11795)
+++ /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/WeightedParentsDiversityComparator.cs	(revision 11796)
@@ -22,4 +22,5 @@
 using System;
 using System.Linq;
+using HeuristicLab.Analysis;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -65,4 +66,27 @@
       get { return (IConstrainedValueParameter<IDiscreteDoubleValueModifier>)Parameters["ComparisonFactorModifier"]; }
     }
+    public ValueLookupParameter<ResultCollection> ResultsParameter {
+      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
+    }
+    public ILookupParameter<IntValue> GenerationsParameter {
+      get { return (LookupParameter<IntValue>)Parameters["Generations"]; }
+    }
+
+    private const string spDetailsParameterName = "SPDetails";
+    private const string divDataRowName = "DiversitySuccessCount";
+    private const string qualityDataRowName = "QualitySuccessCount";
+    private const string overallCountDataRowName = "OverallCount";
+    private const string successCountDataRowName = "SuccessCount";
+
+    [Storable]
+    private int currentGeneration;
+    [Storable]
+    private int divCount;
+    [Storable]
+    private int qualityCount;
+    [Storable]
+    private int overallCount;
+    [Storable]
+    private int successCount;
 
     [StorableConstructor]
@@ -71,4 +95,9 @@
       : base(original, cloner) {
       SimilarityCalculator = cloner.Clone(original.SimilarityCalculator);
+      currentGeneration = original.currentGeneration;
+      divCount = original.divCount;
+      qualityCount = original.qualityCount;
+      overallCount = original.overallCount;
+      successCount = original.successCount;
     }
     public WeightedParentsDiversityComparator()
@@ -83,4 +112,6 @@
       Parameters.Add(new ValueLookupParameter<DoubleValue>("DiversityComparisonFactorUpperBound", "The upper bound of the comparison factor (end).", new DoubleValue(1.0)));
       Parameters.Add(new OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier>("ComparisonFactorModifier", "The operator used to modify the comparison factor.", new ItemSet<IDiscreteDoubleValueModifier>(new IDiscreteDoubleValueModifier[] { new LinearDiscreteDoubleValueModifier() }), new LinearDiscreteDoubleValueModifier()));
+      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the population diversity analysis results should be stored."));
+      Parameters.Add(new LookupParameter<IntValue>("Generations", "The current number of generations."));
 
       foreach (IDiscreteDoubleValueModifier modifier in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>().OrderBy(x => x.Name))
@@ -93,4 +124,12 @@
     public override IDeepCloneable Clone(Cloner cloner) {
       return new WeightedParentsDiversityComparator(this, cloner);
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey("Generations"))
+        Parameters.Add(new LookupParameter<IntValue>("Generations", "The current number of generations."));
+      if (!Parameters.ContainsKey("Results"))
+        Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the population diversity analysis results should be stored."));
     }
 
@@ -115,6 +154,29 @@
       double leftQuality = LeftSideParameter.ActualValue.Value;
       bool resultDiversity;
-
       double threshold = 0;
+
+      DataTable spDetailsTable;
+      if (ResultsParameter.ActualValue.ContainsKey(spDetailsParameterName)) {
+        spDetailsTable = (DataTable)ResultsParameter.ActualValue[spDetailsParameterName].Value;
+      } else {
+        spDetailsTable = new DataTable(spDetailsParameterName);
+        spDetailsTable.Rows.Add(new DataRow(divDataRowName));
+        spDetailsTable.Rows.Add(new DataRow(qualityDataRowName));
+        spDetailsTable.Rows.Add(new DataRow(overallCountDataRowName));
+        spDetailsTable.Rows.Add(new DataRow(successCountDataRowName));
+        ResultsParameter.ActualValue.Add(new Result(spDetailsParameterName, spDetailsTable));
+      }
+
+      if (GenerationsParameter.ActualValue.Value != currentGeneration) {
+        spDetailsTable.Rows[divDataRowName].Values.Add(divCount);
+        divCount = 0;
+        spDetailsTable.Rows[qualityDataRowName].Values.Add(qualityCount);
+        qualityCount = 0;
+        spDetailsTable.Rows[overallCountDataRowName].Values.Add(overallCount);
+        overallCount = 0;
+        spDetailsTable.Rows[successCountDataRowName].Values.Add(successCount);
+        successCount = 0;
+        currentGeneration = GenerationsParameter.ActualValue.Value;
+      }
 
       #region Calculate threshold
@@ -140,5 +202,19 @@
 
       bool result = maximization && leftQuality > threshold || !maximization && leftQuality < threshold;
+
+      if (result) {
+        qualityCount++;
+      }
+
       result = result && resultDiversity;
+
+      if (resultDiversity) {
+        divCount++;
+      }
+      if (result) {
+        successCount++;
+      }
+      overallCount++;
+
       BoolValue resultValue = ResultParameter.ActualValue;
       if (resultValue == null) {
