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/LocalCrossover.cs

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