Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 16591 was 16573, checked in by gkronber, 6 years ago

#2520: changed HeuristicLab.FLA addon to compile with new HL.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 HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
7using HEAL.Attic;
8
9namespace HeuristicLab.Analysis.FitnessLandscape {
10
11  [Item("QualityTrailSummary Aggregator", "Aggregates quality trail summaries.")]
12  [StorableType("B07DD0C5-AAA2-46C4-8BF2-64EB07951985")]
13  public class QualityTrailSummaryAggregator : Aggregator<QualityTrailSummaryTable> {
14
15    [StorableConstructor]
16    protected QualityTrailSummaryAggregator(StorableConstructorFlag _) : base(_) { }
17    protected QualityTrailSummaryAggregator(QualityTrailSummaryAggregator original, Cloner cloner) : base(original, cloner) { }
18    public QualityTrailSummaryAggregator() { }
19    public override IDeepCloneable Clone(Cloner cloner) {
20      return new QualityTrailSummaryAggregator(this, cloner);
21    }
22
23    public override IResult CreateResult() {
24      return new Result("Quality Trail Summary", Aggregate(items));
25    }
26
27    public static DataTable Aggregate(List<QualityTrailSummaryTable> qualityTrailSummaryTables) {
28
29      DataRow minRow = new DataRow("Minima");
30      DataRow q1Row = new DataRow("Q1");
31      DataRow medRow = new DataRow("Medians");
32      DataRow q3Row = new DataRow("Q3");
33      DataRow maxRow = new DataRow("Maxima");
34      foreach (var table in qualityTrailSummaryTables) {
35        var quartiles = table.Rows["Value Quantiles"].Values;
36        minRow.Values.Add(quartiles[0]);
37        q1Row.Values.Add(quartiles[1]);
38        medRow.Values.Add(quartiles[2]);
39        q3Row.Values.Add(quartiles[3]);
40        maxRow.Values.Add(quartiles[4]);
41      }
42      DataTable summaryTable = new DataTable("Quality Quartiles");
43      summaryTable.Rows.Add(minRow);
44      summaryTable.Rows.Add(q1Row);
45      summaryTable.Rows.Add(medRow);
46      summaryTable.Rows.Add(q3Row);
47      summaryTable.Rows.Add(maxRow);
48      return summaryTable;
49    }
50  }
51}
Note: See TracBrowser for help on using the repository browser.