- Timestamp:
- 02/16/09 01:21:53 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Permutation/EdgeRecombinationCrossover.cs
r850 r1218 139 139 140 140 /// <summary> 141 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="2"/> 142 /// by calculating the edges of each element. Starts at a randomly chosen position, 143 /// the next element is a neighbour with the least 144 /// number of neighbours, the next again a neighbour and so on. 141 /// Performs an edge recombination crossover operation for two given parent permutations. 145 142 /// </summary> 146 /// <exception cref="InvalidOperationException">Thrown when the permutation lacks a number. 147 /// </exception> 148 /// <remarks>Calls <see cref="Apply"/>.</remarks> 143 /// <exception cref="InvalidOperationException">Thrown if there are not exactly two parents.</exception> 149 144 /// <param name="scope">The current scope.</param> 150 /// <param name="random"> Therandom number generator.</param>151 /// <param name="parent 1">The parent scope 1 to cross over.</param>152 /// < param name="parent2">The parent scope 2 to cross over.</param>153 /// <returns>The created cross over permutation as int array.</returns>154 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) {155 return Apply(random, parent 1, parent2);145 /// <param name="random">A random number generator.</param> 146 /// <param name="parents">An array containing the two permutations that should be crossed.</param> 147 /// <returns>The newly created permutation, resulting from the crossover operation.</returns> 148 protected override int[] Cross(IScope scope, IRandom random, int[][] parents) { 149 if (parents.Length != 2) throw new InvalidOperationException("ERROR in EdgeRecombinationCrossover: The number of parents is not equal to 2"); 150 return Apply(random, parents[0], parents[1]); 156 151 } 157 152 }
Note: See TracChangeset
for help on using the changeset viewer.