Changeset 5381 for trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/RealVectorManipulator.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/RealVectorManipulator.cs
r4722 r5381 48 48 get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; } 49 49 } 50 public OptionalValueParameter<IRealVectorBoundsChecker> BoundsCheckerParameter { 51 get { return (OptionalValueParameter<IRealVectorBoundsChecker>)Parameters["BoundsChecker"]; } 52 } 50 53 51 54 [StorableConstructor] … … 57 60 Parameters.Add(new LookupParameter<RealVector>("RealVector", "The vector which should be manipulated.")); 58 61 Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds of the real vector.")); 62 Parameters.Add(new OptionalValueParameter<IRealVectorBoundsChecker>("BoundsChecker", "The bounds checker that ensures that the values stay within the bounds.", new BoundsChecker())); 59 63 } 64 65 // BackwardsCompatibility3.3 66 #region Backwards compatible code (remove with 3.4) 67 [StorableHook(HookType.AfterDeserialization)] 68 private void AfterDeserialization() { 69 if (!Parameters.ContainsKey("BoundsChecker")) 70 Parameters.Add(new OptionalValueParameter<IRealVectorBoundsChecker>("BoundsChecker", "The bounds checker that ensures that the values stay within the bounds.", new BoundsChecker())); 71 } 72 #endregion 60 73 61 74 public sealed override IOperation Apply() { 62 75 RealVector vector = RealVectorParameter.ActualValue; 63 76 Manipulate(RandomParameter.ActualValue, vector); 64 DoubleMatrix bounds = BoundsParameter.ActualValue; 65 if (bounds != null) BoundsChecker.Apply(vector, bounds); 66 return base.Apply(); 77 78 IRealVectorBoundsChecker checker = BoundsCheckerParameter.Value; 79 IOperation successor = base.Apply(); 80 if (checker != null) { 81 IOperation checkerOperation = ExecutionContext.CreateChildOperation(checker); 82 if (successor == null) return checkerOperation; 83 else return new OperationCollection(checkerOperation, successor); 84 } else return successor; 67 85 } 68 86
Note: See TracChangeset
for help on using the changeset viewer.