Changeset 7681 for branches/IntegerVectorEncoding/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorCreator.cs
- Timestamp:
- 04/02/12 00:29:39 (12 years ago)
- Location:
- branches/IntegerVectorEncoding/HeuristicLab.Encodings.IntegerVectorEncoding
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/IntegerVectorEncoding/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorCreator.cs
r7259 r7681 47 47 get { return (IValueLookupParameter<IntValue>)Parameters["Length"]; } 48 48 } 49 public IValueLookupParameter<IntValue> MinimumParameter { 50 get { return (IValueLookupParameter<IntValue>)Parameters["Minimum"]; } 51 } 52 public IValueLookupParameter<IntValue> MaximumParameter { 53 get { return (IValueLookupParameter<IntValue>)Parameters["Maximum"]; } 49 public IValueLookupParameter<IntMatrix> BoundsParameter { 50 get { return (IValueLookupParameter<IntMatrix>)Parameters["Bounds"]; } 54 51 } 55 52 … … 62 59 Parameters.Add(new LookupParameter<IntegerVector>("IntegerVector", "The vector which should be manipulated.")); 63 60 Parameters.Add(new ValueLookupParameter<IntValue>("Length", "The length of the vector.")); 64 Parameters.Add(new ValueLookupParameter<IntValue>("Minimum", "The inclusive lower bound for each element in the vector.")); 65 Parameters.Add(new ValueLookupParameter<IntValue>("Maximum", "The exclusive upper bound for each element in the vector.")); 61 Parameters.Add(new ValueLookupParameter<IntMatrix>("Bounds", "The bounds matrix can contain one row for each dimension with three columns specifying minimum (inclusive), maximum (exclusive), and step size. If less rows are given the matrix is cycled.")); 66 62 } 67 63 64 // BackwardsCompatibility3.3 65 #region Backwards compatible code, remove with 3.4 66 [StorableHook(HookType.AfterDeserialization)] 67 private void AfterDeserialization() { 68 if (!Parameters.ContainsKey("Bounds")) { 69 Parameters.Remove("Minimum"); 70 Parameters.Remove("Maximum"); 71 Parameters.Add(new ValueLookupParameter<IntMatrix>("Bounds", "The bounds matrix can contain one row for each dimension with three columns specifying minimum (inclusive), maximum (inclusive), and step size. If less rows are given the matrix is cycled.")); 72 } 73 } 74 #endregion 75 68 76 public sealed override IOperation Apply() { 69 IntegerVectorParameter.ActualValue = Create(RandomParameter.ActualValue, LengthParameter.ActualValue, MinimumParameter.ActualValue, MaximumParameter.ActualValue);77 IntegerVectorParameter.ActualValue = Create(RandomParameter.ActualValue, LengthParameter.ActualValue, BoundsParameter.ActualValue); 70 78 return base.Apply(); 71 79 } 72 80 73 protected abstract IntegerVector Create(IRandom random, IntValue length, Int Value minimum, IntValue maximum);81 protected abstract IntegerVector Create(IRandom random, IntValue length, IntMatrix bounds); 74 82 } 75 83 }
Note: See TracChangeset
for help on using the changeset viewer.