Changeset 18065 for branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/StructureTemplate/SubFunction.cs
- Timestamp:
- 10/08/21 16:28:53 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/StructureTemplate/SubFunction.cs
r18063 r18065 18 18 private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth"; 19 19 private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength"; 20 private const string FunctionArgumentsParameterName = "Function Arguments"; 20 21 #endregion 21 22 … … 24 25 public IFixedValueParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter => (IFixedValueParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; 25 26 public IFixedValueParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter => (IFixedValueParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; 27 public IValueParameter<ReadOnlyItemList<StringValue>> FunctionArgumentsParameter => (IValueParameter<ReadOnlyItemList<StringValue>>)Parameters[FunctionArgumentsParameterName]; 26 28 #endregion 27 29 … … 41 43 set => MaximumSymbolicExpressionTreeLengthParameter.Value.Value = value; 42 44 } 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 } 43 60 #endregion 44 61 … … 48 65 Parameters.Add(new FixedValueParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, new IntValue(10))); 49 66 Parameters.Add(new FixedValueParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, new IntValue(30))); 67 Parameters.Add(new ValueParameter<ReadOnlyItemList<StringValue>>(FunctionArgumentsParameterName, new ReadOnlyItemList<StringValue>())); 50 68 } 51 69
Note: See TracChangeset
for help on using the changeset viewer.