Changeset 14237 for branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FactorVariableTreeNode.cs
- Timestamp:
- 08/05/16 14:25:28 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FactorVariableTreeNode.cs
r14233 r14237 27 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 28 28 [StorableClass] 29 public class FactorVariableTreeNode : SymbolicExpressionTreeTerminalNode {29 public class FactorVariableTreeNode : VariableTreeNodeBase { 30 30 public new FactorVariable Symbol { 31 31 get { return (FactorVariable)base.Symbol; } 32 }33 [Storable]34 private string variableName;35 public string VariableName {36 get { return variableName; }37 set { variableName = value; }38 32 } 39 33 … … 49 43 protected FactorVariableTreeNode(FactorVariableTreeNode original, Cloner cloner) 50 44 : base(original, cloner) { 51 variableName = original.variableName;52 45 variableValue = original.variableValue; 53 46 } … … 61 54 public override void ResetLocalParameters(IRandom random) { 62 55 base.ResetLocalParameters(random); 63 variableName = Symbol.VariableNames.SampleRandom(random);64 56 variableValue = Symbol.GetVariableValues(VariableName).SampleRandom(random); 65 57 } 66 58 67 59 public override void ShakeLocalParameters(IRandom random, double shakingFactor) { 68 base.ShakeLocalParameters(random, shakingFactor); 60 // 50% additive & 50% multiplicative 61 if (random.NextDouble() < 0.5) { 62 double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma); 63 Weight = Weight + x * shakingFactor; 64 } else { 65 double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeWeightManipulatorSigma); 66 Weight = Weight * x; 67 } 69 68 if (random.NextDouble() < 0.2) { 70 variableName = Symbol.VariableNames.SampleRandom(random);69 VariableName = Symbol.VariableNames.SampleRandom(random); 71 70 } 72 71 variableValue = Symbol.GetVariableValues(VariableName).SampleRandom(random); … … 78 77 79 78 public override string ToString() { 80 return variableName+ " = " + variableValue;79 return base.ToString() + " = " + variableValue; 81 80 } 82 81 }
Note: See TracChangeset
for help on using the changeset viewer.