Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveAnalyzer.cs

Last change on this file was 15583, checked in by swagner, 7 years ago

#2640: Updated year of copyrights in license headers

File size: 3.7 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using HeuristicLab.Common;
23using HeuristicLab.Core;
24using HeuristicLab.Data;
25using HeuristicLab.Parameters;
26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
27
28namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
29  /// <summary>
30  /// Abstract base class for multi objective symbolic data analysis analyzers.
31  /// </summary>
32  [StorableClass]
33  public abstract class SymbolicDataAnalysisMultiObjectiveAnalyzer : SymbolicDataAnalysisAnalyzer, ISymbolicDataAnalysisMultiObjectiveAnalyzer {
34    private const string QualitiesParameterName = "Qualities";
35    private const string MaximizationParameterName = "Maximization";
36    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
37    #region parameter properties
38    public IScopeTreeLookupParameter<DoubleArray> QualitiesParameter {
39      get { return (IScopeTreeLookupParameter<DoubleArray>)Parameters[QualitiesParameterName]; }
40    }
41    public ILookupParameter<BoolArray> MaximizationParameter {
42      get { return (ILookupParameter<BoolArray>)Parameters[MaximizationParameterName]; }
43    }
44    public ILookupParameter<BoolValue> ApplyLinearScalingParameter {
45      get { return (ILookupParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
46    }
47    #endregion
48    #region properties
49    public ItemArray<DoubleArray> Qualities {
50      get { return QualitiesParameter.ActualValue; }
51    }
52    public BoolArray Maximization {
53      get { return MaximizationParameter.ActualValue; }
54    }
55    #endregion
56    [StorableConstructor]
57    protected SymbolicDataAnalysisMultiObjectiveAnalyzer(bool deserializing) : base(deserializing) { }
58    protected SymbolicDataAnalysisMultiObjectiveAnalyzer(SymbolicDataAnalysisMultiObjectiveAnalyzer original, Cloner cloner)
59      : base(original, cloner) {
60    }
61    public SymbolicDataAnalysisMultiObjectiveAnalyzer()
62      : base() {
63      Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>(QualitiesParameterName, "The qualities of the trees that should be analyzed."));
64      Parameters.Add(new LookupParameter<BoolArray>(MaximizationParameterName, "The directions of optimization for each dimension."));
65      Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the individual should be linearly scaled before evaluating."));
66    }
67
68    [StorableHook(HookType.AfterDeserialization)]
69    private void AfterDeserialization() {
70      if (Parameters.ContainsKey(ApplyLinearScalingParameterName) && Parameters[ApplyLinearScalingParameterName] is LookupParameter<BoolValue>)
71        Parameters.Remove(ApplyLinearScalingParameterName);
72      if (!Parameters.ContainsKey(ApplyLinearScalingParameterName))
73        Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the individual should be linearly scaled before evaluating."));
74    }
75  }
76}
Note: See TracBrowser for help on using the repository browser.