Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/22/10 22:58:43 (15 years ago)
Author:
abeham
Message:

Added move operators for real encoding and test functions #890

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/PolynomialOnePositionManipulator.cs

    r3060 r3187  
    4747    /// </summary>
    4848    /// <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.
    5050    /// </remarks>
    5151    public ValueLookupParameter<DoubleValue> MaximumManipulationParameter {
     
    7373      if (contiguity.Value < 0) throw new ArgumentException("PolynomialOnePositionManipulator: Contiguity value is smaller than 0", "contiguity");
    7474      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) {
    7579      double u = random.NextDouble(), delta = 0;
    7680
    7781      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;
    7983      } 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;
    8286
    83       vector[index] += delta * maxManipulation.Value;
     87      return delta;
    8488    }
    8589
Note: See TracChangeset for help on using the changeset viewer.