Changeset 14758 for branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableBase.cs
- Timestamp:
- 03/18/17 10:36:37 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableBase.cs
r14238 r14758 34 34 get { return weightMu; } 35 35 set { 36 if 36 if(value != weightMu) { 37 37 weightMu = value; 38 38 OnChanged(EventArgs.Empty); … … 45 45 get { return weightSigma; } 46 46 set { 47 if 48 if 47 if(weightSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed."); 48 if(value != weightSigma) { 49 49 weightSigma = value; 50 50 OnChanged(EventArgs.Empty); … … 57 57 get { return weightManipulatorMu; } 58 58 set { 59 if 59 if(value != weightManipulatorMu) { 60 60 weightManipulatorMu = value; 61 61 OnChanged(EventArgs.Empty); … … 68 68 get { return weightManipulatorSigma; } 69 69 set { 70 if 71 if 70 if(weightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed."); 71 if(value != weightManipulatorSigma) { 72 72 weightManipulatorSigma = value; 73 73 OnChanged(EventArgs.Empty); … … 80 80 get { return multiplicativeWeightManipulatorSigma; } 81 81 set { 82 if 83 if 82 if(multiplicativeWeightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed."); 83 if(value != multiplicativeWeightManipulatorSigma) { 84 84 multiplicativeWeightManipulatorSigma = value; 85 85 OnChanged(EventArgs.Empty); … … 87 87 } 88 88 } 89 90 [Storable(DefaultValue = 1.0)] 91 private double variableChangeProbability; 92 93 public double VariableChangeProbability { 94 get { return VariableChangeProbability; } 95 set { 96 if(value < 0 || value > 1.0) throw new ArgumentException("Variable change probability must lie in the interval [0..1]"); 97 variableChangeProbability = value; 98 } 99 } 100 89 101 private List<string> variableNames; 90 102 [Storable] … … 92 104 get { return variableNames; } 93 105 set { 94 if 106 if(value == null) throw new ArgumentNullException(); 95 107 variableNames.Clear(); 96 108 variableNames.AddRange(value); … … 104 116 get { return allVariableNames; } 105 117 set { 106 if 118 if(value == null) throw new ArgumentNullException(); 107 119 allVariableNames.Clear(); 108 120 allVariableNames.AddRange(value); … … 112 124 public override bool Enabled { 113 125 get { 114 if 126 if(variableNames.Count == 0) return false; 115 127 return base.Enabled; 116 128 } 117 129 set { 118 if 130 if(variableNames.Count == 0) base.Enabled = false; 119 131 else base.Enabled = value; 120 132 } … … 134 146 [StorableHook(HookType.AfterDeserialization)] 135 147 private void AfterDeserialization() { 136 if 148 if(allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) { 137 149 allVariableNames = variableNames; 138 150 } … … 154 166 weightManipulatorSigma = original.weightManipulatorSigma; 155 167 multiplicativeWeightManipulatorSigma = original.multiplicativeWeightManipulatorSigma; 156 } 168 variableChangeProbability = original.variableChangeProbability; 169 } 157 170 protected VariableBase(string name, string description) 158 171 : base(name, description) { … … 162 175 weightManipulatorSigma = 0.05; 163 176 multiplicativeWeightManipulatorSigma = 0.03; 177 variableChangeProbability = 0.2; 164 178 variableNames = new List<string>(); 165 179 allVariableNames = new List<string>();
Note: See TracChangeset
for help on using the changeset viewer.