Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/16/09 01:21:53 (15 years ago)
Author:
swagner
Message:

Refactoring of crossover operators (#470)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.RealVector/RandomConvexCrossover.cs

    r1184 r1218  
    5656
    5757    /// <summary>
    58     /// Performs a random convex crossover on the two given parents.
     58    /// Performs a random convex crossover operation for two given parent real vectors.
    5959    /// </summary>
    60     /// <remarks>Calls <see cref="Apply"/>.</remarks>
     60    /// <exception cref="InvalidOperationException">Thrown if there are not exactly two parents.</exception>
    6161    /// <param name="scope">The current scope.</param>
    62     /// <param name="random">The random number generator.</param>
    63     /// <param name="parent1">The first parent vector for the crossover.</param>
    64     /// <param name="parent2">The second parent vector for the crossover.</param>
    65     /// <returns>The newly created real vector, resulting from the random convex crossover.</returns>
    66     protected override double[] Cross(IScope scope, IRandom random, double[] parent1, double[] parent2) {
    67       return Apply(random, parent1, parent2);
     62    /// <param name="random">A random number generator.</param>
     63    /// <param name="parents">An array containing the two real vectors that should be crossed.</param>
     64    /// <returns>The newly created real vector, resulting from the crossover operation.</returns>
     65    protected override double[] Cross(IScope scope, IRandom random, double[][] parents) {
     66      if (parents.Length != 2) throw new InvalidOperationException("ERROR in RandomConvexCrossover: The number of parents is not equal to 2");
     67      return Apply(random, parents[0], parents[1]);
    6868    }
    6969  }
Note: See TracChangeset for help on using the changeset viewer.