Changeset 18157
- Timestamp:
- 12/17/21 16:59:18 (3 years ago)
- Location:
- branches/3136_Structural_GP
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs
r18146 r18157 54 54 55 55 var power = node.GetSubtree(1); 56 if (power is INumericTreeNode numNode && Math.Truncate(numNode.Value) == numNode.Value) {56 if (power is INumericTreeNode numNode && Math.Truncate(numNode.Value) == numNode.Value) { 57 57 strBuilder.Append(" ").Append(token).Append(" ").Append(numNode.Value.ToString(formatString, numberFormat)); 58 58 } else { … … 73 73 strBuilder.Append(")"); 74 74 } 75 } else if (node.Symbol is SubFunctionSymbol) { 76 FormatRecursively(node.GetSubtree(0), strBuilder, numberFormat, formatString, parameters); 75 77 } else if (node.SubtreeCount == 1) { 76 78 var token = GetToken(node.Symbol); … … 145 147 // negative value 146 148 strBuilder.Append("(").Append(numNode.Value.ToString(formatString, numberFormat)) 147 .Append(")"); 149 .Append(")"); 148 150 } else { 149 151 AppendNumber(strBuilder, parameters, numNode.Value, formatString, numberFormat); -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionCSharpFormatter.cs
r18146 r18157 155 155 FormatRecursively(node.GetSubtree(1), strBuilder); 156 156 strBuilder.Append(" , 2) ) )"); 157 } else if (node.Symbol is SubFunctionSymbol) { 158 FormatRecursively(node.GetSubtree(0), strBuilder); 157 159 } else { 158 160 throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " not supported for C# symbolic expression tree formatter."); -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionExcelFormatter.cs
r18146 r18157 310 310 stringBuilder.Append(FormatRecursively(node.GetSubtree(1))); 311 311 stringBuilder.Append("), 1.0, -1.0)"); 312 } else if (symbol is SubFunctionSymbol) { 313 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 312 314 } else { 313 315 throw new NotImplementedException("Excel export of " + node.Symbol + " is not implemented."); -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs
r18146 r18157 279 279 paramIdx++; 280 280 strBuilder.Append(@" \left( " + p + @"\cdot "); 281 } else if (node.Symbol is SubFunctionSymbol) { 282 // to nothing, skip symbol 281 283 } else { 282 284 throw new NotImplementedException("Export of " + node.Symbol + " is not implemented."); … … 387 389 paramIdx++; 388 390 strBuilder.Append(@" + \left( 1 - " + p + @" \right) \cdot "); 391 } else if (node.Symbol is SubFunctionSymbol) { 392 throw new InvalidOperationException(); 389 393 } else { 390 394 throw new NotImplementedException("Export of " + node.Symbol + " is not implemented."); … … 511 515 } else if (node.Symbol is VariableCondition) { 512 516 strBuilder.Append(@"\right) "); 517 } else if (node.Symbol is SubFunctionSymbol) { 513 518 } else { 514 519 throw new NotImplementedException("Export of " + node.Symbol + " is not implemented."); -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs
r18146 r18157 388 388 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 389 389 currentLag -= laggedNode.Lag; 390 } else if (symbol is SubFunctionSymbol) { 391 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 390 392 } else { 391 393 stringBuilder.Append("ERROR"); -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMathematicaFormatter.cs
r18146 r18157 122 122 } else if (node.Symbol is Root) { 123 123 FormatRoot(node, strBuilder); 124 } else if (node.Symbol is SubFunctionSymbol) { 125 FormatRecursively(node.GetSubtree(0), strBuilder); 124 126 } else { 125 127 throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " is not supported."); -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionPythonFormatter.cs
r18146 r18157 204 204 else if (node is INumericTreeNode) 205 205 FormatNumericTreeNode(node, strBuilder); 206 else if (symbol is SubFunctionSymbol) 207 FormatRecursively(node.GetSubtree(0), strBuilder); 206 208 else 207 209 throw new NotSupportedException("Formatting of symbol: " + symbol + " not supported for Python symbolic expression tree formatter."); -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionSmalltalkFormatter.cs
r18146 r18157 184 184 } else if (symbol is BinaryFactorVariable || symbol is FactorVariable) { 185 185 stringBuilder.Append("factor variables are not supported"); 186 } else if (symbol is SubFunctionSymbol) { 187 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 186 188 } else { 187 189 stringBuilder.Append("("); -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/TSQLExpressionFormatter.cs
r18146 r18157 157 157 } else if (node.Symbol is Root) { 158 158 FormatRoot(level, node, strBuilder); 159 } else if (node.Symbol is SubFunctionSymbol) { 160 FormatRecursively(level, node.GetSubtree(0), strBuilder); 159 161 } else { 160 162 throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " not supported for TSQL symbolic expression tree formatter."); -
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/InfixExpressionParser.cs
r18146 r18157 139 139 { "XOR", new Xor()}, 140 140 { "DIFF", new Derivative()}, 141 { "LAG", new LaggedVariable() }/*, 142 { "F", new SubFunctionSymbol() }*/ 141 { "LAG", new LaggedVariable() } 143 142 }; 144 143 -
branches/3136_Structural_GP/HeuristicLab.Problems.ExternalEvaluation.GP/3.5/ExternalEvaluationSymbolicExpressionTreeStringFormatter.cs
r18146 r18157 58 58 StringBuilder strBuilder = new StringBuilder(); 59 59 if (Indent) strBuilder.Append(' ', indentLength); 60 if (node.Subtrees.Any()) { // internal node 60 if(node.Symbol is SubFunctionSymbol) { 61 return FormatRecursively(node.GetSubtree(0), indentLength); 62 } else if (node.Subtrees.Any()) { // internal node 61 63 strBuilder.Append("("); 62 64 if (node.Symbol is Addition) {
Note: See TracChangeset
for help on using the changeset viewer.