Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/04/11 02:18:27 (14 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
Location:
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/NormalDoubleValueManipulator.cs

    r5111 r5207  
    3636
    3737    public static void ApplyStatic(IRandom random, DoubleValue value, DoubleValueRange range) {
    38       var vector = new RealVector(new double[] { value.Value });
    39       var strategy = new RealVector(new double[] { (range.UpperBound.Value - range.LowerBound.Value) / 5});
    40       NormalAllPositionsManipulator.Apply(random, vector, strategy);
    41       value.Value = vector[0];
    42       range.Fix(value);
     38      bool ok = false;
     39      RealVector strategy = new RealVector(new double[] { (range.UpperBound.Value - range.LowerBound.Value) / 15});
     40      RealVector vector = new RealVector(1);
     41      double val = value.Value;
     42
     43      while (!ok) {
     44        vector[0] = val;
     45        NormalAllPositionsManipulator.Apply(random, vector, strategy);
     46        value.Value = vector[0];
     47        range.ApplyStepSize(value);
     48        ok = range.IsInRange(value.Value);
     49      }
    4350    }
    4451  }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/UniformDoubleValueManipulator.cs

    r5111 r5207  
    3636
    3737    public static void ApplyStatic(IRandom random, DoubleValue value, DoubleValueRange range) {
    38       var vector = new RealVector(new double[] { value.Value });
     38      bool ok = false;
     39      var vector = new RealVector(1);
    3940      var bounds = new DoubleMatrix(1, 2);
    4041      bounds[0, 0] = range.LowerBound.Value;
    4142      bounds[0, 1] = range.UpperBound.Value;
    42       UniformOnePositionManipulator.Apply(random, vector, bounds);
    43       value.Value = vector[0];
    44       range.Fix(value);
     43      double val = value.Value;
     44
     45      while (!ok) {
     46        vector[0] = val;
     47        UniformOnePositionManipulator.Apply(random, vector, bounds);
     48        value.Value = vector[0];
     49        range.ApplyStepSize(value);
     50        ok = range.IsInRange(value.Value);
     51      }
    4552    }
    4653  }
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/UniformIntValueManipulator.cs

    r5111 r5207  
    3737
    3838    public static void ApplyStatic(IRandom random, IntValue value, IntValueRange range) {
     39      bool ok = false;
    3940      var vector = new IntegerVector(new int[] { value.Value });
    40       UniformOnePositionManipulator.Apply(random, vector, range.LowerBound, new IntValue(range.UpperBound.Value + 1));
    41       value.Value = vector[0];
    42       range.Fix(value);
     41      int val = value.Value;
     42
     43      while (!ok) {
     44        vector[0] = val;
     45        UniformOnePositionManipulator.Apply(random, vector, range.LowerBound, new IntValue(range.UpperBound.Value + 1));
     46        value.Value = vector[0];
     47        range.ApplyStepSize(value);
     48        ok = range.IsInRange(value.Value);
     49      }
    4350    }
    4451  }
Note: See TracChangeset for help on using the changeset viewer.