Changeset 3059 for trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs
- Timestamp:
- 03/16/10 10:35:28 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs
r3053 r3059 36 36 [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.")] 37 37 [StorableClass] 38 public class SinglePointCrossover : Int VectorCrossover {38 public class SinglePointCrossover : IntegerVectorCrossover { 39 39 /// <summary> 40 40 /// Performs a single point crossover at a randomly chosen position of the two … … 45 45 /// <param name="parent2">The second parent for crossover.</param> 46 46 /// <returns>The newly created integer vector, resulting from the single point crossover.</returns> 47 public static Int Array Apply(IRandom random, IntArray parent1, IntArrayparent2) {47 public static IntegerVector Apply(IRandom random, IntegerVector parent1, IntegerVector parent2) { 48 48 if (parent1.Length != parent2.Length) 49 49 throw new ArgumentException("DiscreteCrossover: The parents are of different length."); … … 58 58 result[i] = parent2[i]; 59 59 60 return new Int Array(result);60 return new IntegerVector(result); 61 61 } 62 62 … … 69 69 /// <param name="parents">An array containing the two integer vectors that should be crossed.</param> 70 70 /// <returns>The newly created integer vector, resulting from the single point crossover.</returns> 71 protected override Int Array Cross(IRandom random, ItemArray<IntArray> parents) {71 protected override IntegerVector Cross(IRandom random, ItemArray<IntegerVector> parents) { 72 72 if (parents.Length != 2) throw new ArgumentException("ERROR in SinglePointCrossover: The number of parents is not equal to 2"); 73 73 return Apply(random, parents[0], parents[1]);
Note: See TracChangeset
for help on using the changeset viewer.