Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/16/10 10:35:28 (15 years ago)
Author:
svonolfe
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs

    r3053 r3059  
    3636  [Item("SinglePointCrossover", "Single point crossover for integer vectors. It is implemented as described in Michalewicz, Z. 1999. Genetic Algorithms + Data Structures = Evolution Programs. Third, Revised and Extended Edition, Spring-Verlag Berlin Heidelberg.")]
    3737  [StorableClass]
    38   public class SinglePointCrossover : IntVectorCrossover {
     38  public class SinglePointCrossover : IntegerVectorCrossover {
    3939    /// <summary>
    4040    /// Performs a single point crossover at a randomly chosen position of the two
     
    4545    /// <param name="parent2">The second parent for crossover.</param>
    4646    /// <returns>The newly created integer vector, resulting from the single point crossover.</returns>
    47     public static IntArray Apply(IRandom random, IntArray parent1, IntArray parent2) {
     47    public static IntegerVector Apply(IRandom random, IntegerVector parent1, IntegerVector parent2) {
    4848      if (parent1.Length != parent2.Length)
    4949        throw new ArgumentException("DiscreteCrossover: The parents are of different length.");
     
    5858        result[i] = parent2[i];
    5959
    60       return new IntArray(result);
     60      return new IntegerVector(result);
    6161    }
    6262
     
    6969    /// <param name="parents">An array containing the two integer vectors that should be crossed.</param>
    7070    /// <returns>The newly created integer vector, resulting from the single point crossover.</returns>
    71     protected override IntArray Cross(IRandom random, ItemArray<IntArray> parents) {
     71    protected override IntegerVector Cross(IRandom random, ItemArray<IntegerVector> parents) {
    7272      if (parents.Length != 2) throw new ArgumentException("ERROR in SinglePointCrossover: The number of parents is not equal to 2");
    7373      return Apply(random, parents[0], parents[1]);
Note: See TracChangeset for help on using the changeset viewer.