Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/16/21 11:22:29 (3 years ago)
Author:
chaider
Message:

#3140

  • Removed setter from INumericTreeNode
  • Fixed SymbolicExpressionImporter check for constants and number individually
  • Set exponent of power in DerivativeCalculator to number
  • Set number in TreeConstantNodeEditDialog and ExpressionTreeChart
  • Fixed setting of VariableRanges in DataAnalysisProblemData
Location:
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
Files:
5 edited

Legend:

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

    r18130 r18142  
    156156          var newPower = (ISymbolicExpressionTreeNode)branch.Clone();
    157157          var f = (ISymbolicExpressionTreeNode)newPower.GetSubtree(0).Clone();
    158           var newExponent = (INumericTreeNode)numberSy.CreateTreeNode();
    159           newExponent.Value = ((INumericTreeNode)newPower.GetSubtree(1)).Value - 1;
     158          var newExponent = (NumberTreeNode)numberSy.CreateTreeNode();
     159          newExponent.Value = ((NumberTreeNode)newPower.GetSubtree(1)).Value - 1;
    160160          return Product(Product(CreateNumber(exponent.Value), newPower), Derive(f, variableName));
    161161        } else throw new NotSupportedException("Cannot derive non-integer powers");
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/SymbolicExpressionTreeHash.cs

    r18115 r18142  
    215215            variableTreeNode.Weight = variable.Weight;
    216216          } else if (node.Data is INumericTreeNode existingNumNode) {
    217             var newNumNode = (INumericTreeNode)treeNodes[i];
     217            var newNumNode = (NumberTreeNode)treeNodes[i];
    218218            newNumNode.Value = existingNumNode.Value;
    219219          }
     
    277277
    278278        var symbol = child.Data.Symbol;
    279         if (child.Data is INumericTreeNode firstNum) {
     279        if (child.Data is NumberTreeNode firstNum) {
    280280          // fold sibling number nodes into the first number
    281281          for (int k = j + 1; k < children.Length; ++k) {
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/SymbolicExpressionImporter.cs

    r18123 r18142  
    162162        return tree;
    163163      } else if (tokens.Peek().Symbol == TokenSymbol.CONSTANT) {
    164         var t = (INumericTreeNode)number.CreateTreeNode();
    165         t.Value = tokens.Dequeue().DoubleValue;
    166         return t;
     164        var value = tokens.Dequeue().DoubleValue;
     165        var constant = new Constant() { Value = value };
     166        return constant.CreateTreeNode();
    167167      } else if (tokens.Peek().Symbol == TokenSymbol.LBRACKET) {
    168168        Expect(Token.LBRACKET, tokens);
    169169        Expect(Token.NUM, tokens);
    170         var t = (INumericTreeNode)number.CreateTreeNode();
     170        var t = (NumberTreeNode)number.CreateTreeNode();
    171171        if (tokens.Peek().Symbol == TokenSymbol.EQ) {
    172172          Expect(Token.EQ, tokens);
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/INumericTreeNode.cs

    r18100 r18142  
    2626  [StorableType("194AFEE6-96E2-4F53-A5AD-D3CCFE928AE5")]
    2727  public interface INumericTreeNode : ISymbolicExpressionTreeNode {
    28     double Value { get; set; }
     28    double Value { get; }
    2929  }
    3030}
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ConstantTreeNode.cs

    r18115 r18142  
    3030    public new Constant Symbol => (Constant) base.Symbol;
    3131
    32     public double Value {
    33       get => Symbol.Value;
    34       set => throw new System.NotSupportedException("Cannot change the value of a constant.");
    35     }
     32    public double Value => Symbol.Value;
    3633
    3734    [StorableConstructor]
Note: See TracChangeset for help on using the changeset viewer.