Index: /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/CrossoverPerformanceAnalyzer.cs
===================================================================
--- /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/CrossoverPerformanceAnalyzer.cs	(revision 8865)
+++ /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/CrossoverPerformanceAnalyzer.cs	(revision 8866)
@@ -80,7 +80,7 @@
 
     [Storable]
-    private ScatterPlotHelper plotHelper, childDiversityToWorseParentHelper, childDiversityToBetterParentHelper, parentDiversityHelper, parentQualityHelper;
-    [Storable]
-    private DataTableHelper performanceHelper, successHelper, equalParentsHelper;
+    private ScatterPlotHelper worseParentCrossoverPerformancePlot, betterParentCrossoverPerformancePlot, childDiversityToWorseParentHelper, childDiversityToBetterParentHelper, parentDiversityHelper, parentQualityHelper;
+    [Storable]
+    private DataTableHelper successHelper, equalParentsHelper;
     [Storable]
     private int cnt = 0;
@@ -91,6 +91,4 @@
     [Storable]
     private int equalParents = 0;
-    [Storable]
-    private List<double> qualityPoints = new List<double>();
 
     [StorableConstructor]
@@ -102,11 +100,10 @@
       lastGeneration = original.lastGeneration;
       equalParents = original.equalParents;
-      qualityPoints = new List<double>(original.qualityPoints);
-      plotHelper = (ScatterPlotHelper)original.plotHelper.Clone(cloner);
+      worseParentCrossoverPerformancePlot = (ScatterPlotHelper)original.worseParentCrossoverPerformancePlot.Clone(cloner);
+      betterParentCrossoverPerformancePlot = (ScatterPlotHelper)original.betterParentCrossoverPerformancePlot.Clone(cloner);
       childDiversityToWorseParentHelper = (ScatterPlotHelper)original.childDiversityToWorseParentHelper.Clone(cloner);
       childDiversityToBetterParentHelper = (ScatterPlotHelper)original.childDiversityToBetterParentHelper.Clone(cloner);
       parentDiversityHelper = (ScatterPlotHelper)original.parentDiversityHelper.Clone(cloner);
       parentQualityHelper = (ScatterPlotHelper)original.parentQualityHelper.Clone(cloner);
-      performanceHelper = (DataTableHelper)original.performanceHelper.Clone(cloner);
       successHelper = (DataTableHelper)original.successHelper.Clone(cloner);
       equalParentsHelper = (DataTableHelper)original.equalParentsHelper.Clone(cloner);
@@ -136,10 +133,10 @@
 
 
-      plotHelper = new ScatterPlotHelper(false, true);
+      worseParentCrossoverPerformancePlot = new ScatterPlotHelper(false, true);
+      betterParentCrossoverPerformancePlot = new ScatterPlotHelper(false, true);
       childDiversityToWorseParentHelper = new ScatterPlotHelper(false, true);
       childDiversityToBetterParentHelper = new ScatterPlotHelper(false, true);
       parentDiversityHelper = new ScatterPlotHelper(false, true);
       parentQualityHelper = new ScatterPlotHelper(false, true);
-      performanceHelper = new DataTableHelper();
       successHelper = new DataTableHelper();
       equalParentsHelper = new DataTableHelper();
@@ -167,10 +164,10 @@
       }
 
-      plotHelper.InitializePlot(Results, "Crossover Performance", "Solution Index", "Absolut Quality Difference");
+      worseParentCrossoverPerformancePlot.InitializePlot(Results, "Crossover Performance compared to worse parent", "Solution Index", "Absolut Quality Difference");
+      betterParentCrossoverPerformancePlot.InitializePlot(Results, "Crossover Performance compared to better parent", "Solution Index", "Absolut Quality Difference");
       childDiversityToWorseParentHelper.InitializePlot(Results, "Child Diversity to Worse Parent", "Solution Index", "Diversity");
       childDiversityToBetterParentHelper.InitializePlot(Results, "Child Diversity to Better Parent", "Solution Index", "Diversity");
       parentDiversityHelper.InitializePlot(Results, "Parent Diversity", "Solution Index", "Diversity");
       parentQualityHelper.InitializePlot(Results, "Parent Quality Difference", "Solution Index", "Absolut Quality Difference");
-      performanceHelper.InitializeChart(Results, "Average Crossover Performance", new string[] { "Average Crossover Performance per Generation" });
       equalParentsHelper.InitializeChart(Results, "Number of equal parents", new string[] { "Absolut number of equal parents" });
 
@@ -186,5 +183,5 @@
       Initialize();
 
-      Point2D<double> qualityPoint, childDiversityToWorseParent, childDiversityToBetterParent, diversityPointParent, qualityPointParent;
+      Point2D<double> worseQualityPoint, betterQualityPoint, childDiversityToWorseParent, childDiversityToBetterParent, diversityPointParent, qualityPointParent;
       var parent1 = ParentsParameter.ActualValue.First();
       var parent2 = ParentsParameter.ActualValue.Last();
@@ -200,11 +197,18 @@
       qualityPointParent = new Point2D<double>(cnt, Math.Abs(qualityParent1 - qualityParent2));
 
+
+      double worseQuality, betterQuality;
+
       if (qualityParent1 > qualityParent2) {
         if (MaximizationParameter.ActualValue.Value) {
           childDiversityToWorseParent = new Point2D<double>(cnt, SimilarityCalculatorParameter.Value.CalculateSolutionSimilarity(ExecutionContext.Scope, ExecutionContext.Scope.SubScopes.Last()));
           childDiversityToBetterParent = new Point2D<double>(cnt, SimilarityCalculatorParameter.Value.CalculateSolutionSimilarity(ExecutionContext.Scope, ExecutionContext.Scope.SubScopes.First()));
+          worseQuality = qualityParent2;
+          betterQuality = qualityParent1;
         } else {
           childDiversityToWorseParent = new Point2D<double>(cnt, SimilarityCalculatorParameter.Value.CalculateSolutionSimilarity(ExecutionContext.Scope, ExecutionContext.Scope.SubScopes.First()));
           childDiversityToBetterParent = new Point2D<double>(cnt, SimilarityCalculatorParameter.Value.CalculateSolutionSimilarity(ExecutionContext.Scope, ExecutionContext.Scope.SubScopes.Last()));
+          worseQuality = qualityParent1;
+          betterQuality = qualityParent2;
         }
       } else {
@@ -212,14 +216,53 @@
           childDiversityToWorseParent = new Point2D<double>(cnt, SimilarityCalculatorParameter.Value.CalculateSolutionSimilarity(ExecutionContext.Scope, ExecutionContext.Scope.SubScopes.First()));
           childDiversityToBetterParent = new Point2D<double>(cnt, SimilarityCalculatorParameter.Value.CalculateSolutionSimilarity(ExecutionContext.Scope, ExecutionContext.Scope.SubScopes.Last()));
+          worseQuality = qualityParent1;
+          betterQuality = qualityParent2;
         } else {
           childDiversityToWorseParent = new Point2D<double>(cnt, SimilarityCalculatorParameter.Value.CalculateSolutionSimilarity(ExecutionContext.Scope, ExecutionContext.Scope.SubScopes.Last()));
           childDiversityToBetterParent = new Point2D<double>(cnt, SimilarityCalculatorParameter.Value.CalculateSolutionSimilarity(ExecutionContext.Scope, ExecutionContext.Scope.SubScopes.First()));
-        }
-      }
-
-      double worseQuality = qualityParent1 > qualityParent2 ? qualityParent1 : qualityParent2;
-      qualityPoint = new Point2D<double>(cnt++, worseQuality - qualityChild);
-      qualityPoints.Add(qualityPoint.Y);
-
+          worseQuality = qualityParent2;
+          betterQuality = qualityParent1;
+        }
+      }
+
+      worseQualityPoint = new Point2D<double>(cnt, worseQuality - qualityChild);
+      betterQualityPoint = new Point2D<double>(cnt++, betterQuality - qualityChild);
+
+      if (GenerationsParameter.ActualValue.Value == lastGeneration) {
+        CountSuccess(qualityChild, qualityParent1, qualityParent2);
+
+        if (parentDiversity == 1.0) {
+          equalParents++;
+        }
+      }
+
+      if (GenerationsParameter.ActualValue.Value != 0) {
+        if (GenerationsParameter.ActualValue.Value > lastGeneration) {
+          equalParentsHelper.AddPoint(equalParents);
+
+          for (int i = 0; i < ComparisonFactorParameter.Value.Count; i++) {
+            successHelper.AddPoint(SuccessfullCrossoversRowName + ComparisonFactorParameter.Value.ElementAt(i).Value.ToString(), success[i]);
+          }
+
+          Reset();
+
+          CountSuccess(qualityChild, qualityParent1, qualityParent2);
+          if (parentDiversity == 1.0) {
+            equalParents++;
+          }
+        }
+
+        betterParentCrossoverPerformancePlot.AddPoint(curGenStr, betterQualityPoint);
+        worseParentCrossoverPerformancePlot.AddPoint(curGenStr, worseQualityPoint);
+        childDiversityToWorseParentHelper.AddPoint(curGenStr, childDiversityToWorseParent);
+        childDiversityToBetterParentHelper.AddPoint(curGenStr, childDiversityToBetterParent);
+        parentDiversityHelper.AddPoint(curGenStr, diversityPointParent);
+        parentQualityHelper.AddPoint(curGenStr, qualityPointParent);
+      }
+
+      return base.Apply();
+    }
+
+    private void CountSuccess(double qualityChild, double qualityParent1, double qualityParent2) {
       //track successfull cx
       var compFactsArray = ComparisonFactorParameter.Value.ToArray();
@@ -229,31 +272,4 @@
         }
       }
-
-      if (parentDiversity == 1.0) {
-        equalParents++;
-      }
-
-      if (GenerationsParameter.ActualValue.Value != 0) {
-        if (GenerationsParameter.ActualValue.Value > lastGeneration) {
-          double avg = qualityPoints.Average();
-
-          performanceHelper.AddPoint(avg);
-          equalParentsHelper.AddPoint(equalParents);
-
-          for (int i = 0; i < compFactsArray.Length; i++) {
-            successHelper.AddPoint(SuccessfullCrossoversRowName + compFactsArray[i].Value.ToString(), success[i]);
-          }
-
-          Reset();
-        }
-
-        plotHelper.AddPoint(curGenStr, qualityPoint);
-        childDiversityToWorseParentHelper.AddPoint(curGenStr, childDiversityToWorseParent);
-        childDiversityToBetterParentHelper.AddPoint(curGenStr, childDiversityToBetterParent);
-        parentDiversityHelper.AddPoint(curGenStr, diversityPointParent);
-        parentQualityHelper.AddPoint(curGenStr, qualityPointParent);
-      } 
-
-      return base.Apply();
     }
 
@@ -262,5 +278,4 @@
       success = new int[ComparisonFactorParameter.Value.Count];
       lastGeneration = GenerationsParameter.ActualValue.Value;
-      qualityPoints.Clear();
       equalParents = 0;
     }
