Free cookie consent management tool by TermsFeed Policy Generator

# Changeset 17827

Ignore:
Timestamp:
01/31/21 08:08:32 (3 years ago)
Message:

#3073 merged r17811:17826 from trunk to branch

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

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

• Property svn:mergeinfo changed /trunk/HeuristicLab.Problems.DataAnalysis.Symbolic merged: 17811,​17817,​17820,​17826
• ## branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeSimplifier.cs

 r17798 var constBValue = Math.Round(constB.Value); if (constBValue == 1.0) { // root(a, 1) => a return a; } else if (constBValue == 0.0) { return MakeConstant(1.0); // root(a, 0) is not defined //return MakeConstant(1.0); return MakeConstant(double.NaN); } else if (constBValue == -1.0) { // root(a, -1) => a^(-1/1) => 1/a return MakeFraction(MakeConstant(1.0), a); } else if (constBValue < 0) { // root(a, -b) => a^(-1/b) => (1/a)^(1/b) => root(1, b) / root(a, b) => 1 / root(a, b) var rootNode = rootSymbol.CreateTreeNode(); rootNode.AddSubtree(a); double exponent = Math.Round(constB.Value); if (exponent == 0.0) { // a^0 => 1 return MakeConstant(1.0); } else if (exponent == 1.0) { // a^1 => a return a; } else if (exponent == -1.0) { // a^-1 => 1/a return MakeFraction(MakeConstant(1.0), a); } else if (exponent < 0) { // a^-b => (1/a)^b => 1/(a^b) var powNode = powSymbol.CreateTreeNode(); powNode.AddSubtree(a); return MakeConstant(((ConstantTreeNode)a).Value / ((ConstantTreeNode)b).Value); } else if ((IsConstant(a) && ((ConstantTreeNode)a).Value != 1.0)) { // a / x => (a * 1/a) / (x * 1/a) => 1 / (x * 1/a) return MakeFraction(MakeConstant(1.0), MakeProduct(b, Invert(a))); } else if (IsVariableBase(a) && IsConstant(b)) {
• ## branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs

 r17180 if (node.Symbol is CubeRoot) { return cbrt(ConvertToAutoDiff(node.GetSubtree(0))); } if (node.Symbol is Power) { var powerNode = node.GetSubtree(1) as ConstantTreeNode; if (powerNode == null) throw new NotSupportedException("Only integer powers are allowed in parameter optimization. Try to use exp() and log() instead of the power symbol."); var intPower = Math.Truncate(powerNode.Value); if (intPower != powerNode.Value) throw new NotSupportedException("Only integer powers are allowed in parameter optimization. Try to use exp() and log() instead of the power symbol."); return AutoDiff.TermBuilder.Power(ConvertToAutoDiff(node.GetSubtree(0)), intPower); } if (node.Symbol is Sine) { !(n.Symbol is AnalyticQuotient) && !(n.Symbol is Cube) && !(n.Symbol is CubeRoot) !(n.Symbol is CubeRoot) && !(n.Symbol is Power) select n).Any(); return !containsUnknownSymbol;
• ## branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs

 r17790 using HeuristicLab.Core; using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; using Microsoft.SqlServer.Server; namespace HeuristicLab.Problems.DataAnalysis.Symbolic { // operators if (token == "+" || token == "-" || token == "OR" || token == "XOR" || token == "*" || token == "/" || token == "AND" || token == "^") { token == "*" || token == "/" || token == "AND") { strBuilder.Append("("); FormatRecursively(node.Subtrees.First(), strBuilder, numberFormat, formatString, constants); strBuilder.Append(" ").Append(token).Append(" "); FormatRecursively(subtree, strBuilder, numberFormat, formatString, constants); } strBuilder.Append(")"); } else if (token == "^") { // handle integer powers directly strBuilder.Append("("); FormatRecursively(node.Subtrees.First(), strBuilder, numberFormat, formatString, constants); var power = node.GetSubtree(1); if(power is ConstantTreeNode constNode && Math.Truncate(constNode.Value) == constNode.Value) { strBuilder.Append(" ").Append(token).Append(" ").Append(constNode.Value.ToString(formatString, numberFormat)); } else { strBuilder.Append(" ").Append(token).Append(" "); FormatRecursively(power, strBuilder, numberFormat, formatString, constants); } } else if (node.Symbol is Constant) { var constNode = node as ConstantTreeNode; if(constants==null && constNode.Value < 0) { if (constants == null && constNode.Value < 0) { strBuilder.Append("(").Append(constNode.Value.ToString(formatString, numberFormat)) .Append(")"); // (-1
• ## branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs

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