Changeset 850 for trunk/sources/HeuristicLab.Permutation/CyclicCrossover.cs
- Timestamp:
- 11/28/08 10:32:20 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Permutation/CyclicCrossover.cs
r2 r850 27 27 28 28 namespace HeuristicLab.Permutation { 29 /// <summary> 30 /// Performs a cross over permutation between two int arrays by taking first a whole cycle and then the 31 /// missing ones from the second parent. 32 /// </summary> 33 /// <remarks>A whole cycle means: <br/> 34 /// Start at a randomly chosen position x in parent1 and transfer it to the child at the same position. 35 /// Now this position x is no longer available for the node on position x in parent2, so 36 /// the value of the node at position x in parent2 is searched in parent1 and is then transferred 37 /// to the child preserving the position. Now this new position y is no longer available for the node in parent2 ....<br/> 38 /// This procedure is repeated till it is again at position x, then the cycle is over. 39 /// </remarks> 29 40 public class CyclicCrossover : PermutationCrossoverBase { 41 /// <inheritdoc select="summary"/> 30 42 public override string Description { 31 43 get { return @"TODO\r\nOperator description still missing ..."; } 32 44 } 33 45 46 /// <summary> 47 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> 48 /// by copying a whole cycle starting at a randomly chosen position in parent1 and taking the rest 49 /// from parent2. 50 /// </summary> 51 /// <param name="random">The random number generator.</param> 52 /// <param name="parent1">The parent scope 1 to cross over.</param> 53 /// <param name="parent2">The parent scope 2 to cross over.</param> 54 /// <returns>The created cross over permutation as int array.</returns> 34 55 public static int[] Apply(IRandom random, int[] parent1, int[] parent2) { 35 56 int length = parent1.Length; … … 58 79 } 59 80 81 /// <summary> 82 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> 83 /// by copying a whole cycle starting at a randomly chosen position in parent1 and taking the rest 84 /// from parent2. 85 /// </summary> 86 /// <remarks>Calls <see cref="Apply"/>.</remarks> 87 /// <param name="scope">The current scope.</param> 88 /// <param name="random">The random number generator.</param> 89 /// <param name="parent1">The parent scope 1 to cross over.</param> 90 /// <param name="parent2">The parent scope 2 to cross over.</param> 91 /// <returns>The created cross over permutation as int array.</returns> 60 92 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) { 61 93 return Apply(random, parent1, parent2);
Note: See TracChangeset
for help on using the changeset viewer.