Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/08/21 16:28:53 (3 years ago)
Author:
dpiringe
Message:

#3136

  • modified InfixExpressionParser to fully support SubFunctionSymbol
    • created a SubFunctionTreeNode to store the function arguments
  • modified StructureTemplateView to regenerate the content state
  • first implementation for the main tree build up logic
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/StructureTemplate/SubFunction.cs

    r18063 r18065  
    1818    private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
    1919    private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
     20    private const string FunctionArgumentsParameterName = "Function Arguments";
    2021    #endregion
    2122
     
    2425    public IFixedValueParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter => (IFixedValueParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName];
    2526    public IFixedValueParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter => (IFixedValueParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName];
     27    public IValueParameter<ReadOnlyItemList<StringValue>> FunctionArgumentsParameter => (IValueParameter<ReadOnlyItemList<StringValue>>)Parameters[FunctionArgumentsParameterName];
    2628    #endregion
    2729
     
    4143      set => MaximumSymbolicExpressionTreeLengthParameter.Value.Value = value;
    4244    }
     45
     46    public IEnumerable<string> FunctionArguments {
     47      get => FunctionArgumentsParameter.Value.Select(x => x.Value);
     48      set {
     49        var varSym = (Variable)Grammar.GetSymbol("Variable");
     50        if (varSym == null)
     51          throw new ArgumentException($"No variable symbol existent.");
     52
     53        FunctionArgumentsParameter.Value = new ItemList<StringValue>(value.Select(x => new StringValue(x))).AsReadOnly();
     54
     55        varSym.AllVariableNames = FunctionArguments;
     56        varSym.VariableNames = FunctionArguments;
     57        varSym.Enabled = true;
     58      }
     59    }
    4360    #endregion
    4461
     
    4865      Parameters.Add(new FixedValueParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, new IntValue(10)));
    4966      Parameters.Add(new FixedValueParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, new IntValue(30)));
     67      Parameters.Add(new ValueParameter<ReadOnlyItemList<StringValue>>(FunctionArgumentsParameterName, new ReadOnlyItemList<StringValue>()));
    5068    }
    5169
Note: See TracChangeset for help on using the changeset viewer.