Changeset 18093 for branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs
- Timestamp:
- 11/24/21 13:40:39 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.