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.IntVector/DiscreteCrossover.cs

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