Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/15/10 23:49:54 (14 years ago)
Author:
swagner
Message:

Renamed classes of HeuristicLab.Data (#909)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/UniformSomePositionsArithmeticCrossover.cs

    r3017 r3048  
    4040    /// The alpha parameter needs to be in the interval [0;1] and specifies how close the resulting offspring should be either to parent1 (alpha -> 0) or parent2 (alpha -> 1).
    4141    /// </summary>
    42     public ValueLookupParameter<DoubleData> AlphaParameter {
    43       get { return (ValueLookupParameter<DoubleData>)Parameters["Alpha"]; }
     42    public ValueLookupParameter<DoubleValue> AlphaParameter {
     43      get { return (ValueLookupParameter<DoubleValue>)Parameters["Alpha"]; }
    4444    }
    4545    /// <summary>
    4646    /// The probability in the range [0;1] for each position in the vector to be crossed.
    4747    /// </summary>
    48     public ValueLookupParameter<DoubleData> ProbabilityParameter {
    49       get { return (ValueLookupParameter<DoubleData>)Parameters["Probability"]; }
     48    public ValueLookupParameter<DoubleValue> ProbabilityParameter {
     49      get { return (ValueLookupParameter<DoubleValue>)Parameters["Probability"]; }
    5050    }
    5151
     
    5555    public UniformSomePositionsArithmeticCrossover()
    5656      : base() {
    57       Parameters.Add(new ValueLookupParameter<DoubleData>("Alpha", "The alpha value in the range [0;1]", new DoubleData(0.5)));
    58       Parameters.Add(new ValueLookupParameter<DoubleData>("Probability", "The probability for crossing a position in the range [0;1]", new DoubleData(0.5)));
     57      Parameters.Add(new ValueLookupParameter<DoubleValue>("Alpha", "The alpha value in the range [0;1]", new DoubleValue(0.5)));
     58      Parameters.Add(new ValueLookupParameter<DoubleValue>("Probability", "The probability for crossing a position in the range [0;1]", new DoubleValue(0.5)));
    5959    }
    6060
     
    6868    /// <param name="probability">The probability parameter (<see cref="ProbabilityParameter"/>).</param>
    6969    /// <returns>The vector resulting from the crossover.</returns>
    70     public static DoubleArrayData Apply(IRandom random, DoubleArrayData parent1, DoubleArrayData parent2, DoubleData alpha, DoubleData probability) {
     70    public static DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2, DoubleValue alpha, DoubleValue probability) {
    7171      int length = parent1.Length;
    7272      if (length != parent2.Length) throw new ArgumentException("UniformSomePositionsArithmeticCrossover: The parent vectors are of different length.", "parent1");
     
    7474      if (probability.Value < 0 || probability.Value > 1) throw new ArgumentException("UniformSomePositionsArithmeticCrossover: Parameter probability must be in the range [0;1]", "probability");
    7575     
    76       DoubleArrayData result = new DoubleArrayData(length);
     76      DoubleArray result = new DoubleArray(length);
    7777      for (int i = 0; i < length; i++) {
    7878        if (random.NextDouble() < probability.Value)
     
    8484
    8585    /// <summary>
    86     /// Checks that there are exactly 2 parents, that the alpha and the probability parameter are not null and fowards the call to <see cref="Apply(IRandom, DoubleArrayData, DoubleArrrayData, DoubleData)"/>.
     86    /// Checks that there are exactly 2 parents, that the alpha and the probability parameter are not null and fowards the call to <see cref="Apply(IRandom, DoubleArray, DoubleArrrayData, DoubleValue)"/>.
    8787    /// </summary>
    8888    /// <exception cref="ArgumentException">Thrown when there are not exactly two parents.</exception>
     
    9191    /// <param name="parents">The collection of parents (must be of size 2).</param>
    9292    /// <returns>The vector resulting from the crossover.</returns>
    93     protected override DoubleArrayData  Cross(IRandom random, ItemArray<DoubleArrayData> parents) {
     93    protected override DoubleArray  Cross(IRandom random, ItemArray<DoubleArray> parents) {
    9494      if (parents.Length != 2) throw new ArgumentException("UniformSomePositionsArithmeticCrossover: There must be exactly two parents.", "parents");
    9595      if (AlphaParameter.ActualValue == null) throw new InvalidOperationException("UniformSomePositionsArithmeticCrossover: Parameter " + AlphaParameter.ActualName + " could not be found.");
Note: See TracChangeset for help on using the changeset viewer.