Changeset 850
- Timestamp:
- 11/28/08 10:32:20 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Permutation/AbsolutePositionTopologicalCrossover.cs
r2 r850 27 27 28 28 namespace HeuristicLab.Permutation { 29 /// <summary> 30 /// Performs a cross over permutation between two permutation arrays by taking 31 /// the entries with the same index (starting at position 0) from both parents 32 /// (minding already inserted values). 33 /// </summary> 34 /// <example>First take the value at position 0 from parent1 then take the value at position 0 35 /// from parent2 if it has not already been inserted, afterwards take the value at position 1 from 36 /// parent1 if it has not already been inserted, then from parent2 and so on.</example> 29 37 public class AbsolutePositionTopologicalCrossover : PermutationCrossoverBase { 38 /// <inheritdoc select="summary"/> 30 39 public override string Description { 31 40 get { return @"TODO\r\nOperator description still missing ..."; } 32 41 } 33 42 43 /// <summary> 44 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> 45 /// by taking the values from both parents one by one with the same index starting at position 0. 46 /// </summary> 47 /// <example>First take the value at position 0 from parent1 then take the value at position 0 48 /// from parent2 if it has not already been inserted, afterwards take the value at position 1 from 49 /// parent1 if it has not already been inserted, then from parent2 and so on.</example> 50 /// <param name="random">A random number generator.</param> 51 /// <param name="parent1">The parent scope 1 to cross over.</param> 52 /// <param name="parent2">The parent scope 2 to cross over.</param> 53 /// <returns>The created cross over permutation as int array.</returns> 34 54 public static int[] Apply(IRandom random, int[] parent1, int[] parent2) { 35 55 int length = parent1.Length; … … 54 74 } 55 75 76 /// <summary> 77 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> 78 /// by taking the values from both parents one by one with the same index. 79 /// </summary> 80 /// <remarks>Calls <see cref="Apply"/>.</remarks> 81 /// <param name="scope">The current scope.</param> 82 /// <param name="random">A random number generator.</param> 83 /// <param name="parent1">The parent scope 1 to cross over.</param> 84 /// <param name="parent2">The parent scope 2 to cross over.</param> 85 /// <returns>The created cross over permutation as int array.</returns> 56 86 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) { 57 87 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.Permutation/CosaCrossover.cs
r2 r850 27 27 28 28 namespace HeuristicLab.Permutation { 29 /// <summary> 30 /// Performs a cross over permutation between two permutation arrays by taking randomly chosen 31 /// reverse and forward intervals from the first permutation array inserting 32 /// it in the child on different positions depending on the second permutation array. 33 /// </summary> 29 34 public class CosaCrossover : PermutationCrossoverBase { 35 /// <inheritdoc select="summary"/> 30 36 public override string Description { 31 37 get { return @"TODO\r\nOperator description still missing ..."; } 32 38 } 33 39 40 /// <summary> 41 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> 42 /// by taking first the reverse elements of a randomly chosen interval of parent1 43 /// and inserting it in the result at a position specified by the permutation of parent2. 44 /// The remaining elements to be inserted are taken again from parent1 in the forward direction. 45 /// </summary> 46 /// <param name="random">The random number generator.</param> 47 /// <param name="parent1">The parent scope 1 to cross over.</param> 48 /// <param name="parent2">The parent scope 2 to cross over.</param> 49 /// <returns>The created cross over permutation as int array.</returns> 34 50 public static int[] Apply(IRandom random, int[] parent1, int[] parent2) { 35 51 int length = parent1.Length; … … 69 85 } 70 86 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. 92 /// </summary> 93 /// <remarks>Calls <see cref="Apply"/>.</remarks> 94 /// <param name="scope">The current scope.</param> 95 /// <param name="random">The random number generator.</param> 96 /// <param name="parent1">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> 71 99 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) { 72 100 return Apply(random, parent1, parent2); -
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); -
trunk/sources/HeuristicLab.Permutation/EdgeRecombinationCrossover.cs
r2 r850 27 27 28 28 namespace HeuristicLab.Permutation { 29 /// <summary> 30 /// Performs a cross over permutation between two permutation arrays by calculating the edges (neighbours) 31 /// of each element. Starts at a randomly chosen position, the next element is a neighbour with the least 32 /// number of neighbours, the next again a neighbour and so on. 33 /// </summary> 29 34 public class EdgeRecombinationCrossover : PermutationCrossoverBase { 35 /// <inheritdoc select="summary"/> 30 36 public override string Description { 31 37 get { return @"TODO\r\nOperator description still missing ..."; } 32 38 } 33 39 40 /// <summary> 41 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="2"/> 42 /// by calculating the edges of each element. Starts at a randomly chosen position, 43 /// the next element is a neighbour with the least 44 /// number of neighbours, the next again a neighbour and so on. 45 /// </summary> 46 /// <exception cref="InvalidOperationException">Thrown when the permutation lacks a number. 47 /// </exception> 48 /// <param name="random">The random number generator.</param> 49 /// <param name="parent1">The parent scope 1 to cross over.</param> 50 /// <param name="parent2">The parent scope 2 to cross over.</param> 51 /// <returns>The created cross over permutation as int array.</returns> 34 52 public static int[] Apply(IRandom random, int[] parent1, int[] parent2) { 35 53 int length = parent1.Length; … … 120 138 } 121 139 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. 145 /// </summary> 146 /// <exception cref="InvalidOperationException">Thrown when the permutation lacks a number. 147 /// </exception> 148 /// <remarks>Calls <see cref="Apply"/>.</remarks> 149 /// <param name="scope">The current scope.</param> 150 /// <param name="random">The random number generator.</param> 151 /// <param name="parent1">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> 122 154 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) { 123 155 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.Permutation/HeuristicLabPermutationPlugin.cs
r582 r850 26 26 27 27 namespace HeuristicLab.Permutation { 28 /// <summary> 29 /// Plugin class for HeuristicLab.Permutation plugin. 30 /// </summary> 28 31 [ClassInfo(Name = "HeuristicLab.Permutation-3.2")] 29 32 [PluginFile(Filename = "HeuristicLab.Permutation-3.2.dll", Filetype = PluginFileType.Assembly)] -
trunk/sources/HeuristicLab.Permutation/InsertionManipulator.cs
r2 r850 26 26 27 27 namespace HeuristicLab.Permutation { 28 /// <summary> 29 /// Manipulates a permutation array by moving randomly one element to another position in the array. 30 /// </summary> 28 31 public class InsertionManipulator : PermutationManipulatorBase { 32 /// <inheritdoc select="summary"/> 29 33 public override string Description { 30 34 get { return @"TODO\r\nOperator description still missing ..."; } 31 35 } 32 36 37 /// <summary> 38 /// Moves an randomly chosen element in the specified <paramref name="permutation"/> array 39 /// to another randomly generated position. 40 /// </summary> 41 /// <param name="random">The random number generator.</param> 42 /// <param name="permutation">The array to manipulate.</param> 43 /// <returns>The new permuation array with the manipulated data.</returns> 33 44 public static int[] Apply(IRandom random, int[] permutation) { 34 45 int[] result = (int[])permutation.Clone(); … … 58 69 } 59 70 71 /// <summary> 72 /// Moves an randomly chosen element in the specified <paramref name="permutation"/> array 73 /// to another randomly generated position. 74 /// </summary> 75 /// <remarks>Calls <see cref="Apply"/>.</remarks> 76 /// <param name="scope">The current scope.</param> 77 /// <param name="random">The random number generator.</param> 78 /// <param name="permutation">The array to manipulate.</param> 79 /// <returns>The new permuation array with the manipulated data.</returns> 60 80 protected override int[] Manipulate(IScope scope, IRandom random, int[] permutation) { 61 81 return Apply(random, permutation); -
trunk/sources/HeuristicLab.Permutation/InversionManipulator.cs
r2 r850 26 26 27 27 namespace HeuristicLab.Permutation { 28 /// <summary> 29 /// Manipulates a permutation array by reversing a randomly chosen interval. 30 /// </summary> 28 31 public class InversionManipulator : PermutationManipulatorBase { 32 /// <inheritdoc select="summary"/> 29 33 public override string Description { 30 34 get { return @"TODO\r\nOperator description still missing ..."; } 31 35 } 32 36 37 /// <summary> 38 /// Reverses the specified <paramref name="permutation"/> between two randomly generated positions. 39 /// </summary> 40 /// <param name="random">The random number generator.</param> 41 /// <param name="permutation">The permutation array to manipulate.</param> 42 /// <returns>The new permuation array with the manipulated data.</returns> 33 43 public static int[] Apply(IRandom random, int[] permutation) { 34 44 int[] result = (int[])permutation.Clone(); … … 47 57 } 48 58 59 /// <summary> 60 /// Reverses the specified <paramref name="permutation"/> between two randomly generated positions. 61 /// </summary> 62 /// <remarks>Calls <see cref="Apply"/>.</remarks> 63 /// <param name="scope">The current scope.</param> 64 /// <param name="random">The random number generator.</param> 65 /// <param name="permutation">The permutation array to manipulate.</param> 66 /// <returns>The new permuation array with the manipulated data.</returns> 49 67 protected override int[] Manipulate(IScope scope, IRandom random, int[] permutation) { 50 68 return Apply(random, permutation); -
trunk/sources/HeuristicLab.Permutation/MaximalPreservativeCrossover.cs
r2 r850 27 27 28 28 namespace HeuristicLab.Permutation { 29 /// <summary> 30 /// Performs a cross over permutation between two permuation arrays by preserving a preferably big 31 /// region from one permutation array. 32 /// </summary> 29 33 public class MaximalPreservativeCrossover : PermutationCrossoverBase { 34 /// <inheritdoc select="summary"/> 30 35 public override string Description { 31 36 get { return @"TODO\r\nOperator description still missing ..."; } 32 37 } 33 38 39 /// <summary> 40 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> 41 /// by preserving a preferably big randomly chosen region of one permutation and taking 42 /// the missing ones from the other permuation array. 43 /// </summary> 44 /// <param name="random">The random number generator.</param> 45 /// <param name="parent1">The permutation array of parent 1.</param> 46 /// <param name="parent2">The permutation array of parent 2.</param> 47 /// <returns>The created cross over permutation as int array.</returns> 34 48 public static int[] Apply(IRandom random, int[] parent1, int[] parent2) { 35 49 int length = parent1.Length; … … 63 77 } 64 78 79 /// <summary> 80 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> 81 /// by preserving a big randomly chosen region of one permutation and taking the missing ones from the other 82 /// permuation array. 83 /// </summary> 84 /// <remarks>Calls <see cref="Apply"/>.</remarks> 85 /// <param name="scope">The current scope.</param> 86 /// <param name="random">The random number generator.</param> 87 /// <param name="parent1">The permutation array of parent 1.</param> 88 /// <param name="parent2">The permutation array of parent 2.</param> 89 /// <returns>The created cross over permutation as int array.</returns> 65 90 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) { 66 91 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.Permutation/OrderBasedCrossover.cs
r2 r850 27 27 28 28 namespace HeuristicLab.Permutation { 29 /// <summary> 30 /// Performs a cross over permutation of two permutation arrays by taking randomly a selection of values 31 /// (not an interval!) from the first permutation keeping the correct order and filling 32 /// the missing entries with the elements from the second permutation, also in the right order. 33 /// </summary> 29 34 public class OrderBasedCrossover : PermutationCrossoverBase { 35 /// <inheritdoc select="summary"/> 30 36 public override string Description { 31 37 get { return @"TODO\r\nOperator description still missing ..."; } 32 38 } 33 39 40 /// <summary> 41 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> by 42 /// randomly selecting some values from the first permutation that will be inserted one after each 43 /// other; the missing ones are picked in the correct order from the second permutation. 44 /// </summary> 45 /// <param name="random">The random number generator.</param> 46 /// <param name="parent1">The parent scope 1 to cross over.</param> 47 /// <param name="parent2">The parent scope 2 to cross over.</param> 48 /// <returns>The created cross over permutation as int array.</returns> 34 49 public static int[] Apply(IRandom random, int[] parent1, int[] parent2) { 35 50 int length = parent1.Length; … … 76 91 } 77 92 93 /// <summary> 94 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> by 95 /// randomly selecting some values from the first permutation that will be inserted one after each 96 /// other; the missing ones are picked in the correct order from the second permutation. 97 /// </summary> 98 /// <remarks>Calls <see cref="Apply"/>.</remarks> 99 /// <param name="scope">The current scope.</param> 100 /// <param name="random">The random number generator.</param> 101 /// <param name="parent1">The parent scope 1 to cross over.</param> 102 /// <param name="parent2">The parent scope 2 to cross over.</param> 103 /// <returns>The created cross over permutation as int array.</returns> 78 104 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) { 79 105 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.Permutation/OrderCrossover.cs
r2 r850 27 27 28 28 namespace HeuristicLab.Permutation { 29 /// <summary> 30 /// Performs a cross over permutation between two permuation arrays 31 /// by taking a randomly chosen interval from the frist, preserving the positions, 32 /// then the missing values from the second array in the order they occur in the second array. 33 /// </summary> 29 34 public class OrderCrossover : PermutationCrossoverBase { 35 /// <inheritdoc select="summary"/> 30 36 public override string Description { 31 37 get { return @"TODO\r\nOperator description still missing ..."; } 32 38 } 33 39 40 /// <summary> 41 /// Performs a cross over permutation of <paramref name="parent1"/> and 42 /// <paramref name="parent2"/> by taking a randomly chosen interval from <paramref name="parent1"/>, 43 /// preserving the positions and then the missing values from <paramref name="parent2"/> in the 44 /// order they occur in <paramref name="parent2"/>. 45 /// </summary> 46 /// <param name="random">The random number generator.</param> 47 /// <param name="parent1">The parent scope 1 to cross over.</param> 48 /// <param name="parent2">The parent scope 2 to cross over.</param> 49 /// <returns>The created cross over permutation as int array.</returns> 34 50 public static int[] Apply(IRandom random, int[] parent1, int[] parent2) { 35 51 int[] result = new int[parent1.Length]; … … 57 73 } 58 74 75 /// <summary> 76 /// Performs a cross over permuation of <paramref name="parent1"/> and <paramref name="parent2"/> 77 /// by taking a randomly chosen interval from <paramref name="parent1"/> and the rest from 78 /// <paramref name="parent2"/>. 79 /// </summary> 80 /// <remarks>Calls <see cref="Apply"/>.</remarks> 81 /// <param name="scope">The current scope.</param> 82 /// <param name="random">The random number generator.</param> 83 /// <param name="parent1">The parent scope 1 to cross over.</param> 84 /// <param name="parent2">The parent scope 2 to cross over.</param> 85 /// <returns>The created cross over permutation as int array.</returns> 59 86 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) { 60 87 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.Permutation/PartiallyMatchedCrossover.cs
r2 r850 27 27 28 28 namespace HeuristicLab.Permutation { 29 /// <summary> 30 /// Performs a cross over permutation between two permuation arrays 31 /// by taking a randomly chosen interval from the first, keeping the position, 32 /// then all positions from the second permutation which are still free in the child 33 /// (the position is free and the value is "free") 34 /// and then missing ones from the second array in the order they occur in the second array. 35 /// </summary> 29 36 public class PartiallyMatchedCrossover : PermutationCrossoverBase { 37 /// <inheritdoc select="summary"/> 30 38 public override string Description { 31 39 get { return @"TODO\r\nOperator description still missing ..."; } 32 40 } 33 41 42 /// <summary> 43 /// Performs a cross over permuation of <paramref name="parent1"/> and <paramref name="parent2"/> 44 /// by taking a randomly chosen interval from <paramref name="parent1"/>, preserving the position, 45 /// then all positions from <paramref name="parent2"/> which are still free in the child 46 /// (the position is free and the value is "free") 47 /// and then missing ones from <paramref name="parent2"/> in the order they occur 48 /// in <paramref name="parent2"/>. 49 /// </summary> 50 /// <param name="random">The random number generator.</param> 51 /// <param name="parent1">The parent scope 1 to cross over.</param> 52 /// <param name="parent2">The parent scope 2 to cross over.</param> 53 /// <returns>The created cross over permutation as int array.</returns> 34 54 public static int[] Apply(IRandom random, int[] parent1, int[] parent2) { 35 55 int length = parent1.Length; … … 66 86 } 67 87 88 /// <summary> 89 /// Performs a cross over permuation of <paramref name="parent1"/> and <paramref name="parent2"/> 90 /// by taking a randomly chosen interval from <paramref name="parent1"/>, preserving the position, 91 /// then all positions from <paramref name="parent2"/> which are still free in the child 92 /// (the position is free and the value is "free") 93 /// and then missing ones from <paramref name="parent2"/> in the order they occur 94 /// in <paramref name="parent2"/>. 95 /// </summary> 96 /// <remarks>Calls <see cref="Apply"/>.</remarks> 97 /// <param name="scope">The current scope.</param> 98 /// <param name="random">The random number generator.</param> 99 /// <param name="parent1">The parent scope 1 to cross over.</param> 100 /// <param name="parent2">The parent scope 2 to cross over.</param> 101 /// <returns>The created cross over permutation as int array.</returns> 68 102 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) { 69 103 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.Permutation/Permutation.cs
r2 r850 27 27 28 28 namespace HeuristicLab.Permutation { 29 /// <summary> 30 /// The base class for a permutation, which is an ordered combination. 31 /// </summary> 29 32 public class Permutation : IntArrayData { 33 /// <summary> 34 /// Initializes a new instance of <see cref="Permutation"/>. 35 /// </summary> 30 36 public Permutation() 31 37 : base() { 32 38 } 39 /// <summary> 40 /// Initializes a new instance of <see cref="Permutation"/> with the given 41 /// <paramref name="permutation"/> array. 42 /// </summary> 43 /// <param name="permutation">The permutation array to assign.</param> 33 44 public Permutation(int[] permutation) 34 45 : base(permutation) { 35 46 } 36 47 48 /// <summary> 49 /// Clones the current instance. 50 /// </summary> 51 /// <param name="clonedObjects">A dictionary of all already cloned objects. (Needed to 52 /// avoid cycles.)</param> 53 /// <returns>The cloned object as <see cref="Permutation"/>.</returns> 37 54 public override object Clone(IDictionary<Guid, object> clonedObjects) { 38 55 Permutation clone = new Permutation((int[])Data.Clone()); -
trunk/sources/HeuristicLab.Permutation/PermutationCrossoverBase.cs
r77 r850 27 27 28 28 namespace HeuristicLab.Permutation { 29 /// <summary> 30 /// Base class for cross over permutations. 31 /// </summary> 29 32 public abstract class PermutationCrossoverBase : CrossoverBase { 33 /// <summary> 34 /// Initializes a new instance of <see cref="PermutationCrossoverBase"/> with one variable info 35 /// (<c>Permutation</c>). 36 /// </summary> 30 37 public PermutationCrossoverBase() 31 38 : base() { … … 33 40 } 34 41 42 /// <summary> 43 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> with 44 /// the given random number generator (<paramref name="random"/>) to create a new 45 /// <paramref name="child"/>. 46 /// </summary> 47 /// <exception cref="InvalidOperationException">Thrown when the two permutations have a different 48 /// length.</exception> 49 /// <remarks>Calls <see cref="Cross(HeuristicLab.Core.IScope, HeuristicLab.Core.IRandom, int[], int[])"/>.</remarks> 50 /// <param name="scope">The scope where to get the actual child variable name.</param> 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 /// <param name="child">The child scope which to assign the permutated data.</param> 35 55 protected sealed override void Cross(IScope scope, IRandom random, IScope parent1, IScope parent2, IScope child) { 36 56 Permutation perm1 = parent1.GetVariableValue<Permutation>("Permutation", false); … … 43 63 } 44 64 65 /// <summary> 66 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> with 67 /// the given random number generator (<paramref name="random"/>) . 68 /// </summary> 69 /// <param name="scope">The scope of the variables.</param> 70 /// <param name="random">The random number generator.</param> 71 /// <param name="parent1">The parent scope 1 to cross over.</param> 72 /// <param name="parent2">The parent scope 2 to cross over.</param> 73 /// <returns>The created cross over permutation as int array.</returns> 45 74 protected abstract int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2); 46 75 } -
trunk/sources/HeuristicLab.Permutation/PermutationManipulatorBase.cs
r2 r850 26 26 27 27 namespace HeuristicLab.Permutation { 28 /// <summary> 29 /// Base class for manipulation permutation. 30 /// </summary> 28 31 public abstract class PermutationManipulatorBase : OperatorBase { 32 /// <summary> 33 /// Initializes a new instance of <see cref="PermutationManipulatorBase"/> with two variable infos 34 /// (<c>Random</c> and <c>Permutation</c>). 35 /// </summary> 29 36 public PermutationManipulatorBase() 30 37 : base() { … … 33 40 } 34 41 42 /// <summary> 43 /// Manipulates the permutation data of the given <paramref name="scope"/> according to a 44 /// specified random number generator. 45 /// </summary> 46 /// <remarks>Calls <see cref="Manipulate"/>.</remarks> 47 /// <param name="scope">The scope of the permutation data and the random number generator.</param> 48 /// <returns><c>null</c>.</returns> 35 49 public override IOperation Apply(IScope scope) { 36 50 IRandom random = GetVariableValue<IRandom>("Random", scope, true); … … 40 54 } 41 55 56 /// <summary> 57 /// Manipulates the given <paramref name="permutation"/> with the specified <paramref name="random"/> 58 /// number generator. 59 /// </summary> 60 /// <param name="scope">The scope of the variables.</param> 61 /// <param name="random">The random number generator.</param> 62 /// <param name="permutation">The permutation to manipulate.</param> 63 /// <returns>The manipulated permutation as int array.</returns> 42 64 protected abstract int[] Manipulate(IScope scope, IRandom random, int[] permutation); 43 65 } -
trunk/sources/HeuristicLab.Permutation/PositionBasedCrossover.cs
r2 r850 27 27 28 28 namespace HeuristicLab.Permutation { 29 /// <summary> 30 /// Performs a cross over permutation between two permutation arrays based on randomly chosen positions. 31 /// </summary> 29 32 public class PositionBasedCrossover : PermutationCrossoverBase { 33 /// <inheritdoc select="summary"/> 30 34 public override string Description { 31 35 get { return @"TODO\r\nOperator description still missing ..."; } 32 36 } 33 37 38 /// <summary> 39 /// Performs a cross over permutation of <paramref name="parent1"/> and <paramref name="parent2"/> 40 /// based on randomly chosen positions to define which position to take from where. 41 /// </summary> 42 /// <param name="random">The random number generator.</param> 43 /// <param name="parent1">The permutation array of parent 1.</param> 44 /// <param name="parent2">The permutation array of parent 2.</param> 45 /// <returns>The created cross over permutation as int array.</returns> 34 46 public static int[] Apply(IRandom random, int[] parent1, int[] parent2) { 35 47 int length = parent1.Length; … … 65 77 } 66 78 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. 82 /// </summary> 83 /// <remarks>Calls <see cref="Apply"/>.</remarks> 84 /// <param name="scope">The current scope.</param> 85 /// <param name="random">The random number generator.</param> 86 /// <param name="parent1">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> 67 89 protected override int[] Cross(IScope scope, IRandom random, int[] parent1, int[] parent2) { 68 90 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.Permutation/RandomPermutationGenerator.cs
r77 r850 27 27 28 28 namespace HeuristicLab.Permutation { 29 /// <summary> 30 /// Generates a randomly shuffled permuation. 31 /// </summary> 29 32 public class RandomPermutationGenerator : OperatorBase { 33 /// <inheritdoc select="summary"/> 30 34 public override string Description { 31 35 get { return @"TODO\r\nOperator description still missing ..."; } 32 36 } 33 37 38 /// <summary> 39 /// Initializes a new instance of <see cref="RandomPermutationGenerator"/> with three variable infos 40 /// (<c>Length</c>, <c>Random</c> and <c>Permutation</c>). 41 /// </summary> 34 42 public RandomPermutationGenerator() 35 43 : base() { … … 39 47 } 40 48 49 /// <summary> 50 /// Generates a randomly shuffled permutation. 51 /// </summary> 52 /// <param name="random">The random number generator.</param> 53 /// <param name="length">The length of the permutation to create.</param> 54 /// <returns>The generated permuation as int array.</returns> 41 55 public static int[] Apply(IRandom random, int length) { 42 56 int[] perm = new int[length]; … … 56 70 } 57 71 72 /// <summary> 73 /// Generates a randomly shuffled permutation. 74 /// </summary> 75 /// <remarks>Calls <see cref="Apply(HeuristicLab.Core.IRandom, int)"/>.</remarks> 76 /// <param name="scope">The current scope with the variables.</param> 77 /// <returns><c>null</c>.</returns> 58 78 public override IOperation Apply(IScope scope) { 59 79 IRandom random = GetVariableValue<IRandom>("Random", scope, true); -
trunk/sources/HeuristicLab.Permutation/ScrambleManipulator.cs
r2 r850 26 26 27 27 namespace HeuristicLab.Permutation { 28 /// <summary> 29 /// Manipulates a permutation array by randomly scrambling the elements in a randomly chosen interval. 30 /// </summary> 28 31 public class ScrambleManipulator : PermutationManipulatorBase { 32 /// <inheritdoc select="summary"/> 29 33 public override string Description { 30 34 get { return @"TODO\r\nOperator description still missing ..."; } 31 35 } 32 36 37 /// <summary> 38 /// Mixes the elements of the given <paramref name="permutation"/> randomly 39 /// in a randomly chosen interval. 40 /// </summary> 41 /// <param name="random">The random number generator.</param> 42 /// <param name="permutation">The permutation array to manipulate.</param> 43 /// <returns>The new permuation array with the manipulated data.</returns> 33 44 public static int[] Apply(IRandom random, int[] permutation) { 34 45 int[] result = (int[])permutation.Clone(); … … 67 78 } 68 79 80 /// <summary> 81 /// Mixes the elements of the given <paramref name="permutation"/> randomly 82 /// in a randomly chosen interval. 83 /// </summary> 84 /// <remarks>Calls <see cref="Apply"/>.</remarks> 85 /// <param name="scope">The current scope.</param> 86 /// <param name="random">The random number generator.</param> 87 /// <param name="permutation">The permutation array to manipulate.</param> 88 /// <returns>The new permuation array with the manipulated data.</returns> 69 89 protected override int[] Manipulate(IScope scope, IRandom random, int[] permutation) { 70 90 return Apply(random, permutation); -
trunk/sources/HeuristicLab.Permutation/Swap2Manipulator.cs
r2 r850 26 26 27 27 namespace HeuristicLab.Permutation { 28 /// <summary> 29 /// Manipulates a permutation array by swapping to randomly chosen elements. 30 /// </summary> 28 31 public class Swap2Manipulator : PermutationManipulatorBase { 32 /// <inheritdoc select="summary"/> 29 33 public override string Description { 30 34 get { return @"TODO\r\nOperator description still missing ..."; } 31 35 } 32 36 37 /// <summary> 38 /// Swaps two randomly chosen elements in the given <paramref name="permutation"/> array. 39 /// </summary> 40 /// <param name="random">The random number generator.</param> 41 /// <param name="permutation">The permutation array to manipulate.</param> 42 /// <returns>The new permuation array with the manipulated data.</returns> 33 43 public static int[] Apply(IRandom random, int[] permutation) { 34 44 int[] result = (int[])permutation.Clone(); … … 45 55 } 46 56 57 /// <summary> 58 /// Swaps two randomly chosen elements in the given <paramref name="permutation"/> array. 59 /// </summary> 60 /// <remarks>Calls <see cref="Apply"/>.</remarks> 61 /// <param name="scope">The current scope.</param> 62 /// <param name="random">The random number generator.</param> 63 /// <param name="permutation">The permutation array to manipulate.</param> 64 /// <returns>The new permuation array with the manipulated data.</returns> 47 65 protected override int[] Manipulate(IScope scope, IRandom random, int[] permutation) { 48 66 return Apply(random, permutation); -
trunk/sources/HeuristicLab.Permutation/Swap3Manipulator.cs
r2 r850 26 26 27 27 namespace HeuristicLab.Permutation { 28 /// <summary> 29 /// Manipulates a permutation array by swaping three randomly chosen elements. 30 /// </summary> 28 31 public class Swap3Manipulator : PermutationManipulatorBase { 32 /// <inheritdoc select="summary"/> 29 33 public override string Description { 30 34 get { return @"TODO\r\nOperator description still missing ..."; } 31 35 } 32 36 37 /// <summary> 38 /// Swaps three randomly chosen elements of the given <paramref name="permutation"/> array. 39 /// </summary> 40 /// <param name="random">The random number generator.</param> 41 /// <param name="permutation">The permutation array to manipulate.</param> 42 /// <returns>The new permuation array with the manipulated data.</returns> 33 43 public static int[] Apply(IRandom random, int[] permutation) { 34 44 int[] result = (int[])permutation.Clone(); … … 61 71 } 62 72 73 /// <summary> 74 /// Swaps three randomly chosen elements of the given <paramref name="permutation"/> array. 75 /// </summary> 76 /// <remarks>Calls <see cref="Apply"/>.</remarks> 77 /// <param name="scope">The current scope.</param> 78 /// <param name="random">The random number generator.</param> 79 /// <param name="permutation">The permutation array to manipulate.</param> 80 /// <returns>The new permuation array with the manipulated data.</returns> 63 81 protected override int[] Manipulate(IScope scope, IRandom random, int[] permutation) { 64 82 return Apply(random, permutation); -
trunk/sources/HeuristicLab.Permutation/TranslocationInversionManipulator.cs
r2 r850 26 26 27 27 namespace HeuristicLab.Permutation { 28 /// <summary> 29 /// Manipulates a permutation array by moving and reversing a randomly chosen interval of elements to another 30 /// (randomly chosen) position in the array. 31 /// </summary> 28 32 public class TranslocationInversionManipulator : PermutationManipulatorBase { 33 /// <inheritdoc select="summary"/> 29 34 public override string Description { 30 35 get { return @"TODO\r\nOperator description still missing ..."; } 31 36 } 32 37 38 /// <summary> 39 /// Moves a randomly chosen interval of elements to another (randomly chosen) position in the given 40 /// <paramref name="permutation"/> array and reverses it. 41 /// </summary> 42 /// <param name="random">The random number generator.</param> 43 /// <param name="permutation">The permutation array to manipulate.</param> 44 /// <returns>The new permuation array with the manipulated data.</returns> 33 45 public static int[] Apply(IRandom random, int[] permutation) { 34 46 int[] result = (int[])permutation.Clone(); … … 64 76 } 65 77 78 /// <summary> 79 /// Moves a randomly chosen interval of elements to another (randomly chosen) position in the given 80 /// <paramref name="permutation"/> array and reverses it. 81 /// </summary> 82 /// <remarks>Calls <see cref="Apply"/>.</remarks> 83 /// <param name="scope">The current scope.</param> 84 /// <param name="random">The random number generator.</param> 85 /// <param name="permutation">The permutation array to manipulate.</param> 86 /// <returns>The new permuation array with the manipulated data.</returns> 66 87 protected override int[] Manipulate(IScope scope, IRandom random, int[] permutation) { 67 88 return Apply(random, permutation); -
trunk/sources/HeuristicLab.Permutation/TranslocationManipulator.cs
r2 r850 26 26 27 27 namespace HeuristicLab.Permutation { 28 /// <summary> 29 /// Manipulates a permutation array by moving a randomly chosen interval of elements to another 30 /// (randomly chosen) position in the array. 31 /// </summary> 28 32 public class TranslocationManipulator : PermutationManipulatorBase { 33 /// <inheritdoc select="summary"/> 29 34 public override string Description { 30 35 get { return @"TODO\r\nOperator description still missing ..."; } 31 36 } 32 37 38 /// <summary> 39 /// Moves a randomly chosen interval of elements to another (randomly chosen) position in the given 40 /// <paramref name="permutation"/> array. 41 /// </summary> 42 /// <param name="random">The random number generator.</param> 43 /// <param name="permutation">The permutation array to manipulate.</param> 44 /// <returns>The new permuation array with the manipulated data.</returns> 33 45 public static int[] Apply(IRandom random, int[] permutation) { 34 46 int[] result = (int[])permutation.Clone(); … … 64 76 } 65 77 78 /// <summary> 79 /// Moves a randomly chosen interval of elements to another (randomly chosen) position in the given 80 /// <paramref name="permutation"/> array. 81 /// </summary> 82 /// <remarks>Calls <see cref="Apply"/>.</remarks> 83 /// <param name="scope">The current scope.</param> 84 /// <param name="random">The random number generator.</param> 85 /// <param name="permutation">The permutation array to manipulate.</param> 86 /// <returns>The new permuation array with the manipulated data.</returns> 66 87 protected override int[] Manipulate(IScope scope, IRandom random, int[] permutation) { 67 88 return Apply(random, permutation); -
trunk/sources/HeuristicLab.Selection/RightChildReducer.cs
r818 r850 30 30 /// Reduces the sub scopes by one level, so that the right sub scope contains also the right child scopes 31 31 /// of the left sub scope and the left sub scope represents its left child scope. 32 /// 33 /// scope scope 34 /// / | \ / \ 32 /// <pre> 33 /// scope scope 34 /// / | \ / \ 35 35 /// L ... R => A R 36 /// / | \ \ / /\ \ 37 /// A ... LR C C D E F 38 /// /|\ 39 /// D E F 36 /// / | \ \ / /\ \ 37 /// A ... LR C C D E F 38 /// /|\ 39 /// D E F 40 /// </pre> 40 41 /// </summary> 41 42 public class RightChildReducer : ReducerBase {
Note: See TracChangeset
for help on using the changeset viewer.