Changeset 4525 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/NumericParameterConfiguration.cs
- Timestamp:
- 09/27/10 17:38:55 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/NumericParameterConfiguration.cs
r4516 r4525 6 6 using HeuristicLab.Core; 7 7 using HeuristicLab.Collections; 8 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 8 9 9 10 namespace HeuristicLab.Problems.MetaOptimization { 11 [StorableClass] 10 12 public class NumericParameterConfiguration : ParameterConfiguration { 13 [Storable] 11 14 private NumericRangeList ranges; 12 15 public NumericRangeList Ranges { … … 15 18 16 19 protected NumericParameterConfiguration() { } 20 21 [StorableConstructor] 22 protected NumericParameterConfiguration(bool deserializing) : base(deserializing) { } 23 17 24 public NumericParameterConfiguration(IParameter parameter, string category) 18 25 : base(parameter, category) { … … 22 29 this.ranges.CollectionReset += new CollectionItemsChangedEventHandler<INumericRange>(ranges_CollectionReset); 23 30 } 31 32 24 33 25 34 void ranges_CollectionReset(object sender, CollectionItemsChangedEventArgs<INumericRange> e) { … … 55 64 } 56 65 66 #region Cloning 57 67 public override Common.IDeepCloneable Clone(Common.Cloner cloner) { 58 68 NumericParameterConfiguration clone = (NumericParameterConfiguration)base.Clone(cloner); … … 63 73 return clone; 64 74 } 75 #endregion 65 76 66 77 void range_ToStringChanged(object sender, EventArgs e) { … … 72 83 } 73 84 74 public override IParameter GetParameterWithRandomValue(IRandom random) {85 public override void SetParameterWithRandomValue(IRandom random) { 75 86 int rangeIndex = random.Next(ranges.Count); 76 87 int value = random.Next(ranges.ElementAt(rangeIndex).LowerBound.Value, ranges.ElementAt(rangeIndex).UpperBound.Value); // TODO: respect StepSize parameter 77 IParameter clone = (IParameter)this.Parameter.Clone(); 78 clone.ActualValue = new IntValue(value); 79 return clone; 88 this.Parameter.ActualValue = new IntValue(value); 80 89 } 81 90 }
Note: See TracChangeset
for help on using the changeset viewer.