Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2708_ScopedAlgorithms/HeuristicLab.Problems.GrammaticalEvolution/3.4/SymbolicRegression/GESymbolicDataAnalysisEvaluator.cs @ 17971

Last change on this file since 17971 was 12012, checked in by ascheibe, 10 years ago

#2212 merged r12008, r12009, r12010 back into trunk

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