Changeset 3691
- Timestamp:
- 05/07/10 02:24:51 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/NormalAllPositionsManipulator.cs
r3450 r3691 75 75 public static void Apply(IRandom random, RealVector vector, RealVector strategyParameters) { 76 76 NormalDistributedRandom N = new NormalDistributedRandom(random, 0.0, 1.0); 77 for (int i = 0; i < vector.Length; i++) { 78 vector[i] = vector[i] + (N.NextDouble() * strategyParameters[i % strategyParameters.Length]); 77 if (strategyParameters != null && strategyParameters.Length > 0) { 78 for (int i = 0; i < vector.Length; i++) { 79 vector[i] = vector[i] + (N.NextDouble() * strategyParameters[i % strategyParameters.Length]); 80 } 81 } else { 82 for (int i = 0; i < vector.Length; i++) { 83 vector[i] = vector[i] + N.NextDouble(); 84 } 79 85 } 80 86 } … … 86 92 /// <param name="realVector">The vector of real values that is manipulated.</param> 87 93 protected override void Manipulate(IRandom random, RealVector realVector) { 88 if (StrategyParameterParameter.ActualValue == null) throw new InvalidOperationException("NormalAllPositionsManipulator: The strategy parameter could not be found and does not have an associated value.");89 94 Apply(random, realVector, StrategyParameterParameter.ActualValue); 90 95 }
Note: See TracChangeset
for help on using the changeset viewer.