Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/31/21 08:08:32 (4 years ago)
Author:
gkronber
Message:

#3073 merged r17811:17826 from trunk to branch

Location:
branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs

    r17790 r17827  
    2929using HeuristicLab.Core;
    3030using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    31 using Microsoft.SqlServer.Server;
    3231
    3332namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    3938        // operators
    4039        if (token == "+" || token == "-" || token == "OR" || token == "XOR" ||
    41             token == "*" || token == "/" || token == "AND" ||
    42             token == "^") {
     40            token == "*" || token == "/" || token == "AND") {
    4341          strBuilder.Append("(");
    4442          FormatRecursively(node.Subtrees.First(), strBuilder, numberFormat, formatString, constants);
     
    4745            strBuilder.Append(" ").Append(token).Append(" ");
    4846            FormatRecursively(subtree, strBuilder, numberFormat, formatString, constants);
     47          }
     48
     49          strBuilder.Append(")");
     50        } else if (token == "^") {
     51          // handle integer powers directly
     52          strBuilder.Append("(");
     53          FormatRecursively(node.Subtrees.First(), strBuilder, numberFormat, formatString, constants);
     54
     55          var power = node.GetSubtree(1);
     56          if(power is ConstantTreeNode constNode && Math.Truncate(constNode.Value) == constNode.Value) {
     57            strBuilder.Append(" ").Append(token).Append(" ").Append(constNode.Value.ToString(formatString, numberFormat));
     58          } else {
     59            strBuilder.Append(" ").Append(token).Append(" ");
     60            FormatRecursively(power, strBuilder, numberFormat, formatString, constants);
    4961          }
    5062
     
    131143        } else if (node.Symbol is Constant) {
    132144          var constNode = node as ConstantTreeNode;
    133           if(constants==null && constNode.Value < 0) {
     145          if (constants == null && constNode.Value < 0) {
    134146            strBuilder.Append("(").Append(constNode.Value.ToString(formatString, numberFormat))
    135147                      .Append(")"); // (-1
  • branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs

    r17790 r17827  
    517517
    518518    private void FormatStartSymbol(StringBuilder strBuilder) {
    519       strBuilder.Append(EscapeLatexString(targetVariable) ?? "target_{" + targetCount++ + "}");
     519      strBuilder.Append(targetVariable != null ? EscapeLatexString(targetVariable) : "\\text{target}_{" + targetCount++ + "}");
    520520      if (containsTimeSeriesSymbol)
    521521        strBuilder.Append("(t)");
Note: See TracChangeset for help on using the changeset viewer.