- Timestamp:
- 04/23/10 14:27:06 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Constant.cs
r3485 r3512 28 28 using HeuristicLab.Parameters; 29 29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; 30 using System; 30 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols { 31 32 [StorableClass] … … 45 46 set { maxValue = value; } 46 47 } 48 [Storable] 49 private double manipulatorNu; 50 public double ManipulatorNu { 51 get { return manipulatorNu; } 52 set { manipulatorNu = value; } 53 } 54 [Storable] 55 private double manipulatorSigma; 56 public double ManipulatorSigma { 57 get { return manipulatorSigma; } 58 set { 59 if (value < 0) throw new ArgumentException(); 60 manipulatorSigma = value; 61 } 62 } 47 63 #endregion 48 64 public Constant() 49 65 : base() { 66 manipulatorNu = 0.0; 67 manipulatorSigma = 1.0; 68 minValue = -20.0; 69 maxValue = 20.0; 50 70 } 51 71 … … 55 75 56 76 public override IDeepCloneable Clone(Cloner cloner) { 57 Constant clone = (Constant) 77 Constant clone = (Constant)base.Clone(cloner); 58 78 clone.minValue = minValue; 59 79 clone.maxValue = maxValue; 80 clone.manipulatorNu = manipulatorNu; 81 clone.manipulatorSigma = manipulatorSigma; 60 82 return clone; 61 83 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/ConstantTreeNode.cs
r3485 r3512 63 63 } 64 64 65 public override void ShakeLocalParameters(IRandom random, double shakingFactor) { 66 base.ShakeLocalParameters(random, shakingFactor); 67 var normalDistributedRNG = new NormalDistributedRandom(random, Symbol.ManipulatorNu, Symbol.ManipulatorSigma); 68 double x = normalDistributedRNG.NextDouble(); 69 Value = Value + x * shakingFactor; 70 } 71 65 72 public override object Clone() { 66 73 return new ConstantTreeNode(this); -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs
r3485 r3512 52 52 } 53 53 [Storable] 54 private double weightManipulatorNu; 55 public double WeightManipulatorNu { 56 get { return weightManipulatorNu; } 57 set { weightManipulatorNu = value; } 58 } 59 [Storable] 60 private double weightManipulatorSigma; 61 public double WeightManipulatorSigma { 62 get { return weightManipulatorSigma; } 63 set { 64 if (weightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed."); 65 weightManipulatorSigma = value; 66 } 67 } 68 [Storable] 54 69 private List<string> variableNames; 55 70 public IEnumerable<string> VariableNames { … … 66 81 weightNu = 1.0; 67 82 weightSigma = 1.0; 83 weightManipulatorNu = 0.0; 84 weightManipulatorSigma = 1.0; 68 85 variableNames = new List<string>(); 69 86 } … … 78 95 clone.weightSigma = weightSigma; 79 96 clone.variableNames = new List<string>(variableNames); 97 clone.weightManipulatorNu = weightManipulatorNu; 98 clone.weightManipulatorSigma = weightManipulatorSigma; 80 99 return clone; 81 100 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableTreeNode.cs
r3485 r3512 69 69 var normalDistributedRNG = new NormalDistributedRandom(random, Symbol.WeightNu, Symbol.WeightSigma); 70 70 weight = normalDistributedRNG.NextDouble(); 71 var variableList = new List<string>(Symbol.VariableNames); 72 int variableIndex = random.Next(0, variableList.Count); 73 variableName = variableList[variableIndex]; 71 variableName = Symbol.VariableNames.SelectRandom(random); 74 72 } 73 74 public override void ShakeLocalParameters(IRandom random, double shakingFactor) { 75 base.ShakeLocalParameters(random, shakingFactor); 76 var normalDistributedRNG = new NormalDistributedRandom(random, Symbol.WeightManipulatorNu, Symbol.WeightManipulatorSigma); 77 double x = normalDistributedRNG.NextDouble(); 78 weight = weight + x * shakingFactor; 79 variableName = Symbol.VariableNames.SelectRandom(random); 80 } 81 75 82 76 83 public override object Clone() {
Note: See TracChangeset
for help on using the changeset viewer.