Changeset 18093 for branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters
- Timestamp:
- 11/24/21 13:40:39 (3 years ago)
- Location:
- branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/LinearModelToTreeConverter.cs
r17180 r18093 58 58 59 59 if (@const!=0.0) { 60 ConstantTreeNode cNode = (ConstantTreeNode)new Constant().CreateTreeNode();60 NumTreeNode cNode = (NumTreeNode)new Num().CreateTreeNode(); 61 61 cNode.Value = @const; 62 62 add.AddSubtree(cNode); … … 99 99 100 100 if (!@const.IsAlmost(0.0)) { 101 ConstantTreeNode cNode = (ConstantTreeNode)new Constant().CreateTreeNode();101 NumTreeNode cNode = (NumTreeNode)new Num().CreateTreeNode(); 102 102 cNode.Value = @const; 103 103 addition.AddSubtree(cNode); … … 130 130 131 131 if (!@const.IsAlmost(0.0)) { 132 ConstantTreeNode cNode = (ConstantTreeNode)new Constant().CreateTreeNode();132 NumTreeNode cNode = (NumTreeNode)new Num().CreateTreeNode(); 133 133 cNode.Value = @const; 134 134 addition.AddSubtree(cNode); -
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs
r17817 r18093 145 145 146 146 private AutoDiff.Term ConvertToAutoDiff(ISymbolicExpressionTreeNode node) { 147 if (node.Symbol is Constant) { 148 initialConstants.Add(((ConstantTreeNode)node).Value); 147 if (node.Symbol is Num) { 148 initialConstants.Add(((NumTreeNode)node).Value); 149 var var = new AutoDiff.Variable(); 150 variables.Add(var); 151 return var; 152 } 153 154 if (node.Symbol is RealConstant) { 155 initialConstants.Add(((RealConstantTreeNode)node).Value); 149 156 var var = new AutoDiff.Variable(); 150 157 variables.Add(var); … … 260 267 } 261 268 if (node.Symbol is Power) { 262 var powerNode = node.GetSubtree(1) as ConstantTreeNode;269 var powerNode = node.GetSubtree(1) as NumTreeNode; 263 270 if (powerNode == null) 264 271 throw new NotSupportedException("Only integer powers are allowed in parameter optimization. Try to use exp() and log() instead of the power symbol."); … … 330 337 !(n.Symbol is FactorVariable) && 331 338 !(n.Symbol is LaggedVariable) && 332 !(n.Symbol is Constant) && 339 !(n.Symbol is Num) && 340 !(n.Symbol is RealConstant) && 333 341 !(n.Symbol is Addition) && 334 342 !(n.Symbol is Subtraction) &&
Note: See TracChangeset
for help on using the changeset viewer.