Free cookie consent management tool by TermsFeed Policy Generator

source: branches/sluengo/HeuristicLab.Problems.TradeRules/Symbols/ConstantIntTreeNode.cs @ 13791

Last change on this file since 13791 was 9499, checked in by sluengo, 12 years ago
File size: 1.8 KB
RevLine 
[9262]1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.Common;
6using HeuristicLab.Core;
7using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
8using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
9using HeuristicLab.Random;
10
11namespace 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           
[9499]53            Value = random.Next(100)+1;
[9262]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.