Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16702 for trunk


Ignore:
Timestamp:
03/21/19 10:21:16 (6 years ago)
Author:
bburlacu
Message:

#2866: Add tanh to all formatters except the TSQLExpressionFormatter, since TSQL does not have a TANH function (could be approximated but ugly).

Location:
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionCSharpFormatter.cs

    r16565 r16702  
    2626using System.Text;
    2727using System.Text.RegularExpressions;
     28using HEAL.Attic;
    2829using HeuristicLab.Common;
    2930using HeuristicLab.Core;
    3031using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    31 using HEAL.Attic;
    3232
    3333namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    5656    }
    5757
    58     private string VariableName2Identifier(string name) {     
     58    private string VariableName2Identifier(string name) {
    5959      /*
    6060       * identifier-start-character:
     
    131131        } else if (node.Symbol is Tangent) {
    132132          FormatFunction(node, "Math.Tan", strBuilder);
     133        } else if (node.Symbol is HyperbolicTangent) {
     134          FormatFunction(node, "Math.Tanh", strBuilder);
    133135        } else if (node.Symbol is Square) {
    134136          FormatSquare(node, strBuilder);
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionExcelFormatter.cs

    r16565 r16702  
    2525using System.Linq;
    2626using System.Text;
     27using HEAL.Attic;
    2728using HeuristicLab.Common;
    2829using HeuristicLab.Core;
    2930using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    30 using HEAL.Attic;
    3131
    3232namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    192192        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
    193193        stringBuilder.Append(")");
    194 
     194      } else if (symbol is HyperbolicTangent) {
     195        stringBuilder.Append("TANH(");
     196        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
     197        stringBuilder.Append(")");
    195198      } else if (symbol is Variable) {
    196199        VariableTreeNode variableTreeNode = node as VariableTreeNode;
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs

    r16565 r16702  
    2424using System.Linq;
    2525using System.Text;
     26using HEAL.Attic;
    2627using HeuristicLab.Common;
    2728using HeuristicLab.Core;
    2829using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    29 using HEAL.Attic;
    3030
    3131namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    137137      } else if (node.Symbol is Tangent) {
    138138        strBuilder.Append(@"\tan \left( ");
     139      } else if (node.Symbol is HyperbolicTangent) {
     140        strBuilder.Append(@"\tanh \left( ");
    139141      } else if (node.Symbol is AiryA) {
    140142        strBuilder.Append(@"\operatorname{airy}_a \left( ");
     
    303305      } else if (node.Symbol is Tangent) {
    304306        throw new InvalidOperationException();
     307      } else if (node.Symbol is HyperbolicTangent) {
     308        throw new InvalidOperationException();
    305309      } else if (node.Symbol is AiryA) {
    306310        throw new InvalidOperationException();
     
    399403      } else if (node.Symbol is Tangent) {
    400404        strBuilder.Append(@" \right) ");
     405      } else if (node.Symbol is HyperbolicTangent) {
     406        strBuilder.Append(@" \right) ");
    401407      } else if (node.Symbol is AiryA) {
    402408        strBuilder.Append(@" \right) ");
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs

    r16565 r16702  
    2323using System.Linq;
    2424using System.Text;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    252252      } else if (symbol is Tangent) {
    253253        stringBuilder.Append("tan(");
     254        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
     255        stringBuilder.Append(")");
     256      } else if (symbol is HyperbolicTangent) {
     257        stringBuilder.Append("tanh(");
    254258        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
    255259        stringBuilder.Append(")");
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMathematicaFormatter.cs

    r16565 r16702  
    2424using System.Linq;
    2525using System.Text;
     26using HEAL.Attic;
    2627using HeuristicLab.Common;
    2728using HeuristicLab.Core;
    2829using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    29 using HEAL.Attic;
    3030
    3131namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    7070        } else if (node.Symbol is Tangent) {
    7171          FormatFunction(node, "Tan", strBuilder);
     72        } else if (node.Symbol is HyperbolicTangent) {
     73          FormatFunction(node, "Tanh", strBuilder);
    7274        } else if (node.Symbol is Exponential) {
    7375          FormatFunction(node, "Exp", strBuilder);
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionSmalltalkFormatter.cs

    r16565 r16702  
    160160        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
    161161        stringBuilder.Append(" tan");
     162      } else if (symbol is HyperbolicTangent) {
     163        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
     164        stringBuilder.Append(" tanh");
    162165      } else if (symbol is Variable) {
    163166        VariableTreeNode variableTreeNode = node as VariableTreeNode;
Note: See TracChangeset for help on using the changeset viewer.