1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2019 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 | * Author: Sabine Winkler
|
---|
21 | */
|
---|
22 | #endregion
|
---|
23 |
|
---|
24 | using HeuristicLab.Common;
|
---|
25 | using HeuristicLab.Core;
|
---|
26 | using HeuristicLab.Data;
|
---|
27 | using HeuristicLab.Encodings.IntegerVectorEncoding;
|
---|
28 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
29 | using HeuristicLab.Operators;
|
---|
30 | using HeuristicLab.Optimization;
|
---|
31 | using HeuristicLab.Parameters;
|
---|
32 | using HEAL.Attic;
|
---|
33 | using HeuristicLab.Problems.DataAnalysis;
|
---|
34 | using HeuristicLab.Problems.DataAnalysis.Symbolic;
|
---|
35 | using HeuristicLab.Problems.GrammaticalEvolution.Mappers;
|
---|
36 |
|
---|
37 | namespace HeuristicLab.Problems.GrammaticalEvolution {
|
---|
38 | [StorableType("3E723725-9141-4259-BB1D-BACE36657086")]
|
---|
39 | public abstract class GESymbolicDataAnalysisEvaluator<T> : SingleSuccessorOperator,
|
---|
40 | IGESymbolicDataAnalysisEvaluator<T>, ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator, IStochasticOperator
|
---|
41 | where T : class, IDataAnalysisProblemData {
|
---|
42 | private const string RandomParameterName = "Random";
|
---|
43 | private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
|
---|
44 | private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter";
|
---|
45 | private const string ProblemDataParameterName = "ProblemData";
|
---|
46 | private const string IntegerVectorParameterName = "IntegerVector";
|
---|
47 | private const string GenotypeToPhenotypeMapperParameterName = "GenotypeToPhenotypeMapper";
|
---|
48 | private const string SymbolicExpressionTreeGrammarParameterName = "SymbolicExpressionTreeGrammar";
|
---|
49 |
|
---|
50 | private const string EstimationLimitsParameterName = "EstimationLimits";
|
---|
51 | private const string EvaluationPartitionParameterName = "EvaluationPartition";
|
---|
52 | private const string RelativeNumberOfEvaluatedSamplesParameterName = "RelativeNumberOfEvaluatedSamples";
|
---|
53 | private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
|
---|
54 | private const string ValidRowIndicatorParameterName = "ValidRowIndicator";
|
---|
55 |
|
---|
56 | public override bool CanChangeName { get { return false; } }
|
---|
57 |
|
---|
58 | #region parameter properties
|
---|
59 | ILookupParameter<IRandom> IStochasticOperator.RandomParameter {
|
---|
60 | get { return RandomParameter; }
|
---|
61 | }
|
---|
62 |
|
---|
63 | public IValueLookupParameter<IRandom> RandomParameter {
|
---|
64 | get { return (IValueLookupParameter<IRandom>)Parameters[RandomParameterName]; }
|
---|
65 | }
|
---|
66 | public ILookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
|
---|
67 | get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
|
---|
68 | }
|
---|
69 | public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter {
|
---|
70 | get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
|
---|
71 | }
|
---|
72 | public IValueLookupParameter<T> ProblemDataParameter {
|
---|
73 | get { return (IValueLookupParameter<T>)Parameters[ProblemDataParameterName]; }
|
---|
74 | }
|
---|
75 | public ILookupParameter<IntegerVector> IntegerVectorParameter {
|
---|
76 | get { return (ILookupParameter<IntegerVector>)Parameters[IntegerVectorParameterName]; }
|
---|
77 | }
|
---|
78 | public ILookupParameter<IGenotypeToPhenotypeMapper> GenotypeToPhenotypeMapperParameter {
|
---|
79 | get { return (ILookupParameter<IGenotypeToPhenotypeMapper>)Parameters[GenotypeToPhenotypeMapperParameterName]; }
|
---|
80 | }
|
---|
81 | public IValueLookupParameter<ISymbolicDataAnalysisGrammar> SymbolicExpressionTreeGrammarParameter {
|
---|
82 | get { return (IValueLookupParameter<ISymbolicDataAnalysisGrammar>)Parameters[SymbolicExpressionTreeGrammarParameterName]; }
|
---|
83 | }
|
---|
84 |
|
---|
85 | public IValueLookupParameter<IntRange> EvaluationPartitionParameter {
|
---|
86 | get { return (IValueLookupParameter<IntRange>)Parameters[EvaluationPartitionParameterName]; }
|
---|
87 | }
|
---|
88 | public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
|
---|
89 | get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
|
---|
90 | }
|
---|
91 | public IValueLookupParameter<PercentValue> RelativeNumberOfEvaluatedSamplesParameter {
|
---|
92 | get { return (IValueLookupParameter<PercentValue>)Parameters[RelativeNumberOfEvaluatedSamplesParameterName]; }
|
---|
93 | }
|
---|
94 | public ILookupParameter<BoolValue> ApplyLinearScalingParameter {
|
---|
95 | get { return (ILookupParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
|
---|
96 | }
|
---|
97 | public IValueLookupParameter<StringValue> ValidRowIndicatorParameter {
|
---|
98 | get { return (IValueLookupParameter<StringValue>)Parameters[ValidRowIndicatorParameterName]; }
|
---|
99 | }
|
---|
100 | #endregion
|
---|
101 |
|
---|
102 |
|
---|
103 | [StorableConstructor]
|
---|
104 | protected GESymbolicDataAnalysisEvaluator(StorableConstructorFlag _) : base(_) { }
|
---|
105 | protected GESymbolicDataAnalysisEvaluator(GESymbolicDataAnalysisEvaluator<T> original, Cloner cloner)
|
---|
106 | : base(original, cloner) {
|
---|
107 | }
|
---|
108 | public GESymbolicDataAnalysisEvaluator()
|
---|
109 | : base() {
|
---|
110 | Parameters.Add(new ValueLookupParameter<IRandom>(RandomParameterName, "The random generator to use."));
|
---|
111 | Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic data analysis tree."));
|
---|
112 | Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic data analysis solution encoded as a symbolic expression tree."));
|
---|
113 | Parameters.Add(new ValueLookupParameter<T>(ProblemDataParameterName, "The problem data on which the symbolic data analysis solution should be evaluated."));
|
---|
114 | Parameters.Add(new LookupParameter<IntegerVector>(IntegerVectorParameterName, "The symbolic data analysis solution encoded as an integer vector genome."));
|
---|
115 | Parameters.Add(new LookupParameter<IGenotypeToPhenotypeMapper>(GenotypeToPhenotypeMapperParameterName, "Maps the genotype (an integer vector) to the phenotype (a symbolic expression tree)."));
|
---|
116 | Parameters.Add(new ValueLookupParameter<ISymbolicDataAnalysisGrammar>(SymbolicExpressionTreeGrammarParameterName, "The tree grammar that defines the correct syntax of symbolic expression trees that should be created."));
|
---|
117 |
|
---|
118 | Parameters.Add(new ValueLookupParameter<IntRange>(EvaluationPartitionParameterName, "The start index of the dataset partition on which the symbolic data analysis solution should be evaluated."));
|
---|
119 | Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The upper and lower limit that should be used as cut off value for the output values of symbolic data analysis trees."));
|
---|
120 | Parameters.Add(new ValueLookupParameter<PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, "The relative number of samples of the dataset partition, which should be randomly chosen for evaluation between the start and end index."));
|
---|
121 | Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the individual should be linearly scaled before evaluating."));
|
---|
122 | Parameters.Add(new ValueLookupParameter<StringValue>(ValidRowIndicatorParameterName, "An indicator variable in the data set that specifies which rows should be evaluated (those for which the indicator <> 0) (optional)."));
|
---|
123 | }
|
---|
124 |
|
---|
125 | [StorableHook(HookType.AfterDeserialization)]
|
---|
126 | private void AfterDeserialization() {
|
---|
127 | }
|
---|
128 | }
|
---|
129 | }
|
---|