- Timestamp:
- 01/18/11 16:09:35 (14 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
r4989 r5326 30 30 [Item("Constant", "Represents a constant value.")] 31 31 public sealed class Constant : Symbol { 32 #region Prope ties32 #region Properties 33 33 [Storable] 34 34 private double minValue; … … 76 76 } 77 77 } 78 [Storable(DefaultValue = 0.0)] 79 private double multiplicativeManipulatorSigma; 80 public double MultiplicativeManipulatorSigma { 81 get { return multiplicativeManipulatorSigma; } 82 set { 83 if (value < 0) throw new ArgumentException(); 84 if (value != multiplicativeManipulatorSigma) { 85 multiplicativeManipulatorSigma = value; 86 OnChanged(EventArgs.Empty); 87 } 88 } 89 } 90 78 91 #endregion 79 92 [StorableConstructor] … … 85 98 manipulatorMu = original.manipulatorMu; 86 99 manipulatorSigma = original.manipulatorSigma; 100 multiplicativeManipulatorSigma = original.multiplicativeManipulatorSigma; 87 101 } 88 102 public Constant() … … 90 104 manipulatorMu = 0.0; 91 105 manipulatorSigma = 1.0; 106 multiplicativeManipulatorSigma = 0.03; 92 107 minValue = -20.0; 93 108 maxValue = 20.0; -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/ConstantTreeNode.cs
r4989 r5326 63 63 public override void ShakeLocalParameters(IRandom random, double shakingFactor) { 64 64 base.ShakeLocalParameters(random, shakingFactor); 65 double x = NormalDistributedRandom.NextDouble(random, Symbol.ManipulatorMu, Symbol.ManipulatorSigma); 66 Value = Value + x * shakingFactor; 65 // 50% additive & 50% multiplicative 66 if (random.NextDouble() < 0.5) { 67 double x = NormalDistributedRandom.NextDouble(random, Symbol.ManipulatorMu, Symbol.ManipulatorSigma); 68 Value = Value + x * shakingFactor; 69 } else { 70 double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeManipulatorSigma); 71 Value = Value * x; 72 } 67 73 } 68 74 -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs
r4989 r5326 78 78 } 79 79 } 80 [Storable(DefaultValue = 0.0)] 81 private double multiplicativeWeightManipulatorSigma; 82 public double MultiplicativeWeightManipulatorSigma { 83 get { return multiplicativeWeightManipulatorSigma; } 84 set { 85 if (multiplicativeWeightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed."); 86 if (value != multiplicativeWeightManipulatorSigma) { 87 multiplicativeWeightManipulatorSigma = value; 88 OnChanged(EventArgs.Empty); 89 } 90 } 91 } 80 92 private List<string> variableNames; 81 93 [Storable] … … 91 103 #endregion 92 104 [StorableConstructor] 93 protected Variable(bool deserializing) : base(deserializing) { 105 protected Variable(bool deserializing) 106 : base(deserializing) { 94 107 variableNames = new List<string>(); 95 108 } … … 101 114 weightManipulatorMu = original.weightManipulatorMu; 102 115 weightManipulatorSigma = original.weightManipulatorSigma; 116 multiplicativeWeightManipulatorSigma = original.multiplicativeWeightManipulatorSigma; 103 117 } 104 118 public Variable() : this("Variable", "Represents a variable value.") { } … … 109 123 weightManipulatorMu = 0.0; 110 124 weightManipulatorSigma = 1.0; 125 multiplicativeWeightManipulatorSigma = 0.03; 111 126 variableNames = new List<string>(); 112 127 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableTreeNode.cs
r4989 r5326 68 68 public override void ShakeLocalParameters(IRandom random, double shakingFactor) { 69 69 base.ShakeLocalParameters(random, shakingFactor); 70 double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma); 71 weight = weight + x * shakingFactor; 70 // 50% additive & 50% multiplicative 71 if (random.NextDouble() < 0) { 72 double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma); 73 weight = weight + x * shakingFactor; 74 } else { 75 double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeWeightManipulatorSigma); 76 weight = weight * x; 77 } 72 78 variableName = Symbol.VariableNames.SelectRandom(random); 73 79 }
Note: See TracChangeset
for help on using the changeset viewer.