- Timestamp:
- 02/16/09 01:21:53 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.IntVector/SinglePointCrossover.cs
r1157 r1218 57 57 58 58 /// <summary> 59 /// Performs a single point crossover at a randomly chosen position of t he two59 /// Performs a single point crossover at a randomly chosen position of two 60 60 /// given parent integer vectors. 61 61 /// </summary> 62 /// <exception cref="InvalidOperationException">Thrown if there are not exactly two parents.</exception> 62 63 /// <param name="scope">The current scope.</param> 63 64 /// <param name="random">A random number generator.</param> 64 /// <param name="parent1">The first parent for crossover.</param> 65 /// <param name="parent2">The second parent for crossover.</param> 65 /// <param name="parents">An array containing the two integer vectors that should be crossed.</param> 66 66 /// <returns>The newly created integer vector, resulting from the single point crossover.</returns> 67 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) { 68 return Apply(random, parent1, parent2); 67 protected override int[] Cross(IScope scope, IRandom random, int[][] parents) { 68 if (parents.Length != 2) throw new InvalidOperationException("ERROR in SinglePointCrossover: The number of parents is not equal to 2"); 69 return Apply(random, parents[0], parents[1]); 69 70 } 70 71 }
Note: See TracChangeset
for help on using the changeset viewer.