Free cookie consent management tool by TermsFeed Policy Generator

source: addons/HeuristicLab.FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape/Analysis/Aggregators/QualityTrailSummaryAggregator.cs @ 16995

Last change on this file since 16995 was 16995, checked in by gkronber, 5 years ago

#2520 Update plugin dependencies and references for HL.FLA for new persistence

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 HEAL.Attic;
7
8namespace HeuristicLab.Analysis.FitnessLandscape {
9
10  [Item("QualityTrailSummary Aggregator", "Aggregates quality trail summaries.")]
11  [StorableType("B07DD0C5-AAA2-46C4-8BF2-64EB07951985")]
12  public class QualityTrailSummaryAggregator : Aggregator<QualityTrailSummaryTable> {
13
14    [StorableConstructor]
15    protected QualityTrailSummaryAggregator(StorableConstructorFlag _) : base(_) { }
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.