- Timestamp:
- 12/16/21 11:22:29 (3 years ago)
- 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 156 156 var newPower = (ISymbolicExpressionTreeNode)branch.Clone(); 157 157 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; 160 160 return Product(Product(CreateNumber(exponent.Value), newPower), Derive(f, variableName)); 161 161 } else throw new NotSupportedException("Cannot derive non-integer powers"); -
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/SymbolicExpressionTreeHash.cs
r18115 r18142 215 215 variableTreeNode.Weight = variable.Weight; 216 216 } else if (node.Data is INumericTreeNode existingNumNode) { 217 var newNumNode = ( INumericTreeNode)treeNodes[i];217 var newNumNode = (NumberTreeNode)treeNodes[i]; 218 218 newNumNode.Value = existingNumNode.Value; 219 219 } … … 277 277 278 278 var symbol = child.Data.Symbol; 279 if (child.Data is INumericTreeNode firstNum) {279 if (child.Data is NumberTreeNode firstNum) { 280 280 // fold sibling number nodes into the first number 281 281 for (int k = j + 1; k < children.Length; ++k) { -
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/SymbolicExpressionImporter.cs
r18123 r18142 162 162 return tree; 163 163 } 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(); 167 167 } else if (tokens.Peek().Symbol == TokenSymbol.LBRACKET) { 168 168 Expect(Token.LBRACKET, tokens); 169 169 Expect(Token.NUM, tokens); 170 var t = ( INumericTreeNode)number.CreateTreeNode();170 var t = (NumberTreeNode)number.CreateTreeNode(); 171 171 if (tokens.Peek().Symbol == TokenSymbol.EQ) { 172 172 Expect(Token.EQ, tokens); -
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/INumericTreeNode.cs
r18100 r18142 26 26 [StorableType("194AFEE6-96E2-4F53-A5AD-D3CCFE928AE5")] 27 27 public interface INumericTreeNode : ISymbolicExpressionTreeNode { 28 double Value { get; set;}28 double Value { get; } 29 29 } 30 30 } -
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ConstantTreeNode.cs
r18115 r18142 30 30 public new Constant Symbol => (Constant) base.Symbol; 31 31 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; 36 33 37 34 [StorableConstructor]
Note: See TracChangeset
for help on using the changeset viewer.