Changeset 18063


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

#3136

  • added view components and classes for sub functions
Location:
branches/3136_Structural_GP
Files:
9 added
3 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()) {
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r18052 r18063  
    122122      <DependentUpon>InteractiveSymbolicExpressionTreeChart.cs</DependentUpon>
    123123    </Compile>
     124    <Compile Include="StructureTemplate\StructureTemplateView.cs">
     125      <SubType>UserControl</SubType>
     126    </Compile>
     127    <Compile Include="StructureTemplate\StructureTemplateView.Designer.cs">
     128      <DependentUpon>StructureTemplateView.cs</DependentUpon>
     129    </Compile>
     130    <Compile Include="StructureTemplate\SubFunctionListView.cs">
     131      <SubType>UserControl</SubType>
     132    </Compile>
     133    <Compile Include="StructureTemplate\SubFunctionListView.Designer.cs">
     134      <DependentUpon>SubFunctionListView.cs</DependentUpon>
     135    </Compile>
    124136    <Compile Include="SymbolicDataAnalysisModelMathView.cs">
    125137      <SubType>UserControl</SubType>
     
    304316      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    305317    </Content>
     318  </ItemGroup>
     319  <ItemGroup>
     320    <EmbeddedResource Include="StructureTemplate\StructureTemplateView.resx">
     321      <DependentUpon>StructureTemplateView.cs</DependentUpon>
     322    </EmbeddedResource>
    306323  </ItemGroup>
    307324  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r18062 r18063  
    180180    <Compile Include="IntervalUtil.cs" />
    181181    <Compile Include="Selectors\DiversitySelector.cs" />
     182    <Compile Include="StructureTemplate\StructureTemplate.cs" />
     183    <Compile Include="StructureTemplate\SubFunction.cs" />
    182184    <Compile Include="SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator.cs" />
    183185    <Compile Include="SymbolicDataAnalysisExpressionTreeSimplificationOperator.cs" />
Note: See TracChangeset for help on using the changeset viewer.