Changeset 14312 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters
- Timestamp:
- 09/28/16 15:59:11 (8 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Files:
-
- 7 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs
r14221 r14312 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Globalization; 25 24 using System.Linq; -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionCSharpFormatter.cs
r13482 r14312 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionExcelFormatter.cs
r12891 r14312 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs
r12155 r14312 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 36 36 private int targetCount; 37 37 private int currentLag; 38 private string targetVariable; 39 private bool containsTimeSeriesSymbol; 38 40 39 41 [StorableConstructor] … … 55 57 56 58 public string Format(ISymbolicExpressionTree symbolicExpressionTree) { 59 return Format(symbolicExpressionTree, null); 60 } 61 public string Format(ISymbolicExpressionTree symbolicExpressionTree, string targetVariable) { 57 62 try { 58 63 StringBuilder strBuilder = new StringBuilder(); 59 64 constants.Clear(); 65 this.targetVariable = targetVariable; 66 containsTimeSeriesSymbol = symbolicExpressionTree.IterateNodesBreadth().Any(n => IsTimeSeriesSymbol(n.Symbol)); 60 67 strBuilder.AppendLine(FormatRecursively(symbolicExpressionTree.Root)); 61 68 return strBuilder.ToString(); … … 64 71 return ex.Message + Environment.NewLine + ex.StackTrace; 65 72 } 73 } 74 static bool IsTimeSeriesSymbol(ISymbol s) { 75 return s is TimeLag || s is Integral || s is Derivative || s is LaggedVariable; 66 76 } 67 77 … … 197 207 strBuilder.Append(invokeNode.Symbol.FunctionName + @" \left( "); 198 208 } else if (node.Symbol is StartSymbol) { 199 strBuilder.Append("target_" + (targetCount++) + "(t) & = ");209 FormatStartSymbol(strBuilder); 200 210 } else if (node.Symbol is Argument) { 201 211 var argSym = node.Symbol as Argument; … … 303 313 } else if (node.Symbol is StartSymbol) { 304 314 strBuilder.Append(@"\\" + Environment.NewLine); 305 strBuilder.Append("target_" + (targetCount++) + "(t) & = ");315 FormatStartSymbol(strBuilder); 306 316 } else if (node.Symbol is Power) { 307 317 strBuilder.Append(@"\right) ^ { \operatorname{round} \left("); … … 403 413 var constStr = string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "{0:G5}", constant); 404 414 if (!constStr.Contains(".")) constStr = constStr + ".0"; 405 constStr = constStr.Replace(".", " \\negthickspace&."); // fix problem in rendering of aligned expressions415 constStr = constStr.Replace(".", "&."); // fix problem in rendering of aligned expressions 406 416 strBuilder.Append("c_{" + i + "}& = & " + constStr); 407 417 strBuilder.Append(@"\\"); … … 433 443 } 434 444 445 private void FormatStartSymbol(StringBuilder strBuilder) { 446 strBuilder.Append(targetVariable ?? "target_" + (targetCount++)); 447 if (containsTimeSeriesSymbol) 448 strBuilder.Append("(t)"); 449 strBuilder.Append(" & = "); 450 } 451 435 452 private string LagToString(int lag) { 436 453 if (lag < 0) { -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs
r12155 r14312 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMathematicaFormatter.cs
r13482 r14312 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionSmalltalkFormatter.cs
r12155 r14312 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab.
Note: See TracChangeset
for help on using the changeset viewer.