Changeset 8206 for branches/GP-MoveOperators/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/BoundedIntegerVectorManipulator.cs
- Timestamp:
- 07/03/12 16:46:35 (12 years ago)
- Location:
- branches/GP-MoveOperators
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-MoveOperators
- Property svn:mergeinfo changed
/trunk/sources merged: 8084,8088-8090,8092-8100,8102-8113,8115,8117-8132,8134-8146,8148-8156,8158-8160,8163-8170,8173-8176,8178-8190,8192-8205
- Property svn:mergeinfo changed
-
branches/GP-MoveOperators/HeuristicLab.Encodings.IntegerVectorEncoding
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding merged: 8184-8185
- Property svn:mergeinfo changed
-
branches/GP-MoveOperators/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/BoundedIntegerVectorManipulator.cs
r8085 r8206 31 31 [StorableClass] 32 32 public abstract class BoundedIntegerVectorManipulator : IntegerVectorManipulator, IBoundedIntegerVectorOperator { 33 33 34 34 public IValueLookupParameter<IntMatrix> BoundsParameter { 35 35 get { return (IValueLookupParameter<IntMatrix>)Parameters["Bounds"]; } … … 45 45 46 46 protected sealed override void Manipulate(IRandom random, IntegerVector integerVector) { 47 if (BoundsParameter.ActualValue == null) throw new InvalidOperationException(" UniformSomePositionsManipulator: Parameter " + BoundsParameter.ActualName + " could not be found.");47 if (BoundsParameter.ActualValue == null) throw new InvalidOperationException("BoundedIntegerVectorManipulator: Parameter " + BoundsParameter.ActualName + " could not be found."); 48 48 ManipulateBounded(random, integerVector, BoundsParameter.ActualValue); 49 49 } 50 50 51 51 protected abstract void ManipulateBounded(IRandom random, IntegerVector integerVector, IntMatrix bounds); 52 53 protected static int RoundFeasible(int min, int max, int step, double value) {54 return Math.Max(min, Math.Min(max, (int)Math.Round((value - min) / (double)step) * step + min));55 }56 protected static int FloorFeasible(int min, int max, int step, double value) {57 return Math.Max(min, Math.Min(max, (int)Math.Floor((value - min) / (double)step) * step + min));58 }59 protected static int CeilingFeasible(int min, int max, int step, double value) {60 return Math.Max(min, Math.Min(max, (int)Math.Ceiling((value - min) / (double)step) * step + min));61 }62 52 } 63 53 }
Note: See TracChangeset
for help on using the changeset viewer.