Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/04/11 02:18:27 (13 years ago)
Author:
cneumuel
Message:

#1215

  • lots of memory-consumption improvements
  • validValues -> validTypes (this saves memory!)
  • changed manipulators; modifications are less significant, out-of-bound-values are resampled instead of set to lower or upper bound
  • changed the way a base-level algorithm gets executed -> introduced AlgorithmExecutor
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/DoubleValueRange.cs

    r5184 r5207  
    2525      do {
    2626        val = Math.Round((random.NextDouble() * (UpperBound.Value - LowerBound.Value) + LowerBound.Value) / StepSize.Value, 0) * StepSize.Value;
    27       } while (val < LowerBound.Value || val > UpperBound.Value);
     27      } while (!IsInRange(val));
    2828      return new DoubleValue(val);
    2929    }
    3030
    31     public void Fix(DoubleValue value) {
    32       // apply stepsize
     31    public void ApplyStepSize(DoubleValue value) {
    3332      value.Value = ((int)Math.Round(value.Value / this.StepSize.Value, 0)) * this.StepSize.Value;
     33    }
    3434
    35       // repair bounds
    36       if (value.Value > this.UpperBound.Value) value.Value = this.UpperBound.Value;
    37       if (value.Value < this.LowerBound.Value) value.Value = this.LowerBound.Value;
     35    public bool IsInRange(double value) {
     36      return value <= this.UpperBound.Value && value >= this.LowerBound.Value;
    3837    }
    3938
    4039    public override IEnumerable<DoubleValue> GetCombinations() {
    4140      var solutions = new List<DoubleValue>();
    42       double value = ((int)Math.Round(LowerBound.Value / StepSize.Value, 0)) * StepSize.Value;
    43       if (value < LowerBound.Value) value += StepSize.Value;
     41      double value = LowerBound.Value;
    4442
    4543      while (value <= UpperBound.Value) {
Note: See TracChangeset for help on using the changeset viewer.