- Timestamp:
- 02/16/09 01:21:53 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Permutation/PositionBasedCrossover.cs
r850 r1218 78 78 79 79 /// <summary> 80 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> 81 /// based on randomly chosen positions to define which position to take from where. 80 /// Performs a position-based crossover operation for two given parent permutations. 82 81 /// </summary> 83 /// < remarks>Calls <see cref="Apply"/>.</remarks>82 /// <exception cref="InvalidOperationException">Thrown if there are not exactly two parents.</exception> 84 83 /// <param name="scope">The current scope.</param> 85 /// <param name="random"> Therandom number generator.</param>86 /// <param name="parent 1">The permutation array of parent 1.</param>87 /// < param name="parent2">The permutation array of parent 2.</param>88 /// <returns>The created cross over permutation as int array.</returns>89 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) {90 return Apply(random, parent 1, parent2);84 /// <param name="random">A random number generator.</param> 85 /// <param name="parents">An array containing the two permutations that should be crossed.</param> 86 /// <returns>The newly created permutation, resulting from the crossover operation.</returns> 87 protected override int[] Cross(IScope scope, IRandom random, int[][] parents) { 88 if (parents.Length != 2) throw new InvalidOperationException("ERROR in PositionBasedCrossover: The number of parents is not equal to 2"); 89 return Apply(random, parents[0], parents[1]); 91 90 } 92 91 }
Note: See TracChangeset
for help on using the changeset viewer.