Changeset 5026 for branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols
- Timestamp:
- 12/06/10 10:28:34 (14 years ago)
- Location:
- branches/GP.Symbols (TimeLag, Diff, Integral)
- Files:
-
- 2 added
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/GP.Symbols (TimeLag, Diff, Integral)
-
Property
svn:ignore
set to
GP.Symbols.suo
-
Property
svn:ignore
set to
-
branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedTreeNode.cs
r5005 r5026 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Random;27 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols { 28 28 [StorableClass] 29 public class VariableTreeNode : SymbolicExpressionTreeTerminalNode {30 public new VariableSymbol {31 get { return ( Variable)base.Symbol; }29 public class LaggedTreeNode : SymbolicExpressionTreeNode, ILaggedTreeNode { 30 public new LaggedSymbol Symbol { 31 get { return (LaggedSymbol)base.Symbol; } 32 32 } 33 33 [Storable] 34 private double weight; 35 public double Weight { 36 get { return weight; } 37 set { weight = value; } 38 } 39 [Storable] 40 private string variableName; 41 public string VariableName { 42 get { return variableName; } 43 set { variableName = value; } 34 private int lag; 35 public int Lag { 36 get { return lag; } 37 set { lag = value; } 44 38 } 45 39 46 40 [StorableConstructor] 47 protected VariableTreeNode(bool deserializing) : base(deserializing) { }48 protected VariableTreeNode(VariableTreeNode original, Cloner cloner)41 protected LaggedTreeNode(bool deserializing) : base(deserializing) { } 42 protected LaggedTreeNode(LaggedTreeNode original, Cloner cloner) 49 43 : base(original, cloner) { 50 weight = original.weight; 51 variableName = original.variableName; 44 lag = original.lag; 52 45 } 53 protected VariableTreeNode() { } 54 public VariableTreeNode(Variable variableSymbol) : base(variableSymbol) { } 46 public LaggedTreeNode(LaggedSymbol timeLagSymbol) : base(timeLagSymbol) { } 55 47 56 48 public override bool HasLocalParameters { 57 get { 58 return true; 59 } 49 get { return true; } 60 50 } 61 51 62 52 public override void ResetLocalParameters(IRandom random) { 63 53 base.ResetLocalParameters(random); 64 weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma); 65 variableName = Symbol.VariableNames.SelectRandom(random); 54 lag = random.Next(Symbol.MinLag, Symbol.MaxLag + 1); 66 55 } 67 56 68 57 public override void ShakeLocalParameters(IRandom random, double shakingFactor) { 69 58 base.ShakeLocalParameters(random, shakingFactor); 70 double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma); 71 weight = weight + x * shakingFactor; 72 variableName = Symbol.VariableNames.SelectRandom(random); 59 lag = Math.Min(Symbol.MaxLag, Math.Max(Symbol.MinLag, lag + random.Next(-1, 2))); 73 60 } 74 61 75 62 public override IDeepCloneable Clone(Cloner cloner) { 76 return new VariableTreeNode(this, cloner);63 return new LaggedTreeNode(this, cloner); 77 64 } 78 65 79 66 public override string ToString() { 80 if (weight.IsAlmost(1.0)) return variableName; 81 else return weight.ToString("E4") + " " + variableName; 67 return base.ToString() + " " + lag.ToString(); 82 68 } 83 69 } -
branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs
r4722 r5026 26 26 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols { 27 27 [StorableClass] 28 public sealed class LaggedVariableTreeNode : VariableTreeNode {28 public sealed class LaggedVariableTreeNode : VariableTreeNode, ILaggedTreeNode { 29 29 public new LaggedVariable Symbol { 30 30 get { return (LaggedVariable)base.Symbol; }
Note: See TracChangeset
for help on using the changeset viewer.