Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3060


Ignore:
Timestamp:
03/16/10 10:46:59 (14 years ago)
Author:
svonolfe
Message:

Updated the RealVector project to use the new solution encodings (#909)

Location:
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3
Files:
40 edited

Legend:

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

    r3053 r3060  
    3535  [StorableClass]
    3636  public class BoundsChecker : SingleSuccessorOperator {
    37     public LookupParameter<DoubleArray> RealVectorParameter {
    38       get { return (LookupParameter<DoubleArray>)Parameters["RealVector"]; }
     37    public LookupParameter<RealVector> RealVectorParameter {
     38      get { return (LookupParameter<RealVector>)Parameters["RealVector"]; }
    3939    }
    4040    public ValueLookupParameter<DoubleValue> MinimumParameter {
     
    5151    public BoundsChecker()
    5252      : base() {
    53       Parameters.Add(new LookupParameter<DoubleArray>("RealVector", "The real-valued vector for which the bounds should be checked."));
     53      Parameters.Add(new LookupParameter<RealVector>("RealVector", "The real-valued vector for which the bounds should be checked."));
    5454      Parameters.Add(new ValueLookupParameter<DoubleValue>("Minimum", "The lower bound for each element in the vector."));
    5555      Parameters.Add(new ValueLookupParameter<DoubleValue>("Maximum", "The upper bound for each element in the vector."));
     
    6464    /// <param name="vector">The vector to check.</param>
    6565    /// <returns>The corrected real vector.</returns>
    66     public static void Apply(DoubleArray vector, DoubleValue min, DoubleValue max) {
     66    public static void Apply(RealVector vector, DoubleValue min, DoubleValue max) {
    6767      for (int i = 0; i < vector.Length; i++) {
    6868        if (vector[i] < min.Value) vector[i] = min.Value;
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Creators/UniformRandomRealVectorCreator.cs

    r3053 r3060  
    5151    /// <param name="max">The maximum value of the sampling range for each vector element (exclusive).</param>
    5252    /// <returns>The newly created real vector.</returns>
    53     public static DoubleArray Apply(IRandom random, int length, double min, double max) {
     53    public static RealVector Apply(IRandom random, int length, double min, double max) {
    5454      if (length <= 0) throw new ArgumentException("UniformRandomRealVectorCreator: Length is smaller or equal to 0.", "length");
    5555      if (min > max) throw new ArgumentException("UniformRandomRealVectorCreator: Minimum is greater than Maximum.", "min");
    56       DoubleArray result = new DoubleArray(length);
     56      RealVector result = new RealVector(length);
    5757      for (int i = 0; i < length; i++)
    5858        result[i] = min + random.NextDouble() * (max - min);
     
    6868    /// <param name="maximum">The maximum value of the sampling range for each vector element (exclusive).</param>
    6969    /// <returns>The newly created real vector.</returns>
    70     protected override DoubleArray Create(IRandom random, IntValue length, DoubleValue minimum, DoubleValue maximum) {
     70    protected override RealVector Create(IRandom random, IntValue length, DoubleValue minimum, DoubleValue maximum) {
    7171      return Apply(random, length.Value, minimum.Value, maximum.Value);
    7272    }
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/AverageCrossover.cs

    r3053 r3060  
    4545    /// <param name="parents">The list of parents.</param>
    4646    /// <returns>The child vector (average) of the parents.</returns>
    47     public static DoubleArray Apply(IRandom random, ItemArray<DoubleArray> parents) {
     47    public static RealVector Apply(IRandom random, ItemArray<RealVector> 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       DoubleArray result = new DoubleArray(length);
     50      RealVector result = new RealVector(length);
    5151      try {
    5252        double avg;
     
    6565
    6666    /// <summary>
    67     /// Forwards the call to <see cref="Apply(IRandom, ItemArray<DoubleArray>)"/>.
     67    /// Forwards the call to <see cref="Apply(IRandom, ItemArray<RealVector>)"/>.
    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 DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
     72    protected override RealVector Cross(IRandom random, ItemArray<RealVector> parents) {
    7373      return Apply(random, parents);
    7474    }
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/BlendAlphaBetaCrossover.cs

    r3053 r3060  
    9494    /// <param name="beta">The parameter beta.</param>
    9595    /// <returns>The real vector that results from the crossover.</returns>
    96     public static DoubleArray Apply(IRandom random, DoubleArray betterParent, DoubleArray worseParent, DoubleValue alpha, DoubleValue beta) {
     96    public static RealVector Apply(IRandom random, RealVector betterParent, RealVector 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       DoubleArray result = new DoubleArray(length);
     102      RealVector result = new RealVector(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, DoubleArray, DoubleArray, DoubleValue, DoubleValue)"/>.
     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, RealVector, RealVector, 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 DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
     134    protected override RealVector Cross(IRandom random, ItemArray<RealVector> 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.");
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/BlendAlphaCrossover.cs

    r3053 r3060  
    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 DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2, DoubleValue alpha) {
     72    public static RealVector Apply(IRandom random, RealVector parent1, RealVector 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       DoubleArray result = new DoubleArray(length);
     76      RealVector result = new RealVector(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, DoubleArray, DoubleArray, DoubleValue)"/>.
     92    /// Checks that the number of parents is equal to 2 and forwards the call to <see cref="Apply(IRandom, RealVector, RealVector, 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 DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
     99    protected override RealVector Cross(IRandom random, ItemArray<RealVector> 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.RealVectorEncoding/3.3/Crossovers/DiscreteCrossover.cs

    r3053 r3060  
    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 DoubleArray Apply(IRandom random, ItemArray<DoubleArray> parents) {
     47    public static RealVector Apply(IRandom random, ItemArray<RealVector> parents) {
    4848      int length = parents[0].Length;
    4949     
     
    5353      }
    5454     
    55       DoubleArray result = new DoubleArray(length);
     55      RealVector result = new RealVector(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<DoubleArray>)"/>.
     64    /// Checks number of parents and forwards the call to <see cref="Apply(IRandom, ItemArray<RealVector>)"/>.
    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 DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
     70    protected override RealVector Cross(IRandom random, ItemArray<RealVector> 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.RealVectorEncoding/3.3/Crossovers/HeuristicCrossover.cs

    r3053 r3060  
    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 DoubleArray Apply(IRandom random, DoubleArray betterParent, DoubleArray worseParent) {
     70    public static RealVector Apply(IRandom random, RealVector betterParent, RealVector 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 DoubleArray(result);
     81      return new RealVector(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 DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
     98    protected override RealVector Cross(IRandom random, ItemArray<RealVector> parents) {
    9999      if (parents.Length != 2) throw new ArgumentException("HeuristicCrossover: The number of parents is not equal to 2");
    100100
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/LocalCrossover.cs

    r3053 r3060  
    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 DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2) {
     45    public static RealVector Apply(IRandom random, RealVector parent1, RealVector 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 DoubleArray(result);
     57      return new RealVector(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 DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
     67    protected override RealVector Cross(IRandom random, ItemArray<RealVector> 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.RealVectorEncoding/3.3/Crossovers/RandomConvexCrossover.cs

    r3053 r3060  
    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 DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2) {
     45    public static RealVector Apply(IRandom random, RealVector parent1, RealVector 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 DoubleArray(result);
     55      return new RealVector(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 DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
     65    protected override RealVector Cross(IRandom random, ItemArray<RealVector> 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.RealVectorEncoding/3.3/Crossovers/SimulatedBinaryCrossover.cs

    r3053 r3060  
    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 DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2, DoubleValue contiguity) {
     68    public static RealVector Apply(IRandom random, RealVector parent1, RealVector 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       DoubleArray result = new DoubleArray(length);
     72      RealVector result = new RealVector(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, DoubleArray, DoubleArray, DoubleValue)"/>.
     94    /// Checks number of parents, availability of the parameters and forwards the call to <see cref="Apply(IRandom, RealVector, RealVector, 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 DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
     100    protected override RealVector Cross(IRandom random, ItemArray<RealVector> 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.RealVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs

    r3053 r3060  
    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 DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2) {
     48    public static RealVector Apply(IRandom random, RealVector parent1, RealVector parent2) {
    4949      if (parent1.Length != parent2.Length) throw new ArgumentException("SinglePointCrossover: Parents are of unequal length");
    5050      int length = parent1.Length;
    51       DoubleArray result = new DoubleArray(length);
     51      RealVector result = new RealVector(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, DoubleArray, DoubleArray)"/>.
     63    /// Checks number of parents and forwards the call to <see cref="Apply(IRandom, RealVector, RealVector)"/>.
    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.DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
     69    protected override RealVector Cross(IRandom random, ItemArray<RealVector> 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.RealVectorEncoding/3.3/Crossovers/UniformAllPositionsArithmeticCrossover.cs

    r3053 r3060  
    6161    /// <param name="alpha">The alpha parameter (<see cref="AlphaParameter"/>).</param>
    6262    /// <returns>The vector resulting from the crossover.</returns>
    63     public static DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2, DoubleValue alpha) {
     63    public static RealVector Apply(IRandom random, RealVector parent1, RealVector 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       DoubleArray result = new DoubleArray(length);
     67      RealVector result = new RealVector(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, DoubleArray, DoubleArrrayData, DoubleValue)"/>.
     75    /// Checks that there are exactly 2 parents, that the alpha parameter is not null and fowards the call to <see cref="Apply(IRandom, RealVector, 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 DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents) {
     82    protected override RealVector Cross(IRandom random, ItemArray<RealVector> 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.RealVectorEncoding/3.3/Crossovers/UniformSomePositionsArithmeticCrossover.cs

    r3053 r3060  
    6868    /// <param name="probability">The probability parameter (<see cref="ProbabilityParameter"/>).</param>
    6969    /// <returns>The vector resulting from the crossover.</returns>
    70     public static DoubleArray Apply(IRandom random, DoubleArray parent1, DoubleArray parent2, DoubleValue alpha, DoubleValue probability) {
     70    public static RealVector Apply(IRandom random, RealVector parent1, RealVector 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       DoubleArray result = new DoubleArray(length);
     76      RealVector result = new RealVector(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, DoubleArray, DoubleArrrayData, DoubleValue)"/>.
     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, RealVector, 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 DoubleArray  Cross(IRandom random, ItemArray<DoubleArray> parents) {
     93    protected override RealVector  Cross(IRandom random, ItemArray<RealVector> 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.");
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Interfaces/IRealVectorCreator.cs

    r3053 r3060  
    3232    IValueLookupParameter<DoubleValue> MinimumParameter { get; }
    3333    IValueLookupParameter<DoubleValue> MaximumParameter { get; }
    34     ILookupParameter<DoubleArray> RealVectorParameter { get; }
     34    ILookupParameter<RealVector> RealVectorParameter { get; }
    3535  }
    3636}
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Interfaces/IRealVectorCrossover.cs

    r3053 r3060  
    2929  /// </summary>
    3030  public interface IRealVectorCrossover : IRealVectorOperator, ICrossover {
    31     ILookupParameter<ItemArray<DoubleArray>> ParentsParameter { get; }
    32     ILookupParameter<DoubleArray> ChildParameter { get; }
     31    ILookupParameter<ItemArray<RealVector>> ParentsParameter { get; }
     32    ILookupParameter<RealVector> ChildParameter { get; }
    3333  }
    3434}
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Interfaces/IRealVectorManipulator.cs

    r3053 r3060  
    2929  /// </summary>
    3030  public interface IRealVectorManipulator : IRealVectorOperator, IManipulator {
    31     ILookupParameter<DoubleArray> RealVectorParameter { get; }
     31    ILookupParameter<RealVector> RealVectorParameter { get; }
    3232  }
    3333}
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/BreederGeneticAlgorithmManipulator.cs

    r3053 r3060  
    6666    /// <param name="max">The maximum number of the sampling range for the vector element (exclusive).</param>
    6767    /// <param name="searchIntervalFactor">The factor determining the size of the search interval.</param>
    68     public static void Apply(IRandom random, DoubleArray vector, DoubleValue min, DoubleValue max, DoubleValue searchIntervalFactor) {
     68    public static void Apply(IRandom random, RealVector vector, DoubleValue min, DoubleValue max, DoubleValue searchIntervalFactor) {
    6969      int length = vector.Length;
    7070      double prob, value;
     
    114114
    115115    /// <summary>
    116     /// Checks the parameters Minimum, Maximum, and SearchIntervalFactor and forwards the call to <see cref="Apply(IRandom, DoubleArray, DoubleValue, DoubleValue, DoubleValue)"/>.
     116    /// Checks the parameters Minimum, Maximum, and SearchIntervalFactor and forwards the call to <see cref="Apply(IRandom, RealVector, DoubleValue, DoubleValue, DoubleValue)"/>.
    117117    /// </summary>
    118118    /// <param name="random">A random number generator.</param>
    119119    /// <param name="realVector">The real vector to manipulate.</param>
    120     protected override void Manipulate(IRandom random, DoubleArray realVector) {
     120    protected override void Manipulate(IRandom random, RealVector realVector) {
    121121      if (MinimumParameter.ActualValue == null) throw new InvalidOperationException("BreederGeneticAlgorithmManipulator: Parameter " + MinimumParameter.ActualName + " could not be found.");
    122122      if (MaximumParameter.ActualValue == null) throw new InvalidOperationException("BreederGeneticAlgorithmManipulator: Paraemter " + MaximumParameter.ActualName + " could not be found.");
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/MichalewiczNonUniformAllPositionsManipulator.cs

    r3053 r3060  
    9595    /// <param name="generationsDependency">Specifies the degree of dependency on the number of generations.</param>
    9696    /// <returns>The manipulated real vector.</returns>
    97     public static void Apply(IRandom random, DoubleArray vector, DoubleValue min, DoubleValue max, IntValue currentGeneration, IntValue maximumGenerations, DoubleValue generationsDependency) {
     97    public static void Apply(IRandom random, RealVector vector, DoubleValue min, DoubleValue max, IntValue currentGeneration, IntValue maximumGenerations, DoubleValue generationsDependency) {
    9898      if (currentGeneration.Value > maximumGenerations.Value) throw new ArgumentException("MichalewiczNonUniformAllPositionManipulator: CurrentGeneration must be smaller or equal than MaximumGeneration", "currentGeneration");
    9999      int length = vector.Length;
     
    111111
    112112    /// <summary>
    113     /// Checks if all parameters are available and forwards the call to <see cref="Apply(IRandom, DoubleArray, DoubleValue, DoubleValue, IntValue, IntValue, DoubleValue)"/>.
     113    /// Checks if all parameters are available and forwards the call to <see cref="Apply(IRandom, RealVector, DoubleValue, DoubleValue, IntValue, IntValue, DoubleValue)"/>.
    114114    /// </summary>
    115115    /// <param name="random">The random number generator.</param>
    116116    /// <param name="realVector">The real vector that should be manipulated.</param>
    117     protected override void Manipulate(IRandom random, DoubleArray realVector) {
     117    protected override void Manipulate(IRandom random, RealVector realVector) {
    118118      if (MinimumParameter.ActualValue == null) throw new InvalidOperationException("MichalewiczNonUniformAllPositionManipulator: Parameter " + MinimumParameter.ActualName + " could not be found.");
    119119      if (MaximumParameter.ActualValue == null) throw new InvalidOperationException("MichalewiczNonUniformAllPositionManipulator: Parameter " + MaximumParameter.ActualName + " could not be found.");
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/MichalewiczNonUniformOnePositionManipulator.cs

    r3053 r3060  
    9595    /// <param name="generationsDependency">Specifies the degree of dependency on the number of generations.</param>
    9696    /// <returns>The manipulated real vector.</returns>
    97     public static void Apply(IRandom random, DoubleArray vector, DoubleValue min, DoubleValue max, IntValue currentGeneration, IntValue maximumGenerations, DoubleValue generationsDependency) {
     97    public static void Apply(IRandom random, RealVector vector, DoubleValue min, DoubleValue max, IntValue currentGeneration, IntValue maximumGenerations, DoubleValue generationsDependency) {
    9898      if (currentGeneration.Value > maximumGenerations.Value) throw new ArgumentException("MichalewiczNonUniformOnePositionManipulator: CurrentGeneration must be smaller or equal than MaximumGeneration", "currentGeneration");
    9999      int length = vector.Length;
     
    110110
    111111    /// <summary>
    112     /// Checks if all parameters are available and forwards the call to <see cref="Apply(IRandom, DoubleArray, DoubleValue, DoubleValue, IntValue, IntValue, DoubleValue)"/>.
     112    /// Checks if all parameters are available and forwards the call to <see cref="Apply(IRandom, RealVector, DoubleValue, DoubleValue, IntValue, IntValue, DoubleValue)"/>.
    113113    /// </summary>
    114114    /// <param name="random">The random number generator.</param>
    115115    /// <param name="realVector">The real vector that should be manipulated.</param>
    116     protected override void Manipulate(IRandom random, DoubleArray realVector) {
     116    protected override void Manipulate(IRandom random, RealVector realVector) {
    117117      if (MinimumParameter.ActualValue == null) throw new InvalidOperationException("MichalewiczNonUniformOnePositionManipulator: Parameter " + MinimumParameter.ActualName + " could not be found.");
    118118      if (MaximumParameter.ActualValue == null) throw new InvalidOperationException("MichalewiczNonUniformOnePositionManipulator: Parameter " + MaximumParameter.ActualName + " could not be found.");
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/PolynomialAllPositionManipulator.cs

    r3053 r3060  
    7171    /// <param name="contiguity">A parameter describing the shape of the probability density function which influences the strength of the manipulation.</param>
    7272    /// <param name="maxManipulation">The maximum strength of the manipulation.</param>
    73     public static void Apply(IRandom random, DoubleArray vector, DoubleValue contiguity, DoubleValue maxManipulation) {
     73    public static void Apply(IRandom random, RealVector vector, DoubleValue contiguity, DoubleValue maxManipulation) {
    7474      if (contiguity.Value < 0) throw new ArgumentException("PolynomialAllPositionManipulator: Contiguity value is smaller than 0", "contiguity");
    7575      double u, delta = 0;
     
    8888
    8989    /// <summary>
    90     /// Checks the availability of the parameters and forwards the call to <see cref="Apply(IRandom, DoubleArray, DoubleValue, DoubleValue)"/>.
     90    /// Checks the availability of the parameters and forwards the call to <see cref="Apply(IRandom, RealVector, DoubleValue, DoubleValue)"/>.
    9191    /// </summary>
    9292    /// <param name="random">The random number generator to use.</param>
    9393    /// <param name="realVector">The vector of real values to manipulate.</param>
    94     protected override void Manipulate(IRandom random, DoubleArray realVector) {
     94    protected override void Manipulate(IRandom random, RealVector realVector) {
    9595      if (ContiguityParameter.ActualValue == null) throw new InvalidOperationException("PolynomialAllPositionManipulator: Parameter " + ContiguityParameter.ActualName + " could not be found.");
    9696      if (MaximumManipulationParameter.ActualValue == null) throw new InvalidOperationException("PolynomialAllPositionManipulator: Parameter " + MaximumManipulationParameter.ActualName + " could not be found.");
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/PolynomialOnePositionManipulator.cs

    r3053 r3060  
    7070    /// <param name="contiguity">A parameter describing the shape of the probability density function which influences the strength of the manipulation.</param>
    7171    /// <param name="maxManipulation">The maximum strength of the manipulation.</param>
    72     public static void Apply(IRandom random, DoubleArray vector, DoubleValue contiguity, DoubleValue maxManipulation) {
     72    public static void Apply(IRandom random, RealVector vector, DoubleValue contiguity, DoubleValue maxManipulation) {
    7373      if (contiguity.Value < 0) throw new ArgumentException("PolynomialOnePositionManipulator: Contiguity value is smaller than 0", "contiguity");
    7474      int index = random.Next(vector.Length);
     
    8585
    8686    /// <summary>
    87     /// Checks the availability of the parameters and forwards the call to <see cref="Apply(IRandom, DoubleArray, DoubleValue, DoubleValue)"/>.
     87    /// Checks the availability of the parameters and forwards the call to <see cref="Apply(IRandom, RealVector, DoubleValue, DoubleValue)"/>.
    8888    /// </summary>
    8989    /// <param name="random">The random number generator to use.</param>
    9090    /// <param name="realVector">The vector of real values to manipulate.</param>
    91     protected override void Manipulate(IRandom random, DoubleArray realVector) {
     91    protected override void Manipulate(IRandom random, RealVector realVector) {
    9292      if (ContiguityParameter.ActualValue == null) throw new InvalidOperationException("PolynomialOnePositionManipulator: Parameter " + ContiguityParameter.ActualName + " could not be found.");
    9393      if (MaximumManipulationParameter.ActualValue == null) throw new InvalidOperationException("PolynomialOnePositionManipulator: Parameter " + MaximumManipulationParameter.ActualName + " could not be found.");
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/SelfAdaptiveNormalAllPositionsManipulator.cs

    r3053 r3060  
    4242    /// Parameter for the strategy vector.
    4343    /// </summary>
    44     public LookupParameter<DoubleArray> StrategyVectorParameter {
    45       get { return (LookupParameter<DoubleArray>)Parameters["StrategyVector"]; }
     44    public LookupParameter<RealVector> StrategyVectorParameter {
     45      get { return (LookupParameter<RealVector>)Parameters["StrategyVector"]; }
    4646    }
    4747    /// <summary>
     
    5151    public SelfAdaptiveNormalAllPositionsManipulator()
    5252      : base() {
    53       Parameters.Add(new LookupParameter<DoubleArray>("StrategyVector", "The vector containing the endogenous strategy parameters."));
     53      Parameters.Add(new LookupParameter<RealVector>("StrategyVector", "The vector containing the endogenous strategy parameters."));
    5454    }
    5555
     
    6464    /// <param name="vector">The real vector to manipulate.</param>
    6565    /// <returns>The manipulated real vector.</returns>
    66     public static void Apply(IRandom random, DoubleArray vector, DoubleArray strategyParameters) {
     66    public static void Apply(IRandom random, RealVector vector, RealVector strategyParameters) {
    6767      NormalDistributedRandom N = new NormalDistributedRandom(random, 0.0, 1.0);
    6868      for (int i = 0; i < vector.Length; i++) {
     
    7272
    7373    /// <summary>
    74     /// Checks that the strategy vector is not null and forwards the call to <see cref="Apply(IRandom, DoubleArray, DoubleArray)"/>.
     74    /// Checks that the strategy vector is not null and forwards the call to <see cref="Apply(IRandom, RealVector, RealVector)"/>.
    7575    /// </summary>
    7676    /// <param name="random">The random number generator.</param>
    7777    /// <param name="realVector">The vector of real values that is manipulated.</param>
    78     protected override void Manipulate(IRandom random, DoubleArray realVector) {
     78    protected override void Manipulate(IRandom random, RealVector realVector) {
    7979      if (StrategyVectorParameter.ActualValue == null) throw new InvalidOperationException("SelfAdaptiveNormalAllPositionsManipulator: Parameter " + StrategyVectorParameter.ActualName + " could not be found.");
    8080      Apply(random, realVector, StrategyVectorParameter.ActualValue);
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/UniformOnePositionManipulator.cs

    r3053 r3060  
    6767    /// <param name="max">The maximum value of the sampling range for
    6868    /// the vector element to change (exclusive).</param>
    69     public static void Apply(IRandom random, DoubleArray vector, DoubleValue min, DoubleValue max) {
     69    public static void Apply(IRandom random, RealVector vector, DoubleValue min, DoubleValue max) {
    7070      int index = random.Next(vector.Length);
    7171      vector[index] = min.Value + random.NextDouble() * (max.Value - min.Value);
     
    7373
    7474    /// <summary>
    75     /// Checks if the minimum and maximum parameters are available and forwards the call to <see cref="Apply(IRandom, DoubleArray, DoubleValue, DoubleValue)"/>.
     75    /// Checks if the minimum and maximum parameters are available and forwards the call to <see cref="Apply(IRandom, RealVector, DoubleValue, DoubleValue)"/>.
    7676    /// </summary>
    7777    /// <param name="random">The random number generator to use.</param>
    7878    /// <param name="realVector">The real vector to manipulate.</param>
    79     protected override void Manipulate(IRandom random, DoubleArray realVector) {
     79    protected override void Manipulate(IRandom random, RealVector realVector) {
    8080      if (MinimumParameter.ActualValue == null) throw new InvalidOperationException("UniformOnePositionManipulator: Parameter " + MinimumParameter.ActualName + " could not be found.");
    8181      if (MaximumParameter.ActualValue == null) throw new InvalidOperationException("UniformOnePositionManipulator: Parameter " + MaximumParameter.ActualName + " could not be found.");
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/RealVectorCreator.cs

    r3053 r3060  
    4141      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    4242    }
    43     public ILookupParameter<DoubleArray> RealVectorParameter {
    44       get { return (ILookupParameter<DoubleArray>)Parameters["RealVector"]; }
     43    public ILookupParameter<RealVector> RealVectorParameter {
     44      get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; }
    4545    }
    4646    public IValueLookupParameter<IntValue> LengthParameter {
     
    5757      : base() {
    5858      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
    59       Parameters.Add(new LookupParameter<DoubleArray>("RealVector", "The vector which should be manipulated."));
     59      Parameters.Add(new LookupParameter<RealVector>("RealVector", "The vector which should be manipulated."));
    6060      Parameters.Add(new ValueLookupParameter<IntValue>("Length", "The length of the vector."));
    6161      Parameters.Add(new ValueLookupParameter<DoubleValue>("Minimum", "The lower bound for each element in the vector."));
     
    6868    }
    6969
    70     protected abstract DoubleArray Create(IRandom random, IntValue length, DoubleValue minimum, DoubleValue maximum);
     70    protected abstract RealVector Create(IRandom random, IntValue length, DoubleValue minimum, DoubleValue maximum);
    7171  }
    7272}
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/RealVectorCrossover.cs

    r3053 r3060  
    4141      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    4242    }
    43     public ILookupParameter<ItemArray<DoubleArray>> ParentsParameter {
    44       get { return (SubScopesLookupParameter<DoubleArray>)Parameters["Parents"]; }
     43    public ILookupParameter<ItemArray<RealVector>> ParentsParameter {
     44      get { return (SubScopesLookupParameter<RealVector>)Parameters["Parents"]; }
    4545    }
    46     public ILookupParameter<DoubleArray> ChildParameter {
    47       get { return (ILookupParameter<DoubleArray>)Parameters["Child"]; }
     46    public ILookupParameter<RealVector> ChildParameter {
     47      get { return (ILookupParameter<RealVector>)Parameters["Child"]; }
    4848    }
    4949
     
    5151      : base() {
    5252      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic crossover operators."));
    53       Parameters.Add(new SubScopesLookupParameter<DoubleArray>("Parents", "The parent vectors which should be crossed."));
    54       Parameters.Add(new LookupParameter<DoubleArray>("Child", "The child vector resulting from the crossover."));
     53      Parameters.Add(new SubScopesLookupParameter<RealVector>("Parents", "The parent vectors which should be crossed."));
     54      Parameters.Add(new LookupParameter<RealVector>("Child", "The child vector resulting from the crossover."));
    5555    }
    5656
     
    6060    }
    6161
    62     protected abstract DoubleArray Cross(IRandom random, ItemArray<DoubleArray> parents);
     62    protected abstract RealVector Cross(IRandom random, ItemArray<RealVector> parents);
    6363  }
    6464}
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/RealVectorManipulator.cs

    r3053 r3060  
    4141      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    4242    }
    43     public ILookupParameter<DoubleArray> RealVectorParameter {
    44       get { return (ILookupParameter<DoubleArray>)Parameters["RealVector"]; }
     43    public ILookupParameter<RealVector> RealVectorParameter {
     44      get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; }
    4545    }
    4646
     
    4848      : base() {
    4949      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
    50       Parameters.Add(new LookupParameter<DoubleArray>("RealVector", "The vector which should be manipulated."));
     50      Parameters.Add(new LookupParameter<RealVector>("RealVector", "The vector which should be manipulated."));
    5151    }
    5252
     
    5656    }
    5757
    58     protected abstract void Manipulate(IRandom random, DoubleArray realVector);
     58    protected abstract void Manipulate(IRandom random, RealVector realVector);
    5959  }
    6060}
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/Auxiliary.cs

    r3053 r3060  
    2525namespace HeuristicLab.Encodings.RealVectorEncoding_33.Tests {
    2626  public static class Auxiliary {
    27     public static bool RealVectorIsAlmostEqualByPosition(DoubleArray p1, DoubleArray p2) {
     27    public static bool DoubleArrayIsAlmostEqualByPosition(DoubleArray p1, DoubleArray p2) {
    2828      bool equal = (p1.Length == p2.Length);
    2929      if (equal) {
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/BlendAlphaBetaCrossoverTest.cs

    r3053 r3060  
    6868    public void BlendAlphaBetaCrossoverCrossTest() {
    6969      BlendAlphaBetaCrossover_Accessor target = new BlendAlphaBetaCrossover_Accessor(new PrivateObject(typeof(BlendAlphaBetaCrossover)));
    70       ItemArray<DoubleArray> parents;
     70      ItemArray<RealVector> parents;
    7171      TestRandom random = new TestRandom();
    7272      bool exceptionFired;
    7373      // The following test checks if there is an exception when there are more than 2 parents
    7474      random.Reset();
    75       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(5), new DoubleArray(6), new DoubleArray(4) });
     75      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) });
    7676      exceptionFired = false;
    7777      try {
    78         DoubleArray actual;
     78        RealVector actual;
    7979        actual = target.Cross(random, parents);
    8080      } catch (System.ArgumentException) {
     
    8484      // The following test checks if there is an exception when there are less than 2 parents
    8585      random.Reset();
    86       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(4) });
     86      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) });
    8787      exceptionFired = false;
    8888      try {
    89         DoubleArray actual;
     89        RealVector actual;
    9090        actual = target.Cross(random, parents);
    9191      } catch (System.ArgumentException) {
     
    101101    public void BlendAlphaBetaCrossoverApplyTest() {
    102102      TestRandom random = new TestRandom();
    103       DoubleArray parent1, parent2, expected, actual;
     103      RealVector parent1, parent2, expected, actual;
    104104      DoubleValue alpha;
    105105      DoubleValue beta;
     
    110110      alpha = new DoubleValue(0.5);
    111111      beta = new DoubleValue(0.5);
    112       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    113       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    114       expected = new DoubleArray(new double[] { 0.3, 0.15, 0.3, 0.35, 0.45 });
     112      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     113      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     114      expected = new RealVector(new double[] { 0.3, 0.15, 0.3, 0.35, 0.45 });
    115115      actual = BlendAlphaBetaCrossover.Apply(random, parent1, parent2, alpha, beta);
    116       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected));
     116      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(actual, expected));
    117117      // The following test is not based on published examples
    118118      random.Reset();
    119119      random.DoubleNumbers = new double[] { 0.25, 0.75, 0.25, 0.75, 0.25 };
    120120      alpha = new DoubleValue(-0.25); // negative values for alpha are not allowed
    121       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    122       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     121      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     122      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    123123      exceptionFired = false;
    124124      try {
     
    132132      random.DoubleNumbers = new double[] { 0.25, 0.75, 0.25, 0.75, 0.25, .75 };
    133133      alpha = new DoubleValue(0.25);
    134       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
    135       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     134      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
     135      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    136136      exceptionFired = false;
    137137      try {
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/BlendAlphaCrossoverTest.cs

    r3053 r3060  
    6868    public void BlendAlphaCrossoverCrossTest() {
    6969      BlendAlphaCrossover_Accessor target = new BlendAlphaCrossover_Accessor(new PrivateObject(typeof(BlendAlphaCrossover)));
    70       ItemArray<DoubleArray> parents;
     70      ItemArray<RealVector> parents;
    7171      TestRandom random = new TestRandom();
    7272      bool exceptionFired;
    7373      // The following test checks if there is an exception when there are more than 2 parents
    7474      random.Reset();
    75       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(5), new DoubleArray(6), new DoubleArray(4) });
     75      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) });
    7676      exceptionFired = false;
    7777      try {
    78         DoubleArray actual;
     78        RealVector actual;
    7979        actual = target.Cross(random, parents);
    8080      } catch (System.ArgumentException) {
     
    8484      // The following test checks if there is an exception when there are less than 2 parents
    8585      random.Reset();
    86       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(4) });
     86      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) });
    8787      exceptionFired = false;
    8888      try {
    89         DoubleArray actual;
     89        RealVector actual;
    9090        actual = target.Cross(random, parents);
    9191      } catch (System.ArgumentException) {
     
    101101    public void BlendAlphaCrossoverApplyTest() {
    102102      TestRandom random = new TestRandom();
    103       DoubleArray parent1, parent2, expected, actual;
     103      RealVector parent1, parent2, expected, actual;
    104104      DoubleValue alpha;
    105105      bool exceptionFired;
     
    108108      random.DoubleNumbers = new double[] { 0.5, 0.5, 0.5, 0.5, 0.5 };
    109109      alpha = new DoubleValue(0.5);
    110       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    111       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    112       expected = new DoubleArray(new double[] { 0.3, 0.15, 0.3, 0.35, 0.45 });
     110      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     111      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     112      expected = new RealVector(new double[] { 0.3, 0.15, 0.3, 0.35, 0.45 });
    113113      actual = BlendAlphaCrossover.Apply(random, parent1, parent2, alpha);
    114       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected));
     114      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(actual, expected));
    115115      // The following test is not based on published examples
    116116      random.Reset();
    117117      random.DoubleNumbers = new double[] { 0.25, 0.75, 0.25, 0.75, 0.25 };
    118118      alpha = new DoubleValue(0.25);
    119       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    120       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    121       expected = new DoubleArray(new double[] { 0.225, 0.1875, 0.3, 0.4625, 0.1875 });
     119      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     120      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     121      expected = new RealVector(new double[] { 0.225, 0.1875, 0.3, 0.4625, 0.1875 });
    122122      actual = BlendAlphaCrossover.Apply(random, parent1, parent2, alpha);
    123       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected));
     123      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(actual, expected));
    124124      // The following test is not based on published examples
    125125      random.Reset();
    126126      random.DoubleNumbers = new double[] { 0.25, 0.75, 0.25, 0.75, 0.25 };
    127127      alpha = new DoubleValue(-0.25); // negative values for alpha are not allowed
    128       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    129       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    130       expected = new DoubleArray(new double[] { 0.225, 0.1875, 0.3, 0.4625, 0.1875 });
     128      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     129      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     130      expected = new RealVector(new double[] { 0.225, 0.1875, 0.3, 0.4625, 0.1875 });
    131131      exceptionFired = false;
    132132      try {
     
    140140      random.DoubleNumbers = new double[] { 0.25, 0.75, 0.25, 0.75, 0.25, .75 };
    141141      alpha = new DoubleValue(0.25);
    142       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
    143       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    144       expected = new DoubleArray(new double[] { 0.225, 0.1875, 0.3, 0.4625, 0.1875 });
     142      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
     143      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     144      expected = new RealVector(new double[] { 0.225, 0.1875, 0.3, 0.4625, 0.1875 });
    145145      exceptionFired = false;
    146146      try {
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/DiscreteCrossoverTest.cs

    r3053 r3060  
    6868    public void DiscreteCrossoverCrossTest() {
    6969      DiscreteCrossover_Accessor target = new DiscreteCrossover_Accessor(new PrivateObject(typeof(DiscreteCrossover)));
    70       ItemArray<DoubleArray> parents;
     70      ItemArray<RealVector> parents;
    7171      TestRandom random = new TestRandom();
    7272      bool exceptionFired;
    7373      // The following test checks if there is an exception when there are less than 2 parents
    7474      random.Reset();
    75       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(4) });
     75      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) });
    7676      exceptionFired = false;
    7777      try {
    78         DoubleArray actual;
     78        RealVector actual;
    7979        actual = target.Cross(random, parents);
    8080      } catch (System.ArgumentException) {
     
    9090    public void DiscreteCrossoverApplyTest() {
    9191      TestRandom random = new TestRandom();
    92       DoubleArray parent1, parent2, expected, actual;
    93       ItemArray<DoubleArray> parents;
     92      RealVector parent1, parent2, expected, actual;
     93      ItemArray<RealVector> parents;
    9494      bool exceptionFired;
    9595      // The following test is not based on published examples
    9696      random.Reset();
    9797      random.IntNumbers = new int[] { 0, 0, 1, 0, 1 };
    98       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    99       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    100       parents = new ItemArray<DoubleArray>( new DoubleArray[] { parent1, parent2 } );
    101       expected = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.8 });
     98      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     99      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     100      parents = new ItemArray<RealVector>( new RealVector[] { parent1, parent2 } );
     101      expected = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.8 });
    102102      actual = DiscreteCrossover.Apply(random, parents);
    103       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected));
     103      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(actual, expected));
    104104      // The following test is not based on published examples
    105105      random.Reset();
    106106      random.IntNumbers = new int[] { 0, 0, 1, 0, 1, 0 };
    107       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
    108       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    109       parents = new ItemArray<DoubleArray>(new DoubleArray[] { parent1, parent2 });
     107      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
     108      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     109      parents = new ItemArray<RealVector>(new RealVector[] { parent1, parent2 });
    110110      exceptionFired = false;
    111111      try {
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/HeuristicCrossoverTest.cs

    r3053 r3060  
    6868    public void HeuristicCrossoverCrossTest() {
    6969      HeuristicCrossover_Accessor target = new HeuristicCrossover_Accessor(new PrivateObject(typeof(HeuristicCrossover)));
    70       ItemArray<DoubleArray> parents;
     70      ItemArray<RealVector> parents;
    7171      TestRandom random = new TestRandom();
    7272      bool exceptionFired;
    7373      // The following test checks if there is an exception when there are more than 2 parents
    7474      random.Reset();
    75       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(5), new DoubleArray(6), new DoubleArray(4) });
     75      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) });
    7676      exceptionFired = false;
    7777      try {
    78         DoubleArray actual;
     78        RealVector actual;
    7979        actual = target.Cross(random, parents);
    8080      }
     
    8585      // The following test checks if there is an exception when there are less than 2 parents
    8686      random.Reset();
    87       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(4) });
     87      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) });
    8888      exceptionFired = false;
    8989      try {
    90         DoubleArray actual;
     90        RealVector actual;
    9191        actual = target.Cross(random, parents);
    9292      } catch (System.ArgumentException) {
     
    102102    public void HeuristicCrossoverApplyTest() {
    103103      TestRandom random = new TestRandom();
    104       DoubleArray parent1, parent2, expected, actual;
     104      RealVector parent1, parent2, expected, actual;
    105105      bool exceptionFired;
    106106      // The following test is not based on published examples
    107107      random.Reset();
    108108      random.DoubleNumbers = new double[] { 0.3 };
    109       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    110       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    111       expected = new DoubleArray(new double[] { 0.14, 0.23, 0.3, 0.59, -0.11 });
     109      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     110      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     111      expected = new RealVector(new double[] { 0.14, 0.23, 0.3, 0.59, -0.11 });
    112112      actual = HeuristicCrossover.Apply(random, parent1, parent2);
    113       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected));
     113      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(actual, expected));
    114114      // The following test is not based on published examples
    115115      random.Reset();
    116116      random.DoubleNumbers = new double[] { 0.3 };
    117       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
    118       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     117      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
     118      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    119119      exceptionFired = false;
    120120      try {
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/LocalCrossoverTest.cs

    r3053 r3060  
    6868    public void LocalCrossoverCrossTest() {
    6969      LocalCrossover_Accessor target = new LocalCrossover_Accessor(new PrivateObject(typeof(LocalCrossover)));
    70       ItemArray<DoubleArray> parents;
     70      ItemArray<RealVector> parents;
    7171      TestRandom random = new TestRandom();
    7272      bool exceptionFired;
    7373      // The following test checks if there is an exception when there are more than 2 parents
    7474      random.Reset();
    75       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(5), new DoubleArray(6), new DoubleArray(4) });
     75      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) });
    7676      exceptionFired = false;
    7777      try {
    78         DoubleArray actual;
     78        RealVector actual;
    7979        actual = target.Cross(random, parents);
    8080      }
     
    8585      // The following test checks if there is an exception when there are less than 2 parents
    8686      random.Reset();
    87       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(4) });
     87      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) });
    8888      exceptionFired = false;
    8989      try {
    90         DoubleArray actual;
     90        RealVector actual;
    9191        actual = target.Cross(random, parents);
    9292      } catch (System.ArgumentException) {
     
    102102    public void LocalCrossoverApplyTest() {
    103103      TestRandom random = new TestRandom();
    104       DoubleArray parent1, parent2, expected, actual;
     104      RealVector parent1, parent2, expected, actual;
    105105      bool exceptionFired;
    106106      // The following test is not based on published examples
    107107      random.Reset();
    108108      random.DoubleNumbers = new double[] { 0.3, 0.1, 0.2, 0.4, 0.23 };
    109       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    110       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    111       expected = new DoubleArray(new double[] { 0.34, 0.11, 0.3, 0.32, 0.639 });
     109      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     110      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     111      expected = new RealVector(new double[] { 0.34, 0.11, 0.3, 0.32, 0.639 });
    112112      actual = LocalCrossover.Apply(random, parent1, parent2);
    113       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected));
     113      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(actual, expected));
    114114      // The following test is not based on published examples
    115115      random.Reset();
    116116      random.DoubleNumbers = new double[] { 0.3, 0.1, 0.2, 0.4, 0.23, 0.5};
    117       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
    118       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     117      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
     118      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    119119      exceptionFired = false;
    120120      try {
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/MichalewiczNonUniformAllPositionsManipulatorTest.cs

    r3053 r3060  
    8585    public void MichalewiczNonUniformAllPositionsManipulatorApplyTest() {
    8686      TestRandom random = new TestRandom();
    87       DoubleArray parent, expected;
     87      RealVector parent, expected;
    8888      DoubleValue min, max, generationsDependency;
    8989      IntValue currentGeneration, maximumGenerations;
     
    9292      random.Reset();
    9393      random.DoubleNumbers = new double[] { 0.2, 0.5, 0.7, 0.8, 0.9, 0.5, 0.2, 0.5, 0.7, 0.8 };
    94       parent = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    95       expected = new DoubleArray(new double[] { 0.45, 0.22, 0.3, 0.6, 0.14 });
     94      parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     95      expected = new RealVector(new double[] { 0.45, 0.22, 0.3, 0.6, 0.14 });
    9696      min = new DoubleValue(0.3);
    9797      max = new DoubleValue(0.7);
     
    100100      maximumGenerations = new IntValue(4);
    101101      MichalewiczNonUniformAllPositionsManipulator.Apply(random, parent, min, max, currentGeneration, maximumGenerations, generationsDependency);
    102       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent));
     102      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(expected, parent));
    103103      // The following test is not based on published examples
    104104      exceptionFired = false;
    105105      random.Reset();
    106106      random.DoubleNumbers = new double[] { 0.2, 0.5, 0.7, 0.8, 0.9, 0.5, 0.2, 0.5, 0.7, 0.8 };
    107       parent = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     107      parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    108108      min = new DoubleValue(0.3);
    109109      max = new DoubleValue(0.7);
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/MichalewiczNonUniformOnePositionManipulatorTest.cs

    r3053 r3060  
    8585    public void MichalewiczNonUniformOnePositionManipulatorApplyTest() {
    8686      TestRandom random = new TestRandom();
    87       DoubleArray parent, expected;
     87      RealVector parent, expected;
    8888      DoubleValue min, max, generationsDependency;
    8989      IntValue currentGeneration, maximumGenerations;
     
    9393      random.IntNumbers = new int[] { 3 };
    9494      random.DoubleNumbers = new double[] { 0.2, 0.7 };
    95       parent = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    96       expected = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.34, 0.1 });
     95      parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     96      expected = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.34, 0.1 });
    9797      min = new DoubleValue(0.3);
    9898      max = new DoubleValue(0.7);
     
    101101      maximumGenerations = new IntValue(4);
    102102      MichalewiczNonUniformOnePositionManipulator.Apply(random, parent, min, max, currentGeneration, maximumGenerations, generationsDependency);
    103       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent));
     103      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(expected, parent));
    104104      // The following test is not based on published examples
    105105      exceptionFired = false;
     
    107107      random.IntNumbers = new int[] { 3 };
    108108      random.DoubleNumbers = new double[] { 0.2, 0.7 };
    109       parent = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     109      parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    110110      min = new DoubleValue(0.3);
    111111      max = new DoubleValue(0.7);
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/PolynomialAllPositionManipulatorTest.cs

    r3053 r3060  
    8585    public void PolynomialAllPositionManipulatorApplyTest() {
    8686      TestRandom random = new TestRandom();
    87       DoubleArray parent, expected;
     87      RealVector parent, expected;
    8888      DoubleValue contiguity, maxManipulation;
    8989      bool exceptionFired;
     
    9191      random.Reset();
    9292      random.DoubleNumbers = new double[] { 0.2, 0.7, 0.8, 0.01, 0.1 };
    93       parent = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    94       expected = new DoubleArray(new double[] { 0.120213215256006, 0.336631954950876, 0.474551336679454, 0.322759240811056, -0.0182075293954083 });
     93      parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     94      expected = new RealVector(new double[] { 0.120213215256006, 0.336631954950876, 0.474551336679454, 0.322759240811056, -0.0182075293954083 });
    9595      contiguity = new DoubleValue(0.8);
    9696      maxManipulation = new DoubleValue(0.2);
    9797      PolynomialAllPositionManipulator.Apply(random, parent, contiguity, maxManipulation);
    98       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent));
     98      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(expected, parent));
    9999      // The following test is not based on published examples
    100100      exceptionFired = false;
    101101      random.Reset();
    102102      random.DoubleNumbers = new double[] { 0.2, 0.7, 0.8, 0.01, 0.1 };
    103       parent = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     103      parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    104104      contiguity = new DoubleValue(-1); //Contiguity value < 0
    105105      maxManipulation = new DoubleValue(0.2);
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/PolynomialOnePositionManipulatorTest.cs

    r3053 r3060  
    8585    public void PolynomialOnePositionManipulatorApplyTest() {
    8686      TestRandom random = new TestRandom();
    87       DoubleArray parent, expected;
     87      RealVector parent, expected;
    8888      DoubleValue contiguity, maxManipulation;
    8989      bool exceptionFired;
     
    9292      random.IntNumbers = new int[] { 3 };
    9393      random.DoubleNumbers = new double[] { 0.2 };
    94       parent = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    95       expected = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.1261980542102, 0.1 });
     94      parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     95      expected = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.1261980542102, 0.1 });
    9696      contiguity = new DoubleValue(0.2);
    9797      maxManipulation = new DoubleValue(0.7);
    9898      PolynomialOnePositionManipulator.Apply(random, parent, contiguity, maxManipulation);
    99       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent));
     99      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(expected, parent));
    100100      // The following test is not based on published examples
    101101      exceptionFired = false;
     
    103103      random.IntNumbers = new int[] { 3 };
    104104      random.DoubleNumbers = new double[] { 0.2 };
    105       parent = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     105      parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    106106      contiguity = new DoubleValue(-1); //Contiguity value < 0
    107107      maxManipulation = new DoubleValue(0.2);
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/RandomConvexCrossoverTest.cs

    r3053 r3060  
    6868    public void RandomConvexCrossoverCrossTest() {
    6969      RandomConvexCrossover_Accessor target = new RandomConvexCrossover_Accessor(new PrivateObject(typeof(RandomConvexCrossover)));
    70       ItemArray<DoubleArray> parents;
     70      ItemArray<RealVector> parents;
    7171      TestRandom random = new TestRandom();
    7272      bool exceptionFired;
    7373      // The following test checks if there is an exception when there are more than 2 parents
    7474      random.Reset();
    75       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(5), new DoubleArray(6), new DoubleArray(4) });
     75      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) });
    7676      exceptionFired = false;
    7777      try {
    78         DoubleArray actual;
     78        RealVector actual;
    7979        actual = target.Cross(random, parents);
    8080      }
     
    8585      // The following test checks if there is an exception when there are less than 2 parents
    8686      random.Reset();
    87       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(4) });
     87      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) });
    8888      exceptionFired = false;
    8989      try {
    90         DoubleArray actual;
     90        RealVector actual;
    9191        actual = target.Cross(random, parents);
    9292      } catch (System.ArgumentException) {
     
    102102    public void RandomConvexCrossoverApplyTest() {
    103103      TestRandom random = new TestRandom();
    104       DoubleArray parent1, parent2, expected, actual;
     104      RealVector parent1, parent2, expected, actual;
    105105      bool exceptionFired;
    106106      // The following test is not based on published examples
    107107      random.Reset();
    108108      random.DoubleNumbers = new double[] { 0.3 };
    109       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    110       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    111       expected = new DoubleArray(new double[] { 0.34, 0.13, 0.3, 0.29, 0.59 });
     109      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     110      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     111      expected = new RealVector(new double[] { 0.34, 0.13, 0.3, 0.29, 0.59 });
    112112      actual = RandomConvexCrossover.Apply(random, parent1, parent2);
    113       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected));
     113      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(actual, expected));
    114114      // The following test is not based on published examples
    115115      random.Reset();
    116116      random.DoubleNumbers = new double[] { 0.3 };
    117       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
    118       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     117      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
     118      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    119119      exceptionFired = false;
    120120      try {
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/SimulatedBinaryCrossoverTest.cs

    r3053 r3060  
    6868    public void SimulatedBinaryCrossoverCrossTest() {
    6969      SimulatedBinaryCrossover_Accessor target = new SimulatedBinaryCrossover_Accessor(new PrivateObject(typeof(SimulatedBinaryCrossover)));
    70       ItemArray<DoubleArray> parents;
     70      ItemArray<RealVector> parents;
    7171      TestRandom random = new TestRandom();
    7272      bool exceptionFired;
    7373      // The following test checks if there is an exception when there are more than 2 parents
    7474      random.Reset();
    75       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(5), new DoubleArray(6), new DoubleArray(4) });
     75      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) });
    7676      exceptionFired = false;
    7777      try {
    78         DoubleArray actual;
     78        RealVector actual;
    7979        actual = target.Cross(random, parents);
    8080      }
     
    8585      // The following test checks if there is an exception when there are less than 2 parents
    8686      random.Reset();
    87       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(4) });
     87      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) });
    8888      exceptionFired = false;
    8989      try {
    90         DoubleArray actual;
     90        RealVector actual;
    9191        actual = target.Cross(random, parents);
    9292      } catch (System.ArgumentException) {
     
    102102    public void SimulatedBinaryCrossoverApplyTest() {
    103103      TestRandom random = new TestRandom();
    104       DoubleArray parent1, parent2, expected, actual;
     104      RealVector parent1, parent2, expected, actual;
    105105      DoubleValue contiguity;
    106106      bool exceptionFired;
     
    109109      random.DoubleNumbers = new double[] { 0.3, 0.9, 0.7, 0.2, 0.8, 0.1, 0.2, 0.3, 0.4, 0.8, 0.7 };
    110110      contiguity = new DoubleValue(0.3);
    111       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    112       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    113       expected = new DoubleArray(new double[] { 1.11032829834638, -0.0145477755417797, 0.3, 0.5, 0.1 });
     111      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     112      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     113      expected = new RealVector(new double[] { 1.11032829834638, -0.0145477755417797, 0.3, 0.5, 0.1 });
    114114      actual = SimulatedBinaryCrossover.Apply(random, parent1, parent2, contiguity);
    115       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected));
     115      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(actual, expected));
    116116      // The following test is not based on published examples
    117117      random.Reset();
    118118      random.DoubleNumbers = new double[] { 0.3, 0.9, 0.7, 0.2, 0.8, 0.1, 0.2, 0.3, 0.4, 0.8, 0.7 };
    119119      contiguity = new DoubleValue(0.3);
    120       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
    121       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     120      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
     121      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    122122      exceptionFired = false;
    123123      try {
     
    131131      random.DoubleNumbers = new double[] { 0.3, 0.9, 0.7, 0.2, 0.8, 0.1, 0.2, 0.3, 0.4, 0.8, 0.7 };
    132132      contiguity = new DoubleValue(-0.3);  //  contiguity < 0
    133       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1});
    134       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     133      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1});
     134      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    135135      exceptionFired = false;
    136136      try {
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/SinglePointCrossoverTest.cs

    r3053 r3060  
    6868    public void SinglePointCrossoverCrossTest() {
    6969      SinglePointCrossover_Accessor target = new SinglePointCrossover_Accessor(new PrivateObject(typeof(SinglePointCrossover)));
    70       ItemArray<DoubleArray> parents;
     70      ItemArray<RealVector> parents;
    7171      TestRandom random = new TestRandom();
    7272      bool exceptionFired;
    7373      // The following test checks if there is an exception when there are more than 2 parents
    7474      random.Reset();
    75       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(5), new DoubleArray(6), new DoubleArray(4) });
     75      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(5), new RealVector(6), new RealVector(4) });
    7676      exceptionFired = false;
    7777      try {
    78         DoubleArray actual;
     78        RealVector actual;
    7979        actual = target.Cross(random, parents);
    8080      }
     
    8585      // The following test checks if there is an exception when there are less than 2 parents
    8686      random.Reset();
    87       parents = new ItemArray<DoubleArray>(new DoubleArray[] { new DoubleArray(4) });
     87      parents = new ItemArray<RealVector>(new RealVector[] { new RealVector(4) });
    8888      exceptionFired = false;
    8989      try {
    90         DoubleArray actual;
     90        RealVector actual;
    9191        actual = target.Cross(random, parents);
    9292      } catch (System.ArgumentException) {
     
    102102    public void SinglePointCrossoverApplyTest() {
    103103      TestRandom random = new TestRandom();
    104       DoubleArray parent1, parent2, expected, actual;
     104      RealVector parent1, parent2, expected, actual;
    105105      bool exceptionFired;
    106106      // The following test is not based on published examples
    107107      random.Reset();
    108108      random.IntNumbers = new int[] { 3 };
    109       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    110       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    111       expected = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.2, 0.8 });
     109      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     110      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     111      expected = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.2, 0.8 });
    112112      actual = SinglePointCrossover.Apply(random, parent1, parent2);
    113       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected));
     113      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(actual, expected));
    114114      // The following test is not based on published examples
    115115      random.Reset();
    116116      random.IntNumbers = new int[] { 2 };
    117       parent1 = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
    118       parent2 = new DoubleArray(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
     117      parent1 = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1, 0.9 }); // this parent is longer
     118      parent2 = new RealVector(new double[] { 0.4, 0.1, 0.3, 0.2, 0.8 });
    119119      exceptionFired = false;
    120120      try {
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/UniformOnePositionManipulatorTest.cs

    r3053 r3060  
    8585    public void UniformOnePositionManipulatorApplyTest() {
    8686      TestRandom random = new TestRandom();
    87       DoubleArray parent, expected;
     87      RealVector parent, expected;
    8888      DoubleValue min, max;
    8989      // The following test is not based on published examples
     
    9191      random.IntNumbers = new int[] { 3 };
    9292      random.DoubleNumbers = new double[] { 0.2 };
    93       parent = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    94       expected = new DoubleArray(new double[] { 0.2, 0.2, 0.3, 0.3, 0.1 });
     93      parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
     94      expected = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.3, 0.1 });
    9595      min = new DoubleValue(0.2);
    9696      max = new DoubleValue(0.7);
    9797      UniformOnePositionManipulator.Apply(random, parent, min, max);
    98       Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent));
     98      Assert.IsTrue(Auxiliary.DoubleArrayIsAlmostEqualByPosition(expected, parent));
    9999    }
    100100
Note: See TracChangeset for help on using the changeset viewer.