- Timestamp:
- 02/16/09 01:21:53 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.IntVector/DiscreteCrossover.cs
r1157 r1218 56 56 57 57 /// <summary> 58 /// Performs a discrete crossover operation of the two given parents.58 /// Performs a discrete crossover operation for two given parent integer vectors. 59 59 /// </summary> 60 /// <exception cref="InvalidOperationException">Thrown if there are not exactly two parents.</exception> 60 61 /// <param name="scope">The current scope.</param> 61 62 /// <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> 64 64 /// <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]); 67 68 } 68 69 }
Note: See TracChangeset
for help on using the changeset viewer.