Changeset 5381 for trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Moves/StochasticPolynomialMultiMoveGenerator.cs
- Timestamp:
- 01/26/11 18:39:49 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Moves/StochasticPolynomialMultiMoveGenerator.cs
r4722 r5381 62 62 } 63 63 64 public static AdditiveMove[] Apply(IRandom random, RealVector realVector, double contiguity, int sampleSize, double maxManipulation) {64 public static AdditiveMove[] Apply(IRandom random, RealVector vector, double contiguity, int sampleSize, double maxManipulation, DoubleMatrix bounds) { 65 65 AdditiveMove[] moves = new AdditiveMove[sampleSize]; 66 66 for (int i = 0; i < sampleSize; i++) { 67 int index = random.Next(realVector.Length); 68 moves[i] = new AdditiveMove(index, PolynomialOnePositionManipulator.Apply(random, contiguity) * maxManipulation); 67 int index = random.Next(vector.Length); 68 double strength = 0, min = bounds[index % bounds.Rows, 0], max = bounds[index % bounds.Rows, 1]; 69 do { 70 strength = PolynomialOnePositionManipulator.Apply(random, contiguity) * maxManipulation; 71 } while (vector[index] + strength < min || vector[index] + strength > max); 72 moves[i] = new AdditiveMove(index, strength); 69 73 } 70 74 return moves; 71 75 } 72 76 73 protected override AdditiveMove[] GenerateMoves(IRandom random, RealVector realVector ) {74 return Apply(random, realVector, ContiguityParameter.ActualValue.Value, SampleSizeParameter.ActualValue.Value, MaximumManipulationParameter.ActualValue.Value );77 protected override AdditiveMove[] GenerateMoves(IRandom random, RealVector realVector, DoubleMatrix bounds) { 78 return Apply(random, realVector, ContiguityParameter.ActualValue.Value, SampleSizeParameter.ActualValue.Value, MaximumManipulationParameter.ActualValue.Value, bounds); 75 79 } 76 80 }
Note: See TracChangeset
for help on using the changeset viewer.