Changeset 3187 for trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/PolynomialOnePositionManipulator.cs
- Timestamp:
- 03/22/10 22:58:43 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/PolynomialOnePositionManipulator.cs
r3060 r3187 47 47 /// </summary> 48 48 /// <remarks> 49 /// The manipulated value is not restricted by the (possibly) specified lower and upper bounds. Use the <see cref="BoundsChecker"/> to correct the values after performing the mutation.49 /// If there are bounds specified the manipulated value is restricted by the given lower and upper bounds. 50 50 /// </remarks> 51 51 public ValueLookupParameter<DoubleValue> MaximumManipulationParameter { … … 73 73 if (contiguity.Value < 0) throw new ArgumentException("PolynomialOnePositionManipulator: Contiguity value is smaller than 0", "contiguity"); 74 74 int index = random.Next(vector.Length); 75 vector[index] += Apply(random, contiguity.Value) * maxManipulation.Value; 76 } 77 78 public static double Apply(IRandom random, double contiguity) { 75 79 double u = random.NextDouble(), delta = 0; 76 80 77 81 if (u < 0.5) { 78 delta = Math.Pow(2 * u, 1.0 / (contiguity .Value+ 1)) - 1.0;82 delta = Math.Pow(2 * u, 1.0 / (contiguity + 1)) - 1.0; 79 83 } else if (u > 0.5) { 80 delta = 1.0 - Math.Pow(2.0 - 2.0 * u, 1.0 / contiguity .Value+ 1);81 } else if (u == 0.5)delta = 0;84 delta = 1.0 - Math.Pow(2.0 - 2.0 * u, 1.0 / contiguity + 1); 85 } else delta = 0; 82 86 83 vector[index] += delta * maxManipulation.Value;87 return delta; 84 88 } 85 89
Note: See TracChangeset
for help on using the changeset viewer.