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/PercentValueRange.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 PercentValue(val);
    2929    }
     
    3333    }
    3434
     35    public void ApplyStepSize(PercentValue value) {
     36      value.Value = ((int)Math.Round(value.Value / this.StepSize.Value, 0)) * this.StepSize.Value;
     37    }
     38
     39    public bool IsInRange(double value) {
     40      return value <= this.UpperBound.Value && value >= this.LowerBound.Value;
     41    }
     42
    3543    public override IEnumerable<PercentValue> GetCombinations() {
    3644      var solutions = new List<PercentValue>();
    37       double value = ((int)Math.Round(LowerBound.Value / StepSize.Value, 0)) * StepSize.Value;
    38       if (value < LowerBound.Value) value += StepSize.Value;
     45      double value = LowerBound.Value;
    3946
    4047      while (value <= UpperBound.Value) {
Note: See TracChangeset for help on using the changeset viewer.