Index: /trunk/sources/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalysis/AlleleFrequencyAnalyzer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalysis/AlleleFrequencyAnalyzer.cs	(revision 8288)
+++ /trunk/sources/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalysis/AlleleFrequencyAnalyzer.cs	(revision 8289)
@@ -170,11 +170,99 @@
         }
 
-        // calculate scatter plot of contained relevant alleles and relative quality
-        double avgContainedReleventAlleles = 0;
+        // store allele frequencies
+        AlleleFrequencyCollection frequenciesCollection = new AlleleFrequencyCollection(frequencies);
+        if (!results.ContainsKey("Allele Frequencies"))
+          results.Add(new Result("Allele Frequencies", frequenciesCollection));
+        else
+          results["Allele Frequencies"].Value = frequenciesCollection;
+
+        // store allele frequencies history
+        if (storeHistory) {
+          if (!results.ContainsKey("Allele Frequencies History")) {
+            AlleleFrequencyCollectionHistory history = new AlleleFrequencyCollectionHistory();
+            history.Add(frequenciesCollection);
+            results.Add(new Result("Allele Frequencies History", history));
+          } else {
+            ((AlleleFrequencyCollectionHistory)results["Allele Frequencies History"].Value).Add(frequenciesCollection);
+          }
+        }
+
+        // store alleles data table
+        DataTable allelesTable;
+        if (!results.ContainsKey("Alleles")) {
+          allelesTable = new DataTable("Alleles");
+          allelesTable.VisualProperties.XAxisTitle = "Iteration";
+          allelesTable.VisualProperties.YAxisTitle = "Number of Alleles";
+          allelesTable.VisualProperties.SecondYAxisTitle = "Number of Alleles";
+
+          allelesTable.Rows.Add(new DataRow("Unique Alleles"));
+          allelesTable.Rows["Unique Alleles"].VisualProperties.StartIndexZero = true;
+
+          allelesTable.Rows.Add(new DataRow("Unique Alleles of Best Known Solution", null));
+          allelesTable.Rows["Unique Alleles of Best Known Solution"].VisualProperties.SecondYAxis = true;
+          allelesTable.Rows["Unique Alleles of Best Known Solution"].VisualProperties.StartIndexZero = true;
+
+          allelesTable.Rows.Add(new DataRow("Fixed Alleles", null));
+          allelesTable.Rows["Fixed Alleles"].VisualProperties.SecondYAxis = true;
+          allelesTable.Rows["Fixed Alleles"].VisualProperties.StartIndexZero = true;
+
+          allelesTable.Rows.Add(new DataRow("Fixed Alleles of Best Known Solution", null));
+          allelesTable.Rows["Fixed Alleles of Best Known Solution"].VisualProperties.SecondYAxis = true;
+          allelesTable.Rows["Fixed Alleles of Best Known Solution"].VisualProperties.StartIndexZero = true;
+
+          allelesTable.Rows.Add(new DataRow("Lost Alleles of Best Known Solution", null));
+          allelesTable.Rows["Lost Alleles of Best Known Solution"].VisualProperties.SecondYAxis = true;
+          allelesTable.Rows["Lost Alleles of Best Known Solution"].VisualProperties.StartIndexZero = true;
+
+          results.Add(new Result("Alleles", allelesTable));
+        } else {
+          allelesTable = (DataTable)results["Alleles"].Value;
+        }
+
+        int fixedAllelesCount = frequenciesCollection.Where(x => x.Frequency == 1).Count();
+        var relevantAlleles = frequenciesCollection.Where(x => x.ContainedInBestKnownSolution);
+        int relevantAllelesCount = relevantAlleles.Count();
+        int fixedRelevantAllelesCount = relevantAlleles.Where(x => x.Frequency == 1).Count();
+        int lostRelevantAllelesCount = relevantAlleles.Where(x => x.Frequency == 0).Count();
+        int uniqueRelevantAllelesCount = relevantAllelesCount - lostRelevantAllelesCount;
+        allelesTable.Rows["Unique Alleles"].Values.Add(frequenciesCollection.Count);
+        allelesTable.Rows["Unique Alleles of Best Known Solution"].Values.Add(uniqueRelevantAllelesCount);
+        allelesTable.Rows["Fixed Alleles"].Values.Add(fixedAllelesCount);
+        allelesTable.Rows["Fixed Alleles of Best Known Solution"].Values.Add(fixedRelevantAllelesCount);
+        allelesTable.Rows["Lost Alleles of Best Known Solution"].Values.Add(lostRelevantAllelesCount);
+
+        // store alleles values
+        if (!results.ContainsKey("Unique Alleles"))
+          results.Add(new Result("Unique Alleles", new DoubleValue(frequenciesCollection.Count)));
+        else
+          ((DoubleValue)results["Unique Alleles"].Value).Value = frequenciesCollection.Count;
+
+        if (!results.ContainsKey("Unique Alleles of Best Known Solution"))
+          results.Add(new Result("Unique Alleles of Best Known Solution", new DoubleValue(uniqueRelevantAllelesCount)));
+        else
+          ((DoubleValue)results["Unique Alleles of Best Known Solution"].Value).Value = uniqueRelevantAllelesCount;
+
+        if (!results.ContainsKey("Fixed Alleles"))
+          results.Add(new Result("Fixed Alleles", new DoubleValue(fixedAllelesCount)));
+        else
+          ((DoubleValue)results["Fixed Alleles"].Value).Value = fixedAllelesCount;
+
+        if (!results.ContainsKey("Fixed Alleles of Best Known Solution"))
+          results.Add(new Result("Fixed Alleles of Best Known Solution", new DoubleValue(fixedRelevantAllelesCount)));
+        else
+          ((DoubleValue)results["Fixed Alleles of Best Known Solution"].Value).Value = fixedRelevantAllelesCount;
+
+        if (!results.ContainsKey("Lost Alleles of Best Known Solution"))
+          results.Add(new Result("Lost Alleles of Best Known Solution", new DoubleValue(lostRelevantAllelesCount)));
+        else
+          ((DoubleValue)results["Lost Alleles of Best Known Solution"].Value).Value = lostRelevantAllelesCount;
+
+        // calculate contained alleles of best known solution and relative quality
         if (bestKnownAlleles != null) {
           double qualityRange = Math.Abs(qualities.Max() - qualities.Min());
           var points = solutions.Select((s, index) => new Point2D<double>(CalculateAlleles(s).Intersect(bestKnownAlleles, new AlleleIdEqualityComparer()).Count(),
                                                                           Math.Abs(qualities[index] - qualities[bestIndex]) / qualityRange));
-          avgContainedReleventAlleles = points.Select(x => x.X).Average();
+          var avgContainedReleventAlleles = points.Select(x => x.X).Average();
+
           var plot = new ScatterPlot("Contained Alleles of Best Known Solution and Relative Solution Qualtiy", null);
           plot.VisualProperties.XAxisTitle = "Contained Alleles of Best Known Solution";
@@ -203,98 +291,17 @@
             ((ScatterPlotHistory)results["Scatter Plot History"].Value).Add(plot);
           }
-        }
-
-        // store allele frequencies
-        AlleleFrequencyCollection frequenciesCollection = new AlleleFrequencyCollection(frequencies);
-        if (!results.ContainsKey("Allele Frequencies"))
-          results.Add(new Result("Allele Frequencies", frequenciesCollection));
-        else
-          results["Allele Frequencies"].Value = frequenciesCollection;
-
-        // store allele frequencies history
-        if (storeHistory) {
-          if (!results.ContainsKey("Allele Frequencies History")) {
-            AlleleFrequencyCollectionHistory history = new AlleleFrequencyCollectionHistory();
-            history.Add(frequenciesCollection);
-            results.Add(new Result("Allele Frequencies History", history));
-          } else {
-            ((AlleleFrequencyCollectionHistory)results["Allele Frequencies History"].Value).Add(frequenciesCollection);
+
+          if (!allelesTable.Rows.ContainsKey("Average Contained Alleles of Best Known Solution")) {
+            allelesTable.Rows.Add(new DataRow("Average Contained Alleles of Best Known Solution", null));
+            allelesTable.Rows["Average Contained Alleles of Best Known Solution"].VisualProperties.SecondYAxis = true;
+            allelesTable.Rows["Average Contained Alleles of Best Known Solution"].VisualProperties.StartIndexZero = true;
           }
-        }
-
-        // store alleles data table
-        DataTable allelesTable;
-        if (!results.ContainsKey("Alleles")) {
-          allelesTable = new DataTable("Alleles");
-          allelesTable.VisualProperties.XAxisTitle = "Iteration";
-          allelesTable.VisualProperties.YAxisTitle = "Number of Alleles";
-          allelesTable.VisualProperties.SecondYAxisTitle = "Number of Alleles";
-
-          allelesTable.Rows.Add(new DataRow("Unique Alleles"));
-          allelesTable.Rows["Unique Alleles"].VisualProperties.StartIndexZero = true;
-
-          allelesTable.Rows.Add(new DataRow("Unique Alleles of Best Known Solution", null));
-          allelesTable.Rows["Unique Alleles of Best Known Solution"].VisualProperties.SecondYAxis = true;
-          allelesTable.Rows["Unique Alleles of Best Known Solution"].VisualProperties.StartIndexZero = true;
-
-          allelesTable.Rows.Add(new DataRow("Fixed Alleles", null));
-          allelesTable.Rows["Fixed Alleles"].VisualProperties.SecondYAxis = true;
-          allelesTable.Rows["Fixed Alleles"].VisualProperties.StartIndexZero = true;
-
-          allelesTable.Rows.Add(new DataRow("Fixed Alleles of Best Known Solution", null));
-          allelesTable.Rows["Fixed Alleles of Best Known Solution"].VisualProperties.SecondYAxis = true;
-          allelesTable.Rows["Fixed Alleles of Best Known Solution"].VisualProperties.StartIndexZero = true;
-
-          allelesTable.Rows.Add(new DataRow("Lost Alleles of Best Known Solution", null));
-          allelesTable.Rows["Lost Alleles of Best Known Solution"].VisualProperties.SecondYAxis = true;
-          allelesTable.Rows["Lost Alleles of Best Known Solution"].VisualProperties.StartIndexZero = true;
-
-          allelesTable.Rows.Add(new DataRow("Average Contained Alleles of Best Known Solution", null));
-          allelesTable.Rows["Average Contained Alleles of Best Known Solution"].VisualProperties.SecondYAxis = true;
-          allelesTable.Rows["Average Contained Alleles of Best Known Solution"].VisualProperties.StartIndexZero = true;
-
-          results.Add(new Result("Alleles", allelesTable));
-        } else {
-          allelesTable = (DataTable)results["Alleles"].Value;
-        }
-
-        int fixedAllelesCount = frequenciesCollection.Where(x => x.Frequency == 1).Count();
-        var relevantAlleles = frequenciesCollection.Where(x => x.ContainedInBestKnownSolution);
-        int relevantAllelesCount = relevantAlleles.Count();
-        int fixedRelevantAllelesCount = relevantAlleles.Where(x => x.Frequency == 1).Count();
-        int lostRelevantAllelesCount = relevantAlleles.Where(x => x.Frequency == 0).Count();
-        int uniqueRelevantAllelesCount = relevantAllelesCount - lostRelevantAllelesCount;
-        allelesTable.Rows["Unique Alleles"].Values.Add(frequenciesCollection.Count);
-        allelesTable.Rows["Unique Alleles of Best Known Solution"].Values.Add(uniqueRelevantAllelesCount);
-        allelesTable.Rows["Fixed Alleles"].Values.Add(fixedAllelesCount);
-        allelesTable.Rows["Fixed Alleles of Best Known Solution"].Values.Add(fixedRelevantAllelesCount);
-        allelesTable.Rows["Lost Alleles of Best Known Solution"].Values.Add(lostRelevantAllelesCount);
-        allelesTable.Rows["Average Contained Alleles of Best Known Solution"].Values.Add(avgContainedReleventAlleles);
-
-        // store alleles values
-        if (!results.ContainsKey("Unique Alleles"))
-          results.Add(new Result("Unique Alleles", new DoubleValue(frequenciesCollection.Count)));
-        else
-          ((DoubleValue)results["Unique Alleles"].Value).Value = frequenciesCollection.Count;
-
-        if (!results.ContainsKey("Unique Alleles of Best Known Solution"))
-          results.Add(new Result("Unique Alleles of Best Known Solution", new DoubleValue(uniqueRelevantAllelesCount)));
-        else
-          ((DoubleValue)results["Unique Alleles of Best Known Solution"].Value).Value = uniqueRelevantAllelesCount;
-
-        if (!results.ContainsKey("Fixed Alleles"))
-          results.Add(new Result("Fixed Alleles", new DoubleValue(fixedAllelesCount)));
-        else
-          ((DoubleValue)results["Fixed Alleles"].Value).Value = fixedAllelesCount;
-
-        if (!results.ContainsKey("Fixed Alleles of Best Known Solution"))
-          results.Add(new Result("Fixed Alleles of Best Known Solution", new DoubleValue(fixedRelevantAllelesCount)));
-        else
-          ((DoubleValue)results["Fixed Alleles of Best Known Solution"].Value).Value = fixedRelevantAllelesCount;
-
-        if (!results.ContainsKey("Lost Alleles of Best Known Solution"))
-          results.Add(new Result("Lost Alleles of Best Known Solution", new DoubleValue(lostRelevantAllelesCount)));
-        else
-          ((DoubleValue)results["Lost Alleles of Best Known Solution"].Value).Value = lostRelevantAllelesCount;
+          allelesTable.Rows["Average Contained Alleles of Best Known Solution"].Values.Add(avgContainedReleventAlleles);
+
+          if (!results.ContainsKey("Average Contained Alleles of Best Known Solution"))
+            results.Add(new Result("Average Contained Alleles of Best Known Solution", new DoubleValue(avgContainedReleventAlleles)));
+          else
+            ((DoubleValue)results["Average Contained Alleles of Best Known Solution"].Value).Value = avgContainedReleventAlleles;
+        }
       }
       return base.Apply();
