Changeset 5207 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators
- Timestamp:
- 01/04/11 02:18:27 (14 years ago)
- 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 36 36 37 37 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 } 43 50 } 44 51 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/UniformDoubleValueManipulator.cs
r5111 r5207 36 36 37 37 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); 39 40 var bounds = new DoubleMatrix(1, 2); 40 41 bounds[0, 0] = range.LowerBound.Value; 41 42 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 } 45 52 } 46 53 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/UniformIntValueManipulator.cs
r5111 r5207 37 37 38 38 public static void ApplyStatic(IRandom random, IntValue value, IntValueRange range) { 39 bool ok = false; 39 40 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 } 43 50 } 44 51 }
Note: See TracChangeset
for help on using the changeset viewer.