Free cookie consent management tool by TermsFeed Policy Generator

source: branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape/Analysis/Aggregators/QualityTrailSummaryAggregator.cs @ 11194

Last change on this file since 11194 was 7128, checked in by epitzer, 13 years ago

#1696 Integrate fitness landscape analysis plugins from Heureka! repository.

File size: 2.0 KB
Line 
1using System.Collections.Generic;
2using HeuristicLab.Analysis.FitnessLandscape.DataTables;
3using HeuristicLab.Common;
4using HeuristicLab.Core;
5using HeuristicLab.Optimization;
6using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
7
8namespace HeuristicLab.Analysis.FitnessLandscape {
9
10  [Item("QualityTrailSummary Aggregator", "Aggregates quality trail summaries.")]
11  [StorableClass]
12  public class QualityTrailSummaryAggregator : Aggregator<QualityTrailSummaryTable> {
13
14    [StorableConstructor]
15    protected QualityTrailSummaryAggregator(bool deserializing) : base(deserializing) { }
16    protected QualityTrailSummaryAggregator(QualityTrailSummaryAggregator original, Cloner cloner) : base(original, cloner) { }
17    public QualityTrailSummaryAggregator() { }
18    public override IDeepCloneable Clone(Cloner cloner) {
19      return new QualityTrailSummaryAggregator(this, cloner);
20    }
21
22    public override IResult CreateResult() {
23      return new Result("Quality Trail Summary", Aggregate(items));
24    }
25
26    public static DataTable Aggregate(List<QualityTrailSummaryTable> qualityTrailSummaryTables) {
27
28      DataRow minRow = new DataRow("Minima");
29      DataRow q1Row = new DataRow("Q1");
30      DataRow medRow = new DataRow("Medians");
31      DataRow q3Row = new DataRow("Q3");
32      DataRow maxRow = new DataRow("Maxima");
33      foreach (var table in qualityTrailSummaryTables) {
34        var quartiles = table.Rows["Value Quantiles"].Values;
35        minRow.Values.Add(quartiles[0]);
36        q1Row.Values.Add(quartiles[1]);
37        medRow.Values.Add(quartiles[2]);
38        q3Row.Values.Add(quartiles[3]);
39        maxRow.Values.Add(quartiles[4]);
40      }
41      DataTable summaryTable = new DataTable("Quality Quartiles");
42      summaryTable.Rows.Add(minRow);
43      summaryTable.Rows.Add(q1Row);
44      summaryTable.Rows.Add(medRow);
45      summaryTable.Rows.Add(q3Row);
46      summaryTable.Rows.Add(maxRow);
47      return summaryTable;
48    }
49  }
50}
Note: See TracBrowser for help on using the repository browser.