Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/29/09 18:28:45 (15 years ago)
Author:
gkronber
Message:

GP Refactoring #713

  • introduced a plugin for GP interfaces
  • created a new interface IGeneticProgrammingModel which represents GP models in HL scopes instead of IFunctionTree
  • changed interfaces IFunction and IFunctionTree
  • moved some files to new directories (general housekeeping)
  • changed all GP operators and engines to work with IGeneticProgrammingModels
  • removed parameters TreeSize and TreeHeight in all GP operators
  • changed parameter OperatorLibrary to FunctionLibrary in all GP operators
Location:
branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/GPEvaluatorBase.cs

    r2130 r2210  
    2828using HeuristicLab.Operators;
    2929using HeuristicLab.DataAnalysis;
     30using HeuristicLab.GP.Interfaces;
    3031
    3132namespace HeuristicLab.GP.StructureIdentification {
     
    3435      : base() {
    3536      AddVariableInfo(new VariableInfo("TreeEvaluator", "The evaluator that should be used to evaluate the expression tree", typeof(ITreeEvaluator), VariableKind.In));
    36       AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IFunctionTree), VariableKind.In));
    37       AddVariableInfo(new VariableInfo("TreeSize", "Size (number of nodes) of the tree to evaluate", typeof(IntData), VariableKind.In));
     37      AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IGeneticProgrammingModel), VariableKind.In));
    3838      AddVariableInfo(new VariableInfo("Dataset", "Dataset with all samples on which to apply the function", typeof(Dataset), VariableKind.In));
    3939      AddVariableInfo(new VariableInfo("TargetVariable", "Index of the column of the dataset that holds the target variable", typeof(IntData), VariableKind.In));
     
    5151      int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;
    5252      Dataset dataset = GetVariableValue<Dataset>("Dataset", scope, true);
    53       IFunctionTree functionTree = GetVariableValue<IFunctionTree>("FunctionTree", scope, true);
     53      IGeneticProgrammingModel gpModel = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope, true);
    5454      double punishmentFactor = GetVariableValue<DoubleData>("PunishmentFactor", scope, true).Data;
    55       int treeSize = scope.GetVariableValue<IntData>("TreeSize", true).Data;
    5655      double totalEvaluatedNodes = scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data;
    5756      int trainingStart = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data;
     
    6160      bool useEstimatedValues = GetVariableValue<BoolData>("UseEstimatedTargetValue", scope, true).Data;
    6261      ITreeEvaluator evaluator = GetVariableValue<ITreeEvaluator>("TreeEvaluator", scope, true);
    63       evaluator.PrepareForEvaluation(dataset, targetVariable, trainingStart, trainingEnd, punishmentFactor, functionTree);
     62      evaluator.PrepareForEvaluation(dataset, targetVariable, trainingStart, trainingEnd, punishmentFactor, gpModel.FunctionTree);
    6463
    6564      double[] backupValues = null;
     
    8685
    8786      // update the value of total evaluated nodes
    88       scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data = totalEvaluatedNodes + treeSize * (end - start);
     87      scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data = totalEvaluatedNodes + gpModel.Size * (end - start);
    8988      return null;
    9089    }
  • branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/VariableEvaluationImpactCalculator.cs

    r2165 r2210  
    2828using HeuristicLab.DataAnalysis;
    2929using System.Linq;
     30using HeuristicLab.GP.Interfaces;
    3031
    3132namespace HeuristicLab.GP.StructureIdentification {
     
    3536      : base() {
    3637      AddVariableInfo(new VariableInfo("TreeEvaluator", "The evaluator that should be used to evaluate the expression tree", typeof(ITreeEvaluator), VariableKind.In));
    37       AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IFunctionTree), VariableKind.In));
     38      AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IGeneticProgrammingModel), VariableKind.In));
    3839      AddVariableInfo(new VariableInfo("TreeSize", "Size (number of nodes) of the tree to evaluate", typeof(IntData), VariableKind.In));
    3940      AddVariableInfo(new VariableInfo("PunishmentFactor", "Punishment factor for invalid estimations", typeof(DoubleData), VariableKind.In));
     
    4344    protected override double[] GetOutputs(IScope scope, Dataset dataset, int targetVariable, int start, int end) {
    4445      ITreeEvaluator evaluator = GetVariableValue<ITreeEvaluator>("TreeEvaluator", scope, true);
    45       IFunctionTree tree = GetVariableValue<IFunctionTree>("FunctionTree", scope, true);
     46      IGeneticProgrammingModel gpModel = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope, true);
    4647      double punishmentFactor = GetVariableValue<DoubleData>("PunishmentFactor", scope, true).Data;
    47       evaluator.PrepareForEvaluation(dataset, targetVariable, start, end, punishmentFactor, tree);
     48      evaluator.PrepareForEvaluation(dataset, targetVariable, start, end, punishmentFactor, gpModel.FunctionTree);
    4849
    4950      double[] result = new double[end - start];
  • branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/VariableQualityImpactCalculator.cs

    r2165 r2210  
    2828using HeuristicLab.DataAnalysis;
    2929using System.Linq;
     30using HeuristicLab.GP.Interfaces;
    3031
    3132namespace HeuristicLab.GP.StructureIdentification {
     
    3536      : base() {
    3637      AddVariableInfo(new VariableInfo("TreeEvaluator", "The evaluator that should be used to evaluate the expression tree", typeof(ITreeEvaluator), VariableKind.In));
    37       AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IFunctionTree), VariableKind.In));
     38      AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IGeneticProgrammingModel), VariableKind.In));
    3839      AddVariableInfo(new VariableInfo("TreeSize", "Size (number of nodes) of the tree to evaluate", typeof(IntData), VariableKind.In));
    3940      AddVariableInfo(new VariableInfo("PunishmentFactor", "Punishment factor for invalid estimations", typeof(DoubleData), VariableKind.In));
     
    4243    protected override double CalculateQuality(IScope scope, Dataset dataset, int targetVariable, int start, int end) {
    4344      ITreeEvaluator evaluator = GetVariableValue<ITreeEvaluator>("TreeEvaluator", scope, true);
    44       IFunctionTree tree = GetVariableValue<IFunctionTree>("FunctionTree", scope, true);
     45      IGeneticProgrammingModel gpModel = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope, true);
    4546      double punishmentFactor = GetVariableValue<DoubleData>("PunishmentFactor", scope, true).Data;
    46       evaluator.PrepareForEvaluation(dataset, targetVariable, start, end, punishmentFactor, tree);
     47      evaluator.PrepareForEvaluation(dataset, targetVariable, start, end, punishmentFactor, gpModel.FunctionTree);
    4748
    4849      double[,] result = new double[end - start, 2];
Note: See TracChangeset for help on using the changeset viewer.