1 | using HEAL.Attic;
|
---|
2 | using HeuristicLab.Analysis;
|
---|
3 | using HeuristicLab.Common;
|
---|
4 | using HeuristicLab.Core;
|
---|
5 | using HeuristicLab.Data;
|
---|
6 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
7 | using HeuristicLab.Optimization;
|
---|
8 | using HeuristicLab.Parameters;
|
---|
9 | using HeuristicLab.Problems.DataAnalysis;
|
---|
10 | using HeuristicLab.Problems.DataAnalysis.Symbolic;
|
---|
11 | using System;
|
---|
12 | using System.Collections.Generic;
|
---|
13 | using System.Linq;
|
---|
14 | using System.Text;
|
---|
15 | using System.Threading.Tasks;
|
---|
16 |
|
---|
17 | namespace HeuristicLab.Algorithms.OESRALPS.Analyzers
|
---|
18 | {
|
---|
19 | [Item("LayerQualityAnalyzer", "An operator that analyzes the validation and training best solution for single objective problems on a layer.")]
|
---|
20 | [StorableType("31E292AA-95B2-4FA4-8544-CF2025B65822")]
|
---|
21 | public abstract class LayerQualityAnalyzer : SymbolicDataAnalysisSingleObjectiveAnalyzer
|
---|
22 | {
|
---|
23 | protected const string TrainingBestSolutionsParameterName = "Best training solution";
|
---|
24 | protected const string TrainingBestSolutionQualitiesParameterName = "Best training solution quality";
|
---|
25 |
|
---|
26 | private const string ValidationBestSolutionParameterName = "Best validation solution";
|
---|
27 | private const string ValidationBestSolutionQualityParameterName = "Best validation solution quality";
|
---|
28 |
|
---|
29 | private const string LayerBestSolutionChartName = "Layer best solution chart";
|
---|
30 |
|
---|
31 | [StorableConstructor]
|
---|
32 | protected LayerQualityAnalyzer(StorableConstructorFlag _) : base(_) { }
|
---|
33 | protected LayerQualityAnalyzer(LayerQualityAnalyzer original, Cloner cloner)
|
---|
34 | : base(original, cloner)
|
---|
35 | {
|
---|
36 | }
|
---|
37 |
|
---|
38 | protected LayerQualityAnalyzer() : base()
|
---|
39 | {
|
---|
40 | }
|
---|
41 |
|
---|
42 | public override IOperation Apply()
|
---|
43 | {
|
---|
44 | var results = ResultCollection;
|
---|
45 | if (!results.ContainsKey(TrainingBestSolutionsParameterName)
|
---|
46 | || !results.ContainsKey(ValidationBestSolutionParameterName))
|
---|
47 | return base.Apply();
|
---|
48 |
|
---|
49 | #region Add Parameter
|
---|
50 | if (!results.ContainsKey(LayerBestSolutionChartName))
|
---|
51 | results.Add(new Result(LayerBestSolutionChartName, new DataTable(LayerBestSolutionChartName)));
|
---|
52 |
|
---|
53 | var layerQualityTable = (DataTable)results[LayerBestSolutionChartName].Value;
|
---|
54 |
|
---|
55 | if (!layerQualityTable.Rows.ContainsKey(TrainingBestSolutionQualitiesParameterName))
|
---|
56 | layerQualityTable.Rows.Add(new DataRow(TrainingBestSolutionQualitiesParameterName));
|
---|
57 | if (!layerQualityTable.Rows.ContainsKey(ValidationBestSolutionQualityParameterName))
|
---|
58 | layerQualityTable.Rows.Add(new DataRow(ValidationBestSolutionQualityParameterName));
|
---|
59 | #endregion
|
---|
60 |
|
---|
61 | layerQualityTable.Rows[TrainingBestSolutionQualitiesParameterName].Values.Add(((DoubleValue)results[TrainingBestSolutionQualitiesParameterName].Value).Value);
|
---|
62 | layerQualityTable.Rows[ValidationBestSolutionQualityParameterName].Values.Add(((DoubleValue)results[ValidationBestSolutionQualityParameterName].Value).Value);
|
---|
63 |
|
---|
64 | return base.Apply();
|
---|
65 | }
|
---|
66 | }
|
---|
67 | }
|
---|