Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2362


Ignore:
Timestamp:
09/15/09 18:16:05 (15 years ago)
Author:
gkronber
Message:

Fixed #741 (EvaluatedSolutions counter and current selection pressure is stored incorrectly in models generated by GP algorithms).

Location:
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/DefaultStructureIdentificationOperators.cs

    r2356 r2362  
    7171      solutionStorer.GetVariableInfo("BestSolution").ActualName = "BestValidationSolution";
    7272      solutionStorer.GetVariableInfo("Quality").ActualName = "ValidationQuality";
     73
     74      OperatorExtractor bestSolutionProcessor = new OperatorExtractor();
     75      bestSolutionProcessor.Name = "BestSolutionProcessor (extr.)";
     76      bestSolutionProcessor.GetVariableInfo("Operator").ActualName = "BestSolutionProcessor";
     77
     78      solutionStorer.AddSubOperator(bestSolutionProcessor);
    7379
    7480      BestAverageWorstQualityCalculator validationQualityCalculator = new BestAverageWorstQualityCalculator();
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/OffspringSelectionGPRegression.cs

    r2361 r2362  
    3131using HeuristicLab.Modeling;
    3232using HeuristicLab.DataAnalysis;
     33using HeuristicLab.Operators.Programmable;
    3334
    3435namespace HeuristicLab.GP.StructureIdentification {
     
    9495
    9596    protected override IOperator CreateGenerationStepHook() {
    96       return DefaultStructureIdentificationOperators.CreateGenerationStepHook();
     97      IOperator hook = DefaultStructureIdentificationOperators.CreateGenerationStepHook();
     98      hook.AddSubOperator(CreateBestSolutionProcessor());
     99      return hook;
     100    }
     101
     102    private IOperator CreateBestSolutionProcessor() {
     103      CombinedOperator op = new CombinedOperator();
     104      op.Name = "BestSolutionProcessor";
     105      SequentialProcessor seq = new SequentialProcessor();
     106
     107      ProgrammableOperator variableStorer = new ProgrammableOperator();
     108      variableStorer.RemoveVariableInfo("Result");
     109      variableStorer.AddVariableInfo(new VariableInfo("Input", "Value to copy", typeof(ObjectData), VariableKind.In));
     110      variableStorer.AddVariableInfo(new VariableInfo("Output", "Value to write", typeof(ObjectData), VariableKind.Out));
     111      variableStorer.Code = "scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName(\"Output\"), (ObjectData)Input.Clone()));";
     112
     113      IOperator evaluatedSolutionsStorer = (IOperator)variableStorer.Clone();
     114      evaluatedSolutionsStorer.GetVariableInfo("Input").ActualName = "EvaluatedSolutions";
     115      evaluatedSolutionsStorer.GetVariableInfo("Output").ActualName = "EvaluatedSolutions";
     116
     117      IOperator selectionPressureStorer = (IOperator)variableStorer.Clone();
     118      selectionPressureStorer.GetVariableInfo("Input").ActualName = "SelectionPressure";
     119      selectionPressureStorer.GetVariableInfo("Output").ActualName = "SelectionPressure";
     120
     121      seq.AddSubOperator(evaluatedSolutionsStorer);
     122      seq.AddSubOperator(selectionPressureStorer);
     123
     124      op.OperatorGraph.AddOperator(seq);
     125      op.OperatorGraph.InitialOperator = seq;
     126      return op;
    97127    }
    98128
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/StandardGPRegression.cs

    r2361 r2362  
    3030using System;
    3131using HeuristicLab.DataAnalysis;
     32using HeuristicLab.Operators.Programmable;
    3233
    3334namespace HeuristicLab.GP.StructureIdentification {
     
    149150    }
    150151
     152    private IOperator CreateBestSolutionProcessor() {
     153      CombinedOperator op = new CombinedOperator();
     154      op.Name = "BestSolutionProcessor";
     155      SequentialProcessor seq = new SequentialProcessor();
     156
     157      ProgrammableOperator evaluatedSolutionsStorer = new ProgrammableOperator();
     158      evaluatedSolutionsStorer.RemoveVariableInfo("Result");
     159      evaluatedSolutionsStorer.AddVariableInfo(new VariableInfo("Input", "Value to copy", typeof(IntData), VariableKind.In));
     160      evaluatedSolutionsStorer.AddVariableInfo(new VariableInfo("Output", "Value to write", typeof(IntData), VariableKind.New));
     161      evaluatedSolutionsStorer.GetVariableInfo("Input").ActualName = "EvaluatedSolutions";
     162      evaluatedSolutionsStorer.GetVariableInfo("Output").ActualName = "EvaluatedSolutions";
     163      evaluatedSolutionsStorer.Code = "Output.Data = Input.Data;";
     164
     165      seq.AddSubOperator(evaluatedSolutionsStorer);
     166
     167      op.OperatorGraph.AddOperator(seq);
     168      op.OperatorGraph.InitialOperator = seq;
     169      return op;
     170    }
     171
     172
    151173    protected virtual IOperator CreateModelAnalyzerOperator() {
    152174      return DefaultRegressionOperators.CreatePostProcessingOperator();
Note: See TracChangeset for help on using the changeset viewer.