Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/05/21 17:16:22 (3 years ago)
Author:
dpiringe
Message:

#3136

  • added view components and classes for sub functions
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/StructuredSymbolicRegressionSingleObjectiveProblem.cs

    r18062 r18063  
    1313using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    1414
    15 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.SingleObjective {
     15namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
    1616  [StorableType("7464E84B-65CC-440A-91F0-9FA920D730F9")]
    17   [Item(Name = "StructuredSymbolicRegressionSingleObjectiveProblem", Description = "A problem with a structural definition and unfixed subfunctions.")]
     17  [Item(Name = "Structured Symbolic Regression Single Objective Problem (single-objective)", Description = "A problem with a structural definition and unfixed subfunctions.")]
     18  [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 150)]
    1819  public class StructuredSymbolicRegressionSingleObjectiveProblem : SingleObjectiveBasicProblem<MultiEncoding>, IRegressionProblem, IProblemInstanceConsumer<RegressionProblemData> {
    1920
     
    2223    private const string StructureDefinitionParameterName = "Structure Definition";
    2324    private const string GrammarParameterName = "Grammar";
     25    private const string StructureTemplateParameterName = "Structure Template";
    2426
    2527    #endregion
     
    2830    public IValueParameter<IRegressionProblemData> ProblemDataParameter => (IValueParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName];
    2931    public IFixedValueParameter<StringValue> StructureDefinitionParameter => (IFixedValueParameter<StringValue>)Parameters[StructureDefinitionParameterName];
     32    public IFixedValueParameter<StructureTemplate> StructureTemplateParameter => (IFixedValueParameter<StructureTemplate>)Parameters[StructureTemplateParameterName];
    3033    public IValueParameter<ISymbolicDataAnalysisGrammar> GrammarParameter => (IValueParameter<ISymbolicDataAnalysisGrammar>)Parameters[GrammarParameterName]; // könnte auch weg?
    3134    #endregion
     
    4346      get => StructureDefinitionParameter.Value.Value;
    4447      set => StructureDefinitionParameter.Value.Value = value;
     48    }
     49
     50    public StructureTemplate StructureTemplate {
     51      get => StructureTemplateParameter.Value;
    4552    }
    4653
     
    7178      Parameters.Add(new ValueParameter<RegressionProblemData>(ProblemDataParameterName, problemData));
    7279      Parameters.Add(new FixedValueParameter<StringValue>(StructureDefinitionParameterName, new StringValue("e^f(x)/F(y)")));
     80      Parameters.Add(new FixedValueParameter<StructureTemplate>(StructureTemplateParameterName, new StructureTemplate()));
    7381      Parameters.Add(new ValueParameter<ISymbolicDataAnalysisGrammar>(GrammarParameterName, grammar));
    7482      var parser = new InfixExpressionParser();
     
    7886    }
    7987
    80     public StructuredSymbolicRegressionSingleObjectiveProblem(StructuredSymbolicRegressionSingleObjectiveProblem original, Cloner cloner) {
    81     }
     88    public StructuredSymbolicRegressionSingleObjectiveProblem(StructuredSymbolicRegressionSingleObjectiveProblem original, Cloner cloner) { }
    8289
    8390    [StorableConstructor]
    84     protected StructuredSymbolicRegressionSingleObjectiveProblem(StorableConstructorFlag _) : base(_) {
    85     }
     91    protected StructuredSymbolicRegressionSingleObjectiveProblem(StorableConstructorFlag _) : base(_) { }
    8692
    8793    public override IDeepCloneable Clone(Cloner cloner) =>
     
    97103
    98104    public override double Evaluate(Individual individual, IRandom random) {
    99       foreach(var kvp in individual.Values) {
     105      Console.WriteLine(StructureTemplate.Template);
     106      foreach (var kvp in individual.Values) {
    100107        if(kvp.Value is SymbolicExpressionTree tree) {
    101108          foreach(var n in tree.IterateNodesPrefix()) {
Note: See TracChangeset for help on using the changeset viewer.