Changeset 8023
- Timestamp:
- 06/18/12 10:04:24 (13 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/DiscreteCrossover.cs
r8019 r8023 47 47 /// Performs a discrete crossover operation of any number of given parents. 48 48 /// </summary> 49 /// <exception cref="ArgumentException">Thrown when the vectors of the parents are of different length .</exception>49 /// <exception cref="ArgumentException">Thrown when the vectors of the parents are of different length or when there are less than 2 parents.</exception> 50 50 /// <param name="random">A random number generator.</param> 51 51 /// <param name="parents">The list of parents for the crossover operation.</param> 52 52 /// <returns>The newly created integer vector, resulting from the crossover operation.</returns> 53 53 public static IntegerVector Apply(IRandom random, ItemArray<IntegerVector> parents) { 54 if (parents.Length < 2) throw new ArgumentException("DiscreteCrossover: There are less than two parents to cross."); 54 55 int length = parents[0].Length; 55 56 -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.IntegerVectorEncoding-3.3/DiscreteCrossoverTest.cs
r8019 r8023 115 115 // The following test is not based on published examples 116 116 random.Reset(); 117 random. DoubleNumbers = new double[] { 0, 0, 0.9, 0, 0.9};117 random.IntNumbers = new int[] { 0, 0, 1, 0, 1 }; 118 118 parent1 = new IntegerVector(new int[] { 2, 2, 3, 5, 1 }); 119 119 parent2 = new IntegerVector(new int[] { 4, 1, 3, 2, 8 }); … … 124 124 // The following test is not based on published examples 125 125 random.Reset(); 126 random. DoubleNumbers = new double[] { 0, 0, 0.9, 0, 0.9};126 random.IntNumbers = new int[] { 0, 0, 1, 0, 1 }; 127 127 parent1 = new IntegerVector(new int[] { 2, 2, 3, 5, 1, 9 }); // this parent is longer 128 128 parent2 = new IntegerVector(new int[] { 4, 1, 3, 2, 8 });
Note: See TracChangeset
for help on using the changeset viewer.