Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/24/21 13:40:39 (3 years ago)
Author:
chaider
Message:

#3041

  • Renaming Constant Symbol to Num, behaves like before
  • Adding new Symbol RealConstant (Constant), this symbol behaves now like a real constant, won't be changed by parameter optimization or manipulators
  • Refactored classes part1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs

    r17817 r18093  
    145145
    146146    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);
    149156        var var = new AutoDiff.Variable();
    150157        variables.Add(var);
     
    260267      }
    261268      if (node.Symbol is Power) {
    262         var powerNode = node.GetSubtree(1) as ConstantTreeNode;
     269        var powerNode = node.GetSubtree(1) as NumTreeNode;
    263270        if (powerNode == null)
    264271          throw new NotSupportedException("Only integer powers are allowed in parameter optimization. Try to use exp() and log() instead of the power symbol.");
     
    330337          !(n.Symbol is FactorVariable) &&
    331338          !(n.Symbol is LaggedVariable) &&
    332           !(n.Symbol is Constant) &&
     339          !(n.Symbol is Num) &&
     340          !(n.Symbol is RealConstant) &&
    333341          !(n.Symbol is Addition) &&
    334342          !(n.Symbol is Subtraction) &&
Note: See TracChangeset for help on using the changeset viewer.