Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/RealConstantTreeNode.cs @ 18100

Last change on this file since 18100 was 18093, checked in by chaider, 3 years ago

#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 size: 1.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using HEAL.Attic;
7using HeuristicLab.Common;
8using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
9
10namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
11  [StorableType("F91000E6-B041-4648-A9E8-595228F957FA")]
12  public sealed class RealConstantTreeNode : SymbolicExpressionTreeTerminalNode{
13
14    public new RealConstant Symbol {
15      get { return (RealConstant) base.Symbol; }
16    }
17
18    public double Value { get; set; }
19
20    [StorableConstructor]
21    private RealConstantTreeNode(StorableConstructorFlag _) : base(_) { }
22
23    private RealConstantTreeNode(RealConstantTreeNode original, Cloner cloner)
24      : base(original, cloner) {
25      Value = original.Value;
26    }
27
28    private RealConstantTreeNode() : base() { }
29    public RealConstantTreeNode(RealConstant realConstantSymbol) : base(realConstantSymbol) { }
30
31    public override IDeepCloneable Clone(Cloner cloner) {
32      return new RealConstantTreeNode(this, cloner);
33    }
34
35    public override string ToString() {
36      return $"{Value:E4}";
37    }
38  }
39}
Note: See TracBrowser for help on using the repository browser.