- Timestamp:
- 10/15/21 17:00:28 (3 years ago)
- Location:
- branches/3136_Structural_GP
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/StructuredSymbolicRegressionSingleObjectiveProblem.cs
r18067 r18068 22 22 private const string ProblemDataParameterName = "ProblemData"; 23 23 private const string StructureDefinitionParameterName = "Structure Definition"; 24 private const string GrammarParameterName = "Grammar";25 24 private const string StructureTemplateParameterName = "Structure Template"; 26 25 #endregion … … 30 29 public IFixedValueParameter<StringValue> StructureDefinitionParameter => (IFixedValueParameter<StringValue>)Parameters[StructureDefinitionParameterName]; 31 30 public IFixedValueParameter<StructureTemplate> StructureTemplateParameter => (IFixedValueParameter<StructureTemplate>)Parameters[StructureTemplateParameterName]; 32 public IValueParameter<ISymbolicDataAnalysisGrammar> GrammarParameter => (IValueParameter<ISymbolicDataAnalysisGrammar>)Parameters[GrammarParameterName];33 31 #endregion 34 32 … … 51 49 } 52 50 53 public ISymbolicDataAnalysisGrammar Grammar {54 get => GrammarParameter.Value;55 set => GrammarParameter.Value = value;56 }57 58 51 IParameter IDataAnalysisProblem.ProblemDataParameter => ProblemDataParameter; 59 52 IDataAnalysisProblemData IDataAnalysisProblem.ProblemData => ProblemData; … … 69 62 public StructuredSymbolicRegressionSingleObjectiveProblem() { 70 63 var problemData = new ShapeConstrainedRegressionProblemData(); 71 var grammar = new LinearScalingGrammar();72 var varSym = (Variable)grammar.GetSymbol("Variable");73 varSym.AllVariableNames = problemData.InputVariables.Select(x => x.Value);74 varSym.VariableNames = problemData.InputVariables.Select(x => x.Value);75 varSym.Enabled = true;76 64 77 65 var structureTemplate = new StructureTemplate(); … … 80 68 Parameters.Add(new ValueParameter<IRegressionProblemData>(ProblemDataParameterName, problemData)); 81 69 Parameters.Add(new FixedValueParameter<StructureTemplate>(StructureTemplateParameterName, structureTemplate)); 82 Parameters.Add(new ValueParameter<ISymbolicDataAnalysisGrammar>(GrammarParameterName, grammar));83 70 84 //structureTemplate.Template = "f(x)*f(y)+5";85 71 } 86 72 … … 97 83 98 84 private void OnTemplateChanged(object sender, EventArgs args) { 85 SetupStructureTemplate(); 86 } 87 88 private void SetupStructureTemplate() { 99 89 foreach (var e in Encoding.Encodings.ToArray()) 100 90 Encoding.Remove(e); 101 91 102 foreach (var sf in StructureTemplate.SubFunctions.Values) { 103 Encoding.Add(new SymbolicExpressionTreeEncoding(sf.Name, sf.Grammar, sf.MaximumSymbolicExpressionTreeLength, sf.MaximumSymbolicExpressionTreeDepth)); 92 foreach (var f in StructureTemplate.SubFunctions.Values) { 93 SetupVariables(f); 94 if(!Encoding.Encodings.Any(x => x.Name == f.Name)) // to prevent the same encoding twice 95 Encoding.Add(new SymbolicExpressionTreeEncoding(f.Name, f.Grammar, f.MaximumSymbolicExpressionTreeLength, f.MaximumSymbolicExpressionTreeDepth)); 104 96 } 105 97 } … … 122 114 else 123 115 results.Add(new Result("Best Tree", BuildTree(individuals[bestIdx]))); 124 125 /*126 if (results.TryGetValue("Tree", out IResult result)) {127 var list = result.Value as ItemList<ISymbolicExpressionTree>;128 list.Clear();129 list.AddRange(individuals.Select(x => (BuildTree(x))));130 } else131 results.Add(new Result("Tree", new ItemList<ISymbolicExpressionTree>(individuals.Select(x => (BuildTree(x))))));132 */133 116 } 134 117 … … 152 135 if (n.Symbol is SubFunctionSymbol) { 153 136 var subFunctionTreeNode = n as SubFunctionTreeNode; 154 var subFunctionTree = individual.SymbolicExpressionTree(subFunctionTreeNode. SubFunction.Name);137 var subFunctionTree = individual.SymbolicExpressionTree(subFunctionTreeNode.Name); 155 138 var parent = n.Parent; 156 139 … … 167 150 } 168 151 152 private void SetupVariables(SubFunction subFunction) { 153 var varSym = (Variable)subFunction.Grammar.GetSymbol("Variable"); 154 if (varSym == null) { 155 varSym = new Variable(); 156 subFunction.Grammar.AddSymbol(varSym); 157 } 158 159 var allVariables = ProblemData.InputVariables.Select(x => x.Value); 160 var allInputs = allVariables.Where(x => x != ProblemData.TargetVariable); 161 162 // set all variables 163 varSym.AllVariableNames = allVariables; 164 165 // set all allowed variables 166 if (subFunction.Arguments.Contains("_")) { 167 varSym.VariableNames = allInputs; 168 } else { 169 var vars = new List<string>(); 170 var exceptions = new List<Exception>(); 171 foreach (var arg in subFunction.Arguments) { 172 if (allInputs.Contains(arg)) 173 vars.Add(arg); 174 else 175 exceptions.Add(new ArgumentException($"The argument '{arg}' for sub-function '{subFunction.Name}' is not a valid variable.")); 176 } 177 if (exceptions.Any()) 178 throw new AggregateException(exceptions); 179 varSym.VariableNames = vars; 180 } 181 182 varSym.Enabled = true; 183 } 184 169 185 public void Load(RegressionProblemData data) { 170 186 ProblemData = data; 187 SetupStructureTemplate(); 171 188 } 172 189 } -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/StructureTemplate/StructureTemplateView.Designer.cs
r18067 r18068 30 30 this.expressionInput = new System.Windows.Forms.TextBox(); 31 31 this.parseButton = new System.Windows.Forms.Button(); 32 this.errorLabel = new System.Windows.Forms.Label(); 33 this.symRegTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.GraphicalSymbolicExpressionTreeView(); 32 this.infoLabel = new System.Windows.Forms.Label(); 34 33 this.templateStructureGroupBox = new System.Windows.Forms.GroupBox(); 35 34 this.treeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart(); 36 35 this.splitContainer = new System.Windows.Forms.SplitContainer(); 36 this.detailsGroupBox = new System.Windows.Forms.GroupBox(); 37 37 this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 38 38 this.templateStructureGroupBox.SuspendLayout(); … … 41 41 this.splitContainer.Panel2.SuspendLayout(); 42 42 this.splitContainer.SuspendLayout(); 43 this.detailsGroupBox.SuspendLayout(); 43 44 this.SuspendLayout(); 44 45 // … … 51 52 this.expressionInput.Size = new System.Drawing.Size(288, 20); 52 53 this.expressionInput.TabIndex = 1; 53 this.expressionInput.TextChanged += new System.EventHandler(this. expressionInput_TextChanged);54 this.expressionInput.TextChanged += new System.EventHandler(this.ExpressionInputTextChanged); 54 55 // 55 56 // parseButton … … 61 62 this.parseButton.Text = "Parse"; 62 63 this.parseButton.UseVisualStyleBackColor = true; 63 this.parseButton.Click += new System.EventHandler(this. parseButton_Click);64 this.parseButton.Click += new System.EventHandler(this.ParseButtonClick); 64 65 // 65 66 // errorLabel 66 67 // 67 this.errorLabel.AutoSize = true; 68 this.errorLabel.Location = new System.Drawing.Point(155, 50); 69 this.errorLabel.Name = "errorLabel"; 70 this.errorLabel.Size = new System.Drawing.Size(54, 13); 71 this.errorLabel.TabIndex = 4; 72 this.errorLabel.Text = "errorLabel"; 73 // 74 // symRegTreeChart 75 // 76 this.symRegTreeChart.AllowDrop = true; 77 this.symRegTreeChart.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 78 | System.Windows.Forms.AnchorStyles.Right))); 79 this.symRegTreeChart.Caption = "Graphical SymbolicExpressionTree View"; 80 this.symRegTreeChart.Content = null; 81 this.symRegTreeChart.Location = new System.Drawing.Point(6, 74); 82 this.symRegTreeChart.Name = "symRegTreeChart"; 83 this.symRegTreeChart.ReadOnly = false; 84 this.symRegTreeChart.Size = new System.Drawing.Size(288, 153); 85 this.symRegTreeChart.TabIndex = 6; 68 this.infoLabel.AutoSize = true; 69 this.infoLabel.Location = new System.Drawing.Point(155, 50); 70 this.infoLabel.Name = "errorLabel"; 71 this.infoLabel.Size = new System.Drawing.Size(54, 13); 72 this.infoLabel.TabIndex = 4; 73 this.infoLabel.Text = "errorLabel"; 86 74 // 87 75 // templateStructureGroupBox 88 76 // 89 77 this.templateStructureGroupBox.Controls.Add(this.treeChart); 90 this.templateStructureGroupBox.Controls.Add(this.symRegTreeChart);91 78 this.templateStructureGroupBox.Controls.Add(this.parseButton); 92 this.templateStructureGroupBox.Controls.Add(this. errorLabel);79 this.templateStructureGroupBox.Controls.Add(this.infoLabel); 93 80 this.templateStructureGroupBox.Controls.Add(this.expressionInput); 94 81 this.templateStructureGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; … … 102 89 // treeChart 103 90 // 104 this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 91 this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 92 | System.Windows.Forms.AnchorStyles.Left) 105 93 | System.Windows.Forms.AnchorStyles.Right))); 106 94 this.treeChart.BackgroundColor = System.Drawing.Color.White; 107 95 this.treeChart.LineColor = System.Drawing.Color.Black; 108 this.treeChart.Location = new System.Drawing.Point(6, 233);96 this.treeChart.Location = new System.Drawing.Point(6, 74); 109 97 this.treeChart.MinimumHorizontalDistance = 30; 110 98 this.treeChart.MinimumHorizontalPadding = 20; … … 114 102 this.treeChart.PreferredNodeHeight = 46; 115 103 this.treeChart.PreferredNodeWidth = 70; 116 this.treeChart.Size = new System.Drawing.Size(288, 150);104 this.treeChart.Size = new System.Drawing.Size(288, 320); 117 105 this.treeChart.SuspendRepaint = false; 118 106 this.treeChart.TabIndex = 7; … … 134 122 // splitContainer.Panel2 135 123 // 136 this.splitContainer.Panel2.Controls.Add(this. viewHost);124 this.splitContainer.Panel2.Controls.Add(this.detailsGroupBox); 137 125 this.splitContainer.Panel2MinSize = 5; 138 126 this.splitContainer.Size = new System.Drawing.Size(600, 400); 139 127 this.splitContainer.SplitterDistance = 300; 140 128 this.splitContainer.TabIndex = 10; 129 // 130 // detailsGroupBox 131 // 132 this.detailsGroupBox.Controls.Add(this.viewHost); 133 this.detailsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; 134 this.detailsGroupBox.Location = new System.Drawing.Point(0, 0); 135 this.detailsGroupBox.Name = "detailsGroupBox"; 136 this.detailsGroupBox.Size = new System.Drawing.Size(296, 400); 137 this.detailsGroupBox.TabIndex = 9; 138 this.detailsGroupBox.TabStop = false; 139 this.detailsGroupBox.Text = "Details"; 141 140 // 142 141 // viewHost … … 146 145 this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill; 147 146 this.viewHost.Enabled = false; 148 this.viewHost.Location = new System.Drawing.Point( 0, 0);147 this.viewHost.Location = new System.Drawing.Point(3, 16); 149 148 this.viewHost.Name = "viewHost"; 150 149 this.viewHost.ReadOnly = false; 151 this.viewHost.Size = new System.Drawing.Size(29 6, 400);150 this.viewHost.Size = new System.Drawing.Size(290, 381); 152 151 this.viewHost.TabIndex = 8; 153 152 this.viewHost.ViewsLabelVisible = true; … … 167 166 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); 168 167 this.splitContainer.ResumeLayout(false); 168 this.detailsGroupBox.ResumeLayout(false); 169 169 this.ResumeLayout(false); 170 170 … … 174 174 private System.Windows.Forms.TextBox expressionInput; 175 175 private System.Windows.Forms.Button parseButton; 176 private System.Windows.Forms.Label errorLabel; 177 private Encodings.SymbolicExpressionTreeEncoding.Views.GraphicalSymbolicExpressionTreeView symRegTreeChart; 176 private System.Windows.Forms.Label infoLabel; 178 177 private System.Windows.Forms.GroupBox templateStructureGroupBox; 179 178 private System.Windows.Forms.SplitContainer splitContainer; 180 179 private Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart treeChart; 181 180 private MainForm.WindowsForms.ViewHost viewHost; 181 private System.Windows.Forms.GroupBox detailsGroupBox; 182 182 } 183 183 } -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/StructureTemplate/StructureTemplateView.cs
r18067 r18068 24 24 public StructureTemplateView() { 25 25 InitializeComponent(); 26 errorLabel.Text = ""; 27 treeChart.SymbolicExpressionTreeNodeClicked += TreeChart_SymbolicExpressionTreeNodeClicked; 26 infoLabel.Text = ""; 27 treeChart.SymbolicExpressionTreeNodeClicked += SymbolicExpressionTreeNodeClicked; 28 28 29 } 29 30 30 private void TreeChart_SymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) {31 private void SymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) { 31 32 var visualTreeNode = sender as VisualTreeNode<ISymbolicExpressionTreeNode>; 32 33 if(visualTreeNode != null) { 33 34 var subFunctionTreeNode = visualTreeNode.Content as SubFunctionTreeNode; 34 viewHost.Content = subFunctionTreeNode?.SubFunction; 35 if(Content.SubFunctions.TryGetValue(subFunctionTreeNode.Name, out SubFunction subFunction)) 36 viewHost.Content = subFunction; 35 37 } 36 38 } … … 39 41 base.OnContentChanged(); 40 42 if (Content == null) return; 41 42 43 expressionInput.Text = Content.Template; 43 symRegTreeChart.Content = Content.Tree; 44 45 treeChart.Tree = Content.Tree; 46 47 errorLabel.Text = ""; 48 44 PaintTree(); 45 infoLabel.Text = ""; 49 46 } 50 47 51 private void parseButton_Click(object sender, EventArgs e) {48 private void ParseButtonClick(object sender, EventArgs e) { 52 49 if(!string.IsNullOrEmpty(expressionInput.Text)) { 53 50 try { 54 51 Content.Template = expressionInput.Text; 55 symRegTreeChart.Content = Content.Tree; 56 treeChart.Tree = Content.Tree; 57 58 errorLabel.Text = "Template structure successfully parsed."; 59 errorLabel.ForeColor = Color.DarkGreen; 52 PaintTree(); 53 infoLabel.Text = "Template structure successfully parsed."; 54 infoLabel.ForeColor = Color.DarkGreen; 60 55 } catch (Exception ex) { 61 errorLabel.Text = ex.Message;62 errorLabel.ForeColor = Color.DarkRed;56 infoLabel.Text = ex.Message; 57 infoLabel.ForeColor = Color.DarkRed; 63 58 } 64 59 } 65 60 } 66 61 67 private void expressionInput_TextChanged(object sender, EventArgs e) {68 errorLabel.Text = "Unparsed changes! Press parse button to save changes.";69 errorLabel.ForeColor = Color.DarkOrange;62 private void ExpressionInputTextChanged(object sender, EventArgs e) { 63 infoLabel.Text = "Unparsed changes! Press parse button to save changes."; 64 infoLabel.ForeColor = Color.DarkOrange; 70 65 } 71 66 67 68 private void PaintTree() { 69 if(Content != null && Content.Tree != null) { 70 treeChart.Tree = Content.Tree; 71 foreach (var n in Content.Tree.IterateNodesPrefix()) { 72 if (n.Symbol is SubFunctionSymbol) { 73 var visualNode = treeChart.GetVisualSymbolicExpressionTreeNode(n); 74 visualNode.FillColor = Color.LightCyan; 75 visualNode.LineColor = Color.SlateGray; 76 } 77 } 78 treeChart.RepaintNodes(); 79 } 80 } 72 81 } 73 82 } -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/StructureTemplate/StructureTemplate.cs
r18067 r18068 1 1 using System; 2 using System.Linq; 2 3 using System.Collections.Generic; 3 4 using HeuristicLab.Core; … … 17 18 get => template; 18 19 set { 19 if(template != value) { 20 template = value; 21 tree = Parser.Parse(template); 22 GetSubFunctions(Tree); 23 OnChanged(); 24 } 20 template = value; 21 tree = Parser.Parse(template); 22 GetSubFunctions(Tree); 23 OnChanged(); 25 24 } 26 25 } … … 31 30 32 31 [Storable] 33 public I Dictionary<SubFunctionTreeNode, SubFunction> SubFunctions { get; private set; } = new Dictionary<SubFunctionTreeNode, SubFunction>();32 public IReadOnlyDictionary<string, SubFunction> SubFunctions { get; private set; } = new Dictionary<string, SubFunction>(); 34 33 35 34 protected InfixExpressionParser Parser { get; set; } = new InfixExpressionParser(); 35 36 36 #endregion 37 37 … … 57 57 58 58 private void GetSubFunctions(ISymbolicExpressionTree tree) { 59 int count = 1; 60 SubFunctions.Clear(); 59 var subFunctions = new Dictionary<string, SubFunction>(); 61 60 foreach (var node in tree.IterateNodesPrefix()) 62 if (node is SubFunctionTreeNode subFunctionTreeNode) { 63 var subFunction = new SubFunction() { 64 Name = $"f{count++}({string.Join(",", subFunctionTreeNode.Arguments)})", 65 FunctionArguments = subFunctionTreeNode.Arguments 66 }; 67 subFunctionTreeNode.SubFunction = subFunction; 68 SubFunctions.Add(subFunctionTreeNode, subFunction); 61 if (node is SubFunctionTreeNode subFunctionTreeNode) { 62 if (!subFunctionTreeNode.Arguments.Any()) 63 throw new ArgumentException($"The sub-function '{subFunctionTreeNode}' requires inputs (e.g. {subFunctionTreeNode.Name}(var1, var2))."); 64 65 if (subFunctions.TryGetValue(subFunctionTreeNode.Name, out SubFunction v)) { 66 if(!v.Arguments.SequenceEqual(subFunctionTreeNode.Arguments)) 67 throw new ArgumentException( 68 $"The sub-function '{v.Name}' has (at least two) different signatures " + 69 $"({v.Name}({string.Join(",", v.Arguments)}) <> {subFunctionTreeNode.Name}({string.Join(",", subFunctionTreeNode.Arguments)}))."); 70 } else { 71 var subFunction = new SubFunction() { 72 Name = subFunctionTreeNode.Name, 73 Arguments = subFunctionTreeNode.Arguments 74 }; 75 subFunction.Changed += OnSubFunctionChanged; 76 subFunctions.Add(subFunction.Name, subFunction); 77 } 69 78 } 79 SubFunctions = subFunctions; 70 80 } 81 82 private void OnSubFunctionChanged(object sender, EventArgs e) => OnChanged(); 71 83 } 72 84 } -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/StructureTemplate/SubFunction.cs
r18067 r18068 18 18 private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth"; 19 19 private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength"; 20 private const string FunctionArgumentsParameterName = "Function Arguments";21 20 #endregion 22 21 … … 25 24 public IFixedValueParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter => (IFixedValueParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; 26 25 public IFixedValueParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter => (IFixedValueParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; 27 public IValueParameter<ReadOnlyItemList<StringValue>> FunctionArgumentsParameter => (IValueParameter<ReadOnlyItemList<StringValue>>)Parameters[FunctionArgumentsParameterName];28 26 #endregion 29 27 … … 44 42 } 45 43 46 public IEnumerable<string> FunctionArguments { // TODO: gehört weg 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."); 44 public IEnumerable<string> Arguments { get; set; } 45 #endregion 52 46 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 } 47 #region Events 48 public event EventHandler Changed; 60 49 #endregion 61 50 … … 65 54 Parameters.Add(new FixedValueParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, new IntValue(10))); 66 55 Parameters.Add(new FixedValueParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, new IntValue(30))); 67 Parameters.Add(new ValueParameter<ReadOnlyItemList<StringValue>>(FunctionArgumentsParameterName, new ReadOnlyItemList<StringValue>())); 56 57 // TODO: separate events for each parameter 58 GrammarParameter.ValueChanged += OnParameterValueChanged; 59 MaximumSymbolicExpressionTreeDepthParameter.Value.ValueChanged += OnParameterValueChanged; 60 MaximumSymbolicExpressionTreeLengthParameter.Value.ValueChanged += OnParameterValueChanged; 68 61 } 62 63 private void OnParameterValueChanged(object sender, EventArgs e) => Changed?.Invoke(this, EventArgs.Empty); 69 64 70 65 protected SubFunction(SubFunction original, Cloner cloner) { } -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SubFunctionSymbol.cs
r18065 r18068 9 9 [Item("SubFunctionSymbol", "Symbol that represents a sub function.")] 10 10 public class SubFunctionSymbol : Symbol { 11 public override int MinimumArity => 1;12 public override int MaximumArity => byte.MaxValue;11 public override int MinimumArity => 0; 12 public override int MaximumArity => 1; 13 13 14 14 public SubFunctionSymbol() : base("SubFunctionSymbol", "Symbol that represents a sub function.") { } -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SubFunctionTreeNode.cs
r18067 r18068 10 10 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 11 11 [StorableType("05130B5F-0125-4367-A4E9-C42D1085024E")] 12 public class SubFunctionTreeNode : SymbolicExpressionTreeNode { //TODO: as TerminalNode? -> but has children in a fully builded tree12 public class SubFunctionTreeNode : SymbolicExpressionTreeNode { 13 13 14 14 #region Properties … … 17 17 public IEnumerable<string> Arguments { get; set; } = Enumerable.Empty<string>(); 18 18 19 public SubFunction SubFunction { get; set; }20 21 19 public string Name { get; set; } 22 20 #endregion … … 28 26 protected SubFunctionTreeNode(StorableConstructorFlag _) : base(_) { } 29 27 30 protected SubFunctionTreeNode(SubFunctionTreeNode original, Cloner cloner) : base(original, cloner) { 31 this.SubFunction = original.SubFunction; 32 } 28 protected SubFunctionTreeNode(SubFunctionTreeNode original, Cloner cloner) : base(original, cloner) { } 33 29 #endregion 34 30 … … 40 36 if (string.IsNullOrEmpty(Name)) 41 37 return base.ToString(); 42 return Name;38 return $"{Name}({string.Join(",", Arguments)})"; 43 39 } 44 40
Note: See TracChangeset
for help on using the changeset viewer.