Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/27/10 17:38:55 (14 years ago)
Author:
cneumuel
Message:

implemented basic crossover operator for ParameterSets. MetaOptimization is now functional on a basic level (Configuration and Crossing only works for IntValue Parameters) (#1215)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/NumericRange.cs

    r4516 r4525  
    55using HeuristicLab.Core;
    66using HeuristicLab.Data;
     7using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    78
    89namespace HeuristicLab.Problems.MetaOptimization {
     10  [StorableClass]
    911  public class NumericRange : Item, INumericRange {
     12    [Storable]
    1013    private IntValue lowerBound;
    1114    public IntValue LowerBound {
     
    2528    }
    2629
     30    [Storable]
    2731    private IntValue upperBound;
    2832    public IntValue UpperBound {
     
    4246    }
    4347
     48    [Storable]
    4449    private IntValue stepSize;
    4550    public IntValue StepSize {
     
    6368      UpperBound = new IntValue(0);
    6469      StepSize = new IntValue(1);
     70    }
     71
     72    [StorableConstructor]
     73    protected NumericRange(bool deserializing) : base(deserializing) { }
     74
     75    [StorableHook(HookType.AfterDeserialization)]
     76    private void AfterDeserialization() {
     77      if (lowerBound != null) {
     78        lowerBound.ValueChanged += new EventHandler(lowerBound_ValueChanged);
     79      }
     80      if (upperBound != null) {
     81        upperBound.ValueChanged += new EventHandler(upperBound_ValueChanged);
     82      }
     83      if (stepSize != null) {
     84        stepSize.ValueChanged += new EventHandler(stepSize_ValueChanged);
     85      }
    6586    }
    6687
     
    95116      return string.Format("[{0},{1}:{2}]", LowerBound.ToString(), UpperBound.ToString(), StepSize.ToString());
    96117    }
     118
     119    #region Cloning
     120    public override Common.IDeepCloneable Clone(Common.Cloner cloner) {
     121      NumericRange clone = (NumericRange)base.Clone(cloner);
     122      clone.LowerBound = (IntValue)this.LowerBound.Clone();
     123      clone.UpperBound = (IntValue)this.UpperBound.Clone();
     124      clone.StepSize = (IntValue)this.StepSize.Clone();
     125      return base.Clone(cloner);
     126    }
     127    #endregion
    97128  }
    98129}
Note: See TracChangeset for help on using the changeset viewer.