Changeset 1218 for trunk/sources/HeuristicLab.Permutation/CosaCrossover.cs
- Timestamp:
- 02/16/09 01:21:53 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Permutation/CosaCrossover.cs
r850 r1218 86 86 87 87 /// <summary> 88 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> 89 /// by taking first the reverse elements of a randomly chosen interval of parent1 90 /// and inserting it in the result at a position specified by the permutation of parent2. 91 /// The remaining elements to be inserted are taken again from parent1 in the forward direction. 88 /// Performs a COSA crossover operation for two given parent permutations. 92 89 /// </summary> 93 /// < remarks>Calls <see cref="Apply"/>.</remarks>90 /// <exception cref="InvalidOperationException">Thrown if there are not exactly two parents.</exception> 94 91 /// <param name="scope">The current scope.</param> 95 /// <param name="random"> Therandom number generator.</param>96 /// <param name="parent 1">The parent scope 1 to cross over.</param>97 /// < param name="parent2">The parent scope 2 to cross over.</param>98 /// <returns>The created cross over permutation as int array.</returns>99 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) {100 return Apply(random, parent 1, parent2);92 /// <param name="random">A random number generator.</param> 93 /// <param name="parents">An array containing the two permutations that should be crossed.</param> 94 /// <returns>The newly created permutation, resulting from the crossover operation.</returns> 95 protected override int[] Cross(IScope scope, IRandom random, int[][] parents) { 96 if (parents.Length != 2) throw new InvalidOperationException("ERROR in CosaCrossover: The number of parents is not equal to 2"); 97 return Apply(random, parents[0], parents[1]); 101 98 } 102 99 }
Note: See TracChangeset
for help on using the changeset viewer.