Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using HeuristicLab.Common;
|
---|
6 | using HeuristicLab.Core;
|
---|
7 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
8 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
9 | using HeuristicLab.Random;
|
---|
10 |
|
---|
11 | namespace HeuristicLab.Problems.TradeRules
|
---|
12 | {
|
---|
13 | [StorableClass]
|
---|
14 | public sealed class ConstantIntTreeNode : SymbolicExpressionTreeTerminalNode
|
---|
15 | {
|
---|
16 |
|
---|
17 | public new ConstantInt Symbol
|
---|
18 | {
|
---|
19 | get { return (ConstantInt)base.Symbol; }
|
---|
20 | }
|
---|
21 |
|
---|
22 | private double ConstantIntValue;
|
---|
23 | [Storable]
|
---|
24 | public double Value
|
---|
25 | {
|
---|
26 | get { return ConstantIntValue; }
|
---|
27 | set { ConstantIntValue = value; }
|
---|
28 | }
|
---|
29 |
|
---|
30 | [StorableConstructor]
|
---|
31 | private ConstantIntTreeNode(bool deserializing) : base(deserializing) { }
|
---|
32 |
|
---|
33 | private ConstantIntTreeNode(ConstantIntTreeNode original, Cloner cloner)
|
---|
34 | : base(original, cloner)
|
---|
35 | {
|
---|
36 | ConstantIntValue = original.ConstantIntValue;
|
---|
37 | }
|
---|
38 |
|
---|
39 | private ConstantIntTreeNode() : base() { }
|
---|
40 | public ConstantIntTreeNode(ConstantInt ConstantIntSymbol) : base(ConstantIntSymbol) { }
|
---|
41 |
|
---|
42 | public override bool HasLocalParameters
|
---|
43 | {
|
---|
44 | get
|
---|
45 | {
|
---|
46 | return true;
|
---|
47 | }
|
---|
48 | }
|
---|
49 | public override void ResetLocalParameters(IRandom random)
|
---|
50 | {
|
---|
51 | base.ResetLocalParameters(random);
|
---|
52 |
|
---|
53 | Value = random.Next(99)+1;
|
---|
54 | }
|
---|
55 |
|
---|
56 | public override IDeepCloneable Clone(Cloner cloner)
|
---|
57 | {
|
---|
58 | return new ConstantIntTreeNode(this, cloner);
|
---|
59 | }
|
---|
60 |
|
---|
61 | public override string ToString()
|
---|
62 | {
|
---|
63 | return ConstantIntValue.ToString("E5");
|
---|
64 | }
|
---|
65 | }
|
---|
66 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.