[13368] | 1 | #region License Information
|
---|
[10072] | 2 | /* HeuristicLab
|
---|
[12012] | 3 | * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[10072] | 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/>.
|
---|
[10968] | 19 | *
|
---|
| 20 | * Author: Sabine Winkler
|
---|
[10072] | 21 | */
|
---|
| 22 | #endregion
|
---|
| 23 |
|
---|
| 24 | using System;
|
---|
| 25 | using System.Collections.Generic;
|
---|
| 26 | using System.Linq;
|
---|
| 27 | using HeuristicLab.Common;
|
---|
| 28 | using HeuristicLab.Core;
|
---|
| 29 | using HeuristicLab.Data;
|
---|
[10073] | 30 | using HeuristicLab.Encodings.IntegerVectorEncoding;
|
---|
[10072] | 31 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
| 32 | using HeuristicLab.Operators;
|
---|
| 33 | using HeuristicLab.Optimization;
|
---|
| 34 | using HeuristicLab.Parameters;
|
---|
| 35 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
[10073] | 36 | using HeuristicLab.Problems.DataAnalysis;
|
---|
| 37 | using HeuristicLab.Problems.DataAnalysis.Symbolic;
|
---|
| 38 | using HeuristicLab.Problems.GrammaticalEvolution.Mappers;
|
---|
[10072] | 39 | using HeuristicLab.Random;
|
---|
| 40 |
|
---|
[10073] | 41 | namespace HeuristicLab.Problems.GrammaticalEvolution {
|
---|
[14711] | 42 | [StorableType("30AA60C4-F2F9-470C-BFED-0C31DC05EBB6")]
|
---|
[10073] | 43 | public abstract class GESymbolicDataAnalysisEvaluator<T> : SingleSuccessorOperator,
|
---|
| 44 | IGESymbolicDataAnalysisEvaluator<T>, ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator, IStochasticOperator
|
---|
[10072] | 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";
|
---|
[10073] | 50 | private const string IntegerVectorParameterName = "IntegerVector";
|
---|
| 51 | private const string GenotypeToPhenotypeMapperParameterName = "GenotypeToPhenotypeMapper";
|
---|
| 52 | private const string SymbolicExpressionTreeGrammarParameterName = "SymbolicExpressionTreeGrammar";
|
---|
| 53 |
|
---|
[10072] | 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 | }
|
---|
[10073] | 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 | }
|
---|
[10072] | 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]
|
---|
[10073] | 108 | protected GESymbolicDataAnalysisEvaluator(bool deserializing) : base(deserializing) { }
|
---|
| 109 | protected GESymbolicDataAnalysisEvaluator(GESymbolicDataAnalysisEvaluator<T> original, Cloner cloner)
|
---|
[10072] | 110 | : base(original, cloner) {
|
---|
| 111 | }
|
---|
[10073] | 112 | public GESymbolicDataAnalysisEvaluator()
|
---|
[10072] | 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."));
|
---|
[10073] | 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 |
|
---|
[10072] | 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 | }
|
---|