Free cookie consent management tool by TermsFeed Policy Generator

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

Renamed classes of HeuristicLab.Data (#909)

Location:
trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers
Files:
11 edited

Legend:

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

    r3017 r3048  
    4545    /// <param name="parents">The list of parents.</param>
    4646    /// <returns>The child vector (average) of the parents.</returns>
    47     public static DoubleArrayData Apply(IRandom random, ItemArray<DoubleArrayData> parents) {
     47    public static DoubleArray Apply(IRandom random, ItemArray<DoubleArray> parents) {
    4848      int length = parents[0].Length, parentsCount = parents.Length;
    4949      if (parents.Length < 2) throw new ArgumentException("AverageCrossover: The number of parents is less than 2.", "parents");
    50       DoubleArrayData result = new DoubleArrayData(length);
     50      DoubleArray result = new DoubleArray(length);
    5151      try {
    5252        double avg;
     
    6565
    6666    /// <summary>
    67     /// Forwards the call to <see cref="Apply(IRandom, ItemArray<DoubleArrayData>)"/>.
     67    /// Forwards the call to <see cref="Apply(IRandom, ItemArray<DoubleArray>)"/>.
    6868    /// </summary>
    6969    /// <param name="random">The random number generator.</param>
    7070    /// <param name="parents">The list of parents.</param>
    7171    /// <returns>The child vector (average) of the parents.</returns>
    72     protected override DoubleArrayData Cross(IRandom random, ItemArray<DoubleArrayData> parents) {
     72    protected override DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
    7373      return Apply(random, parents);
    7474    }
  • trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/BlendAlphaBetaCrossover.cs

    r3017 r3048  
    4343    /// Whether the problem is a maximization or minimization problem.
    4444    /// </summary>
    45     public ValueLookupParameter<BoolData> MaximizationParameter {
    46       get { return (ValueLookupParameter<BoolData>)Parameters["Maximization"]; }
     45    public ValueLookupParameter<BoolValue> MaximizationParameter {
     46      get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
    4747    }
    4848    /// <summary>
    4949    /// The quality of the parents.
    5050    /// </summary>
    51     public SubScopesLookupParameter<DoubleData> QualityParameter {
    52       get { return (SubScopesLookupParameter<DoubleData>)Parameters["Quality"]; }
     51    public SubScopesLookupParameter<DoubleValue> QualityParameter {
     52      get { return (SubScopesLookupParameter<DoubleValue>)Parameters["Quality"]; }
    5353    }
    5454    /// <summary>
    5555    /// The alpha parameter specifies how much the interval between the parents should be extended in direction of the better parent.
    5656    /// </summary>
    57     public ValueLookupParameter<DoubleData> AlphaParameter {
    58       get { return (ValueLookupParameter<DoubleData>)Parameters["Alpha"]; }
     57    public ValueLookupParameter<DoubleValue> AlphaParameter {
     58      get { return (ValueLookupParameter<DoubleValue>)Parameters["Alpha"]; }
    5959    }
    6060    /// <summary>
    6161    /// The beta parameter specifies how much the interval between the parents should be extended in direction of the worse parent.
    6262    /// </summary>
    63     public ValueLookupParameter<DoubleData> BetaParameter {
    64       get { return (ValueLookupParameter<DoubleData>)Parameters["Beta"]; }
     63    public ValueLookupParameter<DoubleValue> BetaParameter {
     64      get { return (ValueLookupParameter<DoubleValue>)Parameters["Beta"]; }
    6565    }
    6666
     
    7171    public BlendAlphaBetaCrossover()
    7272      : base() {
    73       Parameters.Add(new ValueLookupParameter<BoolData>("Maximization", "Whether the problem is a maximization problem or not."));
    74       Parameters.Add(new SubScopesLookupParameter<DoubleData>("Quality", "The quality values of the parents."));
    75       Parameters.Add(new ValueLookupParameter<DoubleData>("Alpha", "The value for alpha.", new DoubleData(0.75)));
    76       Parameters.Add(new ValueLookupParameter<DoubleData>("Beta", "The value for beta.", new DoubleData(0.25)));
     73      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "Whether the problem is a maximization problem or not."));
     74      Parameters.Add(new SubScopesLookupParameter<DoubleValue>("Quality", "The quality values of the parents."));
     75      Parameters.Add(new ValueLookupParameter<DoubleValue>("Alpha", "The value for alpha.", new DoubleValue(0.75)));
     76      Parameters.Add(new ValueLookupParameter<DoubleValue>("Beta", "The value for beta.", new DoubleValue(0.25)));
    7777    }
    7878
     
    9494    /// <param name="beta">The parameter beta.</param>
    9595    /// <returns>The real vector that results from the crossover.</returns>
    96     public static DoubleArrayData Apply(IRandom random, DoubleArrayData betterParent, DoubleArrayData worseParent, DoubleData alpha, DoubleData beta) {
     96    public static DoubleArray Apply(IRandom random, DoubleArray betterParent, DoubleArray worseParent, DoubleValue alpha, DoubleValue beta) {
    9797      if (betterParent.Length != worseParent.Length) throw new ArgumentException("BlendAlphaBetaCrossover: The parents' vectors are of different length.", "betterParent");
    9898      if (alpha.Value < 0) throw new ArgumentException("BlendAlphaBetaCrossover: Parameter alpha must be greater or equal to 0.", "alpha");
     
    100100      int length = betterParent.Length;
    101101      double min, max, d;
    102       DoubleArrayData result = new DoubleArrayData(length);
     102      DoubleArray result = new DoubleArray(length);
    103103
    104104      for (int i = 0; i < length; i++) {
     
    117117
    118118    /// <summary>
    119     /// Checks if the number of parents is equal to 2, if all parameters are available and forwards the call to <see cref="Apply(IRandom, DoubleArrayData, DoubleArrayData, DoubleData, DoubleData)"/>.
     119    /// Checks if the number of parents is equal to 2, if all parameters are available and forwards the call to <see cref="Apply(IRandom, DoubleArray, DoubleArray, DoubleValue, DoubleValue)"/>.
    120120    /// </summary>
    121121    /// <exception cref="ArgumentException">Thrown when the number of parents is not equal to 2.</exception>
     
    132132    /// <param name="parents">The collection of parents (must be of size 2).</param>
    133133    /// <returns>The real vector that results from the crossover.</returns>
    134     protected override DoubleArrayData Cross(IRandom random, ItemArray<DoubleArrayData> parents) {
     134    protected override DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
    135135      if (parents.Length != 2) throw new ArgumentException("BlendAlphaBetaCrossover: Number of parents is not equal to 2.", "parents");
    136136      if (MaximizationParameter.ActualValue == null) throw new InvalidOperationException("BlendAlphaBetaCrossover: Parameter " + MaximizationParameter.ActualName + " could not be found.");
     
    138138      if (AlphaParameter.ActualValue == null || BetaParameter.ActualValue == null) throw new InvalidOperationException("BlendAlphaBetaCrossover: Parameter " + AlphaParameter.ActualName + " or paramter " + BetaParameter.ActualName + " could not be found.");
    139139     
    140       ItemArray<DoubleData> qualities = QualityParameter.ActualValue;
     140      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
    141141      bool maximization = MaximizationParameter.ActualValue.Value;
    142142      // the better parent
  • trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/BlendAlphaCrossover.cs

    r3017 r3048  
    4545    /// values left and right of the min and max value for each gene.
    4646    /// </summary>
    47     public ValueLookupParameter<DoubleData> AlphaParameter {
    48       get { return (ValueLookupParameter<DoubleData>)Parameters["Alpha"]; }
     47    public ValueLookupParameter<DoubleValue> AlphaParameter {
     48      get { return (ValueLookupParameter<DoubleValue>)Parameters["Alpha"]; }
    4949    }
    5050    /// <summary>
     
    5353    public BlendAlphaCrossover()
    5454      : base() {
    55       Parameters.Add(new ValueLookupParameter<DoubleData>("Alpha", "Value for alpha", new DoubleData(0.5)));
     55      Parameters.Add(new ValueLookupParameter<DoubleValue>("Alpha", "Value for alpha", new DoubleValue(0.5)));
    5656    }
    5757
     
    7070    /// <param name="alpha">The alpha value for the crossover.</param>
    7171    /// <returns>The newly created real vector resulting from the crossover operation.</returns>
    72     public static DoubleArrayData Apply(IRandom random, DoubleArrayData parent1, DoubleArrayData parent2, DoubleData alpha) {
     72    public static DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2, DoubleValue alpha) {
    7373      if (parent1.Length != parent2.Length) throw new ArgumentException("BlendAlphaCrossover: The parents' vectors are of different length.", "parent1");
    7474      if (alpha.Value < 0) throw new ArgumentException("BlendAlphaCrossover: Paramter alpha must be greater or equal than 0.", "alpha");
    7575      int length = parent1.Length;
    76       DoubleArrayData result = new DoubleArrayData(length);
     76      DoubleArray result = new DoubleArray(length);
    7777      double max = 0, min = 0, d = 0, resMin = 0, resMax = 0;
    7878
     
    9090
    9191    /// <summary>
    92     /// Checks that the number of parents is equal to 2 and forwards the call to <see cref="Apply(IRandom, DoubleArrayData, DoubleArrayData, DoubleData)"/>.
     92    /// Checks that the number of parents is equal to 2 and forwards the call to <see cref="Apply(IRandom, DoubleArray, DoubleArray, DoubleValue)"/>.
    9393    /// </summary>
    9494    /// <exception cref="ArgumentException">Thrown when the number of parents is not equal to 2.</exception>
     
    9797    /// <param name="parents">The collection of parents (must be of size 2).</param>
    9898    /// <returns>The real vector resulting from the crossover operation.</returns>
    99     protected override DoubleArrayData Cross(IRandom random, ItemArray<DoubleArrayData> parents) {
     99    protected override DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
    100100      if (parents.Length != 2) throw new ArgumentException("BlendAlphaCrossover: The number of parents is not equal to 2", "parents");
    101101      if (AlphaParameter.ActualValue == null) throw new InvalidOperationException("BlendAlphaCrossover: Parameter " + AlphaParameter.ActualName + " could not be found.");
  • trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/DiscreteCrossover.cs

    r3017 r3048  
    4545    /// <param name="parents">An array containing the parents that should be crossed.</param>
    4646    /// <returns>The newly created real vector, resulting from the crossover operation.</returns>
    47     public static DoubleArrayData Apply(IRandom random, ItemArray<DoubleArrayData> parents) {
     47    public static DoubleArray Apply(IRandom random, ItemArray<DoubleArray> parents) {
    4848      int length = parents[0].Length;
    4949     
     
    5353      }
    5454     
    55       DoubleArrayData result = new DoubleArrayData(length);
     55      DoubleArray result = new DoubleArray(length);
    5656      for (int i = 0; i < length; i++) {
    5757        result[i] = parents[random.Next(parents.Length)][i];
     
    6262
    6363    /// <summary>
    64     /// Checks number of parents and forwards the call to <see cref="Apply(IRandom, ItemArray<DoubleArrayData>)"/>.
     64    /// Checks number of parents and forwards the call to <see cref="Apply(IRandom, ItemArray<DoubleArray>)"/>.
    6565    /// </summary>
    6666    /// <exception cref="ArgumentException">Thrown when <paramref name="parents"/> contains less than 2 elements.</exception>
     
    6868    /// <param name="parents">The collection of parents (must be of size 2 or greater).</param>
    6969    /// <returns>The real vector resulting from the crossover.</returns>
    70     protected override DoubleArrayData Cross(IRandom random, ItemArray<DoubleArrayData> parents) {
     70    protected override DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
    7171      if (parents.Length < 2) throw new ArgumentException("DiscreteCrossover: The number of parents is less than 2.", "parents");
    7272      return Apply(random, parents);
  • trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/HeuristicCrossover.cs

    r3017 r3048  
    4040    /// Whether the problem is a maximization or minimization problem.
    4141    /// </summary>
    42     public ValueLookupParameter<BoolData> MaximizationParameter {
    43       get { return (ValueLookupParameter<BoolData>)Parameters["Maximization"]; }
     42    public ValueLookupParameter<BoolValue> MaximizationParameter {
     43      get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
    4444    }
    4545    /// <summary>
    4646    /// The quality of the parents.
    4747    /// </summary>
    48     public SubScopesLookupParameter<DoubleData> QualityParameter {
    49       get { return (SubScopesLookupParameter<DoubleData>)Parameters["Quality"]; }
     48    public SubScopesLookupParameter<DoubleValue> QualityParameter {
     49      get { return (SubScopesLookupParameter<DoubleValue>)Parameters["Quality"]; }
    5050    }
    5151
     
    5656    public HeuristicCrossover()
    5757      : base() {
    58       Parameters.Add(new ValueLookupParameter<BoolData>("Maximization", "Whether the problem is a maximization problem or not."));
    59       Parameters.Add(new SubScopesLookupParameter<DoubleData>("Quality", "The quality values of the parents."));
     58      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "Whether the problem is a maximization problem or not."));
     59      Parameters.Add(new SubScopesLookupParameter<DoubleValue>("Quality", "The quality values of the parents."));
    6060    }
    6161
     
    6868    /// <param name="worseParent">The second parent for the crossover operation.</param>
    6969    /// <returns>The newly created real vector, resulting from the heuristic crossover.</returns>
    70     public static DoubleArrayData Apply(IRandom random, DoubleArrayData betterParent, DoubleArrayData worseParent) {
     70    public static DoubleArray Apply(IRandom random, DoubleArray betterParent, DoubleArray worseParent) {
    7171      if (betterParent.Length != worseParent.Length)
    7272        throw new ArgumentException("HeuristicCrossover: the two parents are not of the same length");
     
    7979        result[i] = betterParent[i] + factor * (betterParent[i] - worseParent[i]);
    8080      }
    81       return new DoubleArrayData(result);
     81      return new DoubleArray(result);
    8282    }
    8383
     
    9696    /// <param name="parents">An array containing the two real vectors that should be crossed.</param>
    9797    /// <returns>The newly created real vector, resulting from the crossover operation.</returns>
    98     protected override DoubleArrayData Cross(IRandom random, ItemArray<DoubleArrayData> parents) {
     98    protected override DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
    9999      if (parents.Length != 2) throw new ArgumentException("HeuristicCrossover: The number of parents is not equal to 2");
    100100
     
    102102      if (QualityParameter.ActualValue == null || QualityParameter.ActualValue.Length != parents.Length) throw new InvalidOperationException("HeuristicCrossover: Parameter " + QualityParameter.ActualName + " could not be found, or not in the same quantity as there are parents.");
    103103
    104       ItemArray<DoubleData> qualities = QualityParameter.ActualValue;
     104      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
    105105      bool maximization = MaximizationParameter.ActualValue.Value;
    106106
  • trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/LocalCrossover.cs

    r3017 r3048  
    4343    /// <param name="parent2">The second parent for the crossover operation.</param>
    4444    /// <returns>The newly created real vector, resulting from the local crossover.</returns>
    45     public static DoubleArrayData Apply(IRandom random, DoubleArrayData parent1, DoubleArrayData parent2) {
     45    public static DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2) {
    4646      if (parent1.Length != parent2.Length)
    4747        throw new ArgumentException("LocalCrossover: the two parents are not of the same length");
     
    5555        result[i] = (factor * parent1[i]) + ((1 - factor) * parent2[i]);
    5656      }
    57       return new DoubleArrayData(result);
     57      return new DoubleArray(result);
    5858    }
    5959
     
    6565    /// <param name="parents">An array containing the two real vectors that should be crossed.</param>
    6666    /// <returns>The newly created real vector, resulting from the crossover operation.</returns>
    67     protected override DoubleArrayData Cross(IRandom random, ItemArray<DoubleArrayData> parents) {
     67    protected override DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
    6868      if (parents.Length != 2) throw new ArgumentException("LocalCrossover: The number of parents is not equal to 2");
    6969      return Apply(random, parents[0], parents[1]);
  • trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/RandomConvexCrossover.cs

    r3017 r3048  
    4343    /// <param name="parent2">The second parent vector for the crossover.</param>
    4444    /// <returns>The newly created real vector, resulting from the random convex crossover.</returns>
    45     public static DoubleArrayData Apply(IRandom random, DoubleArrayData parent1, DoubleArrayData parent2) {
     45    public static DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2) {
    4646      if (parent1.Length != parent2.Length)
    4747        throw new ArgumentException("ERROR in RandomConvexCrossover: the two parents are not of the same length");
     
    5353      for (int i = 0; i < length; i++)
    5454        result[i] = (factor * parent1[i]) + ((1 - factor) * parent2[i]);
    55       return new DoubleArrayData(result);
     55      return new DoubleArray(result);
    5656    }
    5757
     
    6363    /// <param name="parents">An array containing the two real vectors that should be crossed.</param>
    6464    /// <returns>The newly created real vector, resulting from the crossover operation.</returns>
    65     protected override DoubleArrayData Cross(IRandom random, ItemArray<DoubleArrayData> parents) {
     65    protected override DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
    6666      if (parents.Length != 2) throw new ArgumentException("ERROR in RandomConvexCrossover: The number of parents is not equal to 2");
    6767      return Apply(random, parents[0], parents[1]);
  • trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/SimulatedBinaryCrossover.cs

    r3017 r3048  
    4040    /// The parameter must be greater or equal than 0. Common values are in the range [0;5] and more often just [2;5].
    4141    /// </summary>
    42     public ValueLookupParameter<DoubleData> ContiguityParameter {
    43       get { return (ValueLookupParameter<DoubleData>)Parameters["Contiguity"]; }
     42    public ValueLookupParameter<DoubleValue> ContiguityParameter {
     43      get { return (ValueLookupParameter<DoubleValue>)Parameters["Contiguity"]; }
    4444    }
    4545
     
    5050    public SimulatedBinaryCrossover()
    5151      : base() {
    52       Parameters.Add(new ValueLookupParameter<DoubleData>("Contiguity", "Specifies whether the crossover should produce very different (small value) or very similar (large value) children. Valid values must be greater or equal to 0.", new DoubleData(2)));
     52      Parameters.Add(new ValueLookupParameter<DoubleValue>("Contiguity", "Specifies whether the crossover should produce very different (small value) or very similar (large value) children. Valid values must be greater or equal to 0.", new DoubleValue(2)));
    5353    }
    5454
     
    6666    /// <param name="contiguity">The contiguity value that specifies how close a child should be to its parents (larger value means closer). The value must be greater or equal than 0. Typical values are in the range [2;5].</param>
    6767    /// <returns>The vector resulting from the crossover.</returns>
    68     public static DoubleArrayData Apply(IRandom random, DoubleArrayData parent1, DoubleArrayData parent2, DoubleData contiguity) {
     68    public static DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2, DoubleValue contiguity) {
    6969      if (parent1.Length != parent2.Length) throw new ArgumentException("SimulatedBinaryCrossover: Parents are of unequal length");
    7070      if (contiguity.Value < 0) throw new ArgumentException("SimulatedBinaryCrossover: Contiguity value is smaller than 0", "contiguity");
    7171      int length = parent1.Length;
    72       DoubleArrayData result = new DoubleArrayData(length);
     72      DoubleArray result = new DoubleArray(length);
    7373      for (int i = 0; i < length; i++) {
    7474        if (length == 1 || random.NextDouble() < 0.5) { // cross this variable
     
    9292
    9393    /// <summary>
    94     /// Checks number of parents, availability of the parameters and forwards the call to <see cref="Apply(IRandom, DoubleArrayData, DoubleArrayData, DoubleData)"/>.
     94    /// Checks number of parents, availability of the parameters and forwards the call to <see cref="Apply(IRandom, DoubleArray, DoubleArray, DoubleValue)"/>.
    9595    /// </summary>
    9696    /// <exception cref="ArgumentException">Thrown when there are not exactly 2 parents or when the contiguity parameter could not be found.</exception>
     
    9898    /// <param name="parents">The collection of parents (must be of size 2).</param>
    9999    /// <returns>The real vector resulting from the crossover.</returns>
    100     protected override DoubleArrayData Cross(IRandom random, ItemArray<DoubleArrayData> parents) {
     100    protected override DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
    101101      if (parents.Length != 2) throw new ArgumentException("SimulatedBinaryCrossover: The number of parents is not equal to 2");
    102102      if (ContiguityParameter.ActualValue == null) throw new InvalidOperationException("SimulatedBinaryCrossover: Parameter " + ContiguityParameter.ActualName + " could not be found.");
  • trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/SinglePointCrossover.cs

    r3017 r3048  
    4646    /// <param name="parent2">The second parent for crossover.</param>
    4747    /// <returns>The newly created real vector, resulting from the single point crossover.</returns>
    48     public static DoubleArrayData Apply(IRandom random, DoubleArrayData parent1, DoubleArrayData parent2) {
     48    public static DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2) {
    4949      if (parent1.Length != parent2.Length) throw new ArgumentException("SinglePointCrossover: Parents are of unequal length");
    5050      int length = parent1.Length;
    51       DoubleArrayData result = new DoubleArrayData(length);
     51      DoubleArray result = new DoubleArray(length);
    5252      int breakPoint = random.Next(1, length - 1);
    5353
     
    6161
    6262    /// <summary>
    63     /// Checks number of parents and forwards the call to <see cref="Apply(IRandom, DoubleArrayData, DoubleArrayData)"/>.
     63    /// Checks number of parents and forwards the call to <see cref="Apply(IRandom, DoubleArray, DoubleArray)"/>.
    6464    /// </summary>
    6565    /// <exception cref="ArgumentException">Thrown when the parents' vectors are of unequal length or when <paramref name="contiguity"/> is smaller than 0.</exception>
     
    6767    /// <param name="parents">The list of parents.</param>
    6868    /// <returns>A new real vector.</returns>
    69     protected override HeuristicLab.Data.DoubleArrayData Cross(IRandom random, ItemArray<DoubleArrayData> parents) {
     69    protected override HeuristicLab.Data.DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
    7070      if (parents.Length != 2) throw new ArgumentException("SinglePointCrossover: The number of parents is not equal to 2");
    7171      return Apply(random, parents[0], parents[1]);
  • trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/UniformAllPositionsArithmeticCrossover.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
     
    4949    public UniformAllPositionsArithmeticCrossover()
    5050      : base() {
    51       Parameters.Add(new ValueLookupParameter<DoubleData>("Alpha", "The alpha value in the range [0;1]", new DoubleData(0.33)));
     51      Parameters.Add(new ValueLookupParameter<DoubleValue>("Alpha", "The alpha value in the range [0;1]", new DoubleValue(0.33)));
    5252    }
    5353
     
    6161    /// <param name="alpha">The alpha parameter (<see cref="AlphaParameter"/>).</param>
    6262    /// <returns>The vector resulting from the crossover.</returns>
    63     public static DoubleArrayData Apply(IRandom random, DoubleArrayData parent1, DoubleArrayData parent2, DoubleData alpha) {
     63    public static DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2, DoubleValue alpha) {
    6464      int length = parent1.Length;
    6565      if (length != parent2.Length) throw new ArgumentException("UniformAllPositionsArithmeticCrossover: The parent vectors are of different length.", "parent1");
    6666      if (alpha.Value < 0 || alpha.Value > 1) throw new ArgumentException("UniformAllPositionsArithmeticCrossover: Parameter alpha must be in the range [0;1]", "alpha");
    67       DoubleArrayData result = new DoubleArrayData(length);
     67      DoubleArray result = new DoubleArray(length);
    6868      for (int i = 0; i < length; i++) {
    6969        result[i] = alpha.Value * parent1[i] + (1 - alpha.Value) * parent2[i];
     
    7373
    7474    /// <summary>
    75     /// Checks that there are exactly 2 parents, that the alpha parameter is not null and fowards the call to <see cref="Apply(IRandom, DoubleArrayData, DoubleArrrayData, DoubleData)"/>.
     75    /// Checks that there are exactly 2 parents, that the alpha parameter is not null and fowards the call to <see cref="Apply(IRandom, DoubleArray, DoubleArrrayData, DoubleValue)"/>.
    7676    /// </summary>
    7777    /// <exception cref="ArgumentException">Thrown when there are not exactly two parents.</exception>
     
    8080    /// <param name="parents">The collection of parents (must be of size 2).</param>
    8181    /// <returns>The vector resulting from the crossover.</returns>
    82     protected override DoubleArrayData Cross(IRandom random, ItemArray<DoubleArrayData> parents) {
     82    protected override DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
    8383      if (parents.Length != 2) throw new ArgumentException("UniformAllPositionsArithmeticCrossover: There must be exactly two parents.", "parents");
    8484      if (AlphaParameter.ActualValue == null) throw new InvalidOperationException("UniformAllPositionsArithmeticCrossover: Parameter " + AlphaParameter.ActualName + " could not be found.");
  • 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.