Changeset 8790 for trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Manipulators/UniformOnePositionManipulator.cs
- Timestamp:
- 10/11/12 13:37:56 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Manipulators/UniformOnePositionManipulator.cs
r8019 r8790 85 85 if (bounds == null || bounds.Rows == 0 || bounds.Columns < 2) throw new ArgumentException("UniformOnePositionManipulator: Invalid bounds specified", "bounds"); 86 86 int min = bounds[index % bounds.Rows, 0], max = bounds[index % bounds.Rows, 1], step = 1; 87 if (bounds.Columns > 2) step = bounds[index % bounds.Rows, 2]; 88 vector[index] = RoundFeasible(min, max, step, random.Next(min, max + 1)); 87 if (min == max) { 88 vector[index] = min; 89 } else { 90 if (bounds.Columns > 2) step = bounds[index % bounds.Rows, 2]; 91 // max has to be rounded to the lower feasible value 92 // e.g. min...max / step = 0...100 / 5, max is exclusive so it would be 0..99 93 // but 99 is not a feasible value, so max needs to be adjusted => min = 0, max = 95 94 max = FloorFeasible(min, max, step, max - 1); 95 vector[index] = RoundFeasible(min, max, step, random.Next(min, max)); 96 } 89 97 } 90 98
Note: See TracChangeset
for help on using the changeset viewer.