Changeset 3059
- Timestamp:
- 03/16/10 10:35:28 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3
- Files:
-
- 7 edited
- 8 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Creators/UniformRandomIntegerVectorCreator.cs
r3054 r3059 31 31 /// Generates a new random integer vector with each element uniformly distributed in a specified range. 32 32 /// </summary> 33 [Item("UniformRandomInt VectorCreator", "An operator which creates a new random int vector with each element uniformly distributed in a specified range.")]33 [Item("UniformRandomIntegerVectorCreator", "An operator which creates a new random int vector with each element uniformly distributed in a specified range.")] 34 34 [StorableClass] 35 35 [Creatable("Test")] 36 public class UniformRandomInt VectorCreator : IntVectorCreator {36 public class UniformRandomIntegerVectorCreator : IntegerVectorCreator { 37 37 /// <summary> 38 38 /// Generates a new random integer vector with the given <paramref name="length"/>. … … 43 43 /// <param name="max">The maximum value of the sampling range for each vector element (exclusive).</param> 44 44 /// <returns>The newly created integer vector.</returns> 45 public static Int ArrayApply(IRandom random, int length, int min, int max) {45 public static IntegerVector Apply(IRandom random, int length, int min, int max) { 46 46 int[] result = new int[length]; 47 47 for (int i = 0; i < length; i++) 48 48 result[i] = random.Next(min, max); 49 return new Int Array(result);49 return new IntegerVector(result); 50 50 } 51 51 … … 58 58 /// <param name="maximum">The maximum value of the sampling range for each vector element (exclusive).</param> 59 59 /// <returns>The newly created int vector.</returns> 60 protected override Int ArrayCreate(IRandom random, IntValue length, IntValue minimum, IntValue maximum) {60 protected override IntegerVector Create(IRandom random, IntValue length, IntValue minimum, IntValue maximum) { 61 61 return Apply(random, length.Value, minimum.Value, maximum.Value); 62 62 } -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/DiscreteCrossover.cs
r3053 r3059 36 36 [Item("DiscreteCrossover", "Discrete crossover for integer vectors. It is implemented as described in Gwiazda, T.D. 2006. Genetic algorithms reference Volume I Crossover for single-objective numerical optimization problems, p.17.")] 37 37 [StorableClass] 38 public class DiscreteCrossover : Int VectorCrossover {38 public class DiscreteCrossover : IntegerVectorCrossover { 39 39 /// <summary> 40 40 /// Performs a discrete crossover operation of the two given parents. … … 45 45 /// <param name="parent2">The second parent for the crossover operation.</param> 46 46 /// <returns>The newly created integer vector, resulting from the crossover operation.</returns> 47 public static Int Array Apply(IRandom random, IntArray parent1, IntArrayparent2) {47 public static IntegerVector Apply(IRandom random, IntegerVector parent1, IntegerVector parent2) { 48 48 if(parent1.Length != parent2.Length) 49 49 throw new ArgumentException("DiscreteCrossover: The parents are of different length."); … … 58 58 result[i] = parent2[i]; 59 59 } 60 return new Int Array(result);60 return new IntegerVector(result); 61 61 } 62 62 … … 68 68 /// <param name="parents">An array containing the two integer vectors that should be crossed.</param> 69 69 /// <returns>The newly created integer vector, resulting from the crossover operation.</returns> 70 protected override Int Array Cross(IRandom random, ItemArray<IntArray> parents) {70 protected override IntegerVector Cross(IRandom random, ItemArray<IntegerVector> parents) { 71 71 if (parents.Length != 2) throw new ArgumentException("ERROR in DiscreteCrossover: The number of parents is not equal to 2"); 72 72 return Apply(random, parents[0], parents[1]); -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs
r3053 r3059 36 36 [Item("SinglePointCrossover", "Single point crossover for integer vectors. It is implemented as described in Michalewicz, Z. 1999. Genetic Algorithms + Data Structures = Evolution Programs. Third, Revised and Extended Edition, Spring-Verlag Berlin Heidelberg.")] 37 37 [StorableClass] 38 public class SinglePointCrossover : Int VectorCrossover {38 public class SinglePointCrossover : IntegerVectorCrossover { 39 39 /// <summary> 40 40 /// Performs a single point crossover at a randomly chosen position of the two … … 45 45 /// <param name="parent2">The second parent for crossover.</param> 46 46 /// <returns>The newly created integer vector, resulting from the single point crossover.</returns> 47 public static Int Array Apply(IRandom random, IntArray parent1, IntArrayparent2) {47 public static IntegerVector Apply(IRandom random, IntegerVector parent1, IntegerVector parent2) { 48 48 if (parent1.Length != parent2.Length) 49 49 throw new ArgumentException("DiscreteCrossover: The parents are of different length."); … … 58 58 result[i] = parent2[i]; 59 59 60 return new Int Array(result);60 return new IntegerVector(result); 61 61 } 62 62 … … 69 69 /// <param name="parents">An array containing the two integer vectors that should be crossed.</param> 70 70 /// <returns>The newly created integer vector, resulting from the single point crossover.</returns> 71 protected override Int Array Cross(IRandom random, ItemArray<IntArray> parents) {71 protected override IntegerVector Cross(IRandom random, ItemArray<IntegerVector> parents) { 72 72 if (parents.Length != 2) throw new ArgumentException("ERROR in SinglePointCrossover: The number of parents is not equal to 2"); 73 73 return Apply(random, parents[0], parents[1]); -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/HeuristicLab.Encodings.IntegerVectorEncoding-3.3.csproj
r3054 r3059 79 79 </ItemGroup> 80 80 <ItemGroup> 81 <Compile Include="Creators\UniformRandomInt VectorCreator.cs" />81 <Compile Include="Creators\UniformRandomIntegerVectorCreator.cs" /> 82 82 <Compile Include="Crossovers\DiscreteCrossover.cs"> 83 83 <SubType>Code</SubType> … … 87 87 </Compile> 88 88 <Compile Include="HeuristicLabEncodingsIntegerVectorEncodingPlugin.cs" /> 89 <Compile Include="Interfaces\IInt VectorCreator.cs" />90 <Compile Include="Interfaces\IInt VectorCrossover.cs" />91 <Compile Include="Interfaces\IInt VectorManipulator.cs" />92 <Compile Include="Interfaces\IInt VectorOperator.cs" />93 <Compile Include="Int VectorCrossover.cs" />94 <Compile Include="Int VectorManipulator.cs" />89 <Compile Include="Interfaces\IIntegerVectorCreator.cs" /> 90 <Compile Include="Interfaces\IIntegerVectorCrossover.cs" /> 91 <Compile Include="Interfaces\IIntegerVectorManipulator.cs" /> 92 <Compile Include="Interfaces\IIntegerVectorOperator.cs" /> 93 <Compile Include="IntegerVectorCrossover.cs" /> 94 <Compile Include="IntegerVectorManipulator.cs" /> 95 95 <Compile Include="Manipulators\UniformOnePositionManipulator.cs"> 96 96 <SubType>Code</SubType> … … 98 98 <Compile Include="IntegerVector.cs" /> 99 99 <Compile Include="Properties\AssemblyInfo.cs" /> 100 <Compile Include="Int VectorCreator.cs" />100 <Compile Include="IntegerVectorCreator.cs" /> 101 101 </ItemGroup> 102 102 <ItemGroup> -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorCreator.cs
r3054 r3059 31 31 /// A base class for operators creating int-valued vectors. 32 32 /// </summary> 33 [Item("Int VectorCreator", "A base class for operators creating int-valued vectors.")]33 [Item("IntegerVectorCreator", "A base class for operators creating int-valued vectors.")] 34 34 [StorableClass] 35 public abstract class Int VectorCreator : SingleSuccessorOperator, IIntVectorCreator, IStochasticOperator {35 public abstract class IntegerVectorCreator : SingleSuccessorOperator, IIntegerVectorCreator, IStochasticOperator { 36 36 public ILookupParameter<IRandom> RandomParameter { 37 37 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 38 38 } 39 public ILookupParameter<Int Array> IntVectorParameter {40 get { return (ILookupParameter<Int Array>)Parameters["IntVector"]; }39 public ILookupParameter<IntegerVector> IntegerVectorParameter { 40 get { return (ILookupParameter<IntegerVector>)Parameters["IntegerVector"]; } 41 41 } 42 42 public IValueLookupParameter<IntValue> LengthParameter { … … 50 50 } 51 51 52 protected Int VectorCreator()52 protected IntegerVectorCreator() 53 53 : base() { 54 54 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 55 Parameters.Add(new LookupParameter<Int Array>("IntVector", "The vector which should be manipulated."));55 Parameters.Add(new LookupParameter<IntegerVector>("IntegerVector", "The vector which should be manipulated.")); 56 56 Parameters.Add(new ValueLookupParameter<IntValue>("Length", "The length of the vector.")); 57 57 Parameters.Add(new ValueLookupParameter<IntValue>("Minimum", "The lower bound for each element in the vector.")); … … 60 60 61 61 public sealed override IOperation Apply() { 62 Int VectorParameter.ActualValue = Create(RandomParameter.ActualValue, LengthParameter.ActualValue, MinimumParameter.ActualValue, MaximumParameter.ActualValue);62 IntegerVectorParameter.ActualValue = Create(RandomParameter.ActualValue, LengthParameter.ActualValue, MinimumParameter.ActualValue, MaximumParameter.ActualValue); 63 63 return base.Apply(); 64 64 } 65 65 66 protected abstract Int ArrayCreate(IRandom random, IntValue length, IntValue minimum, IntValue maximum);66 protected abstract IntegerVector Create(IRandom random, IntValue length, IntValue minimum, IntValue maximum); 67 67 } 68 68 } -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorCrossover.cs
r3054 r3059 31 31 /// A base class for operators that perform a crossover of int-valued vectors. 32 32 /// </summary> 33 [Item("Int VectorCrossover", "A base class for operators that perform a crossover of int-valued vectors.")]33 [Item("IntegerVectorCrossover", "A base class for operators that perform a crossover of int-valued vectors.")] 34 34 [StorableClass] 35 public abstract class Int VectorCrossover : SingleSuccessorOperator, IIntVectorCrossover, IStochasticOperator {35 public abstract class IntegerVectorCrossover : SingleSuccessorOperator, IIntegerVectorCrossover, IStochasticOperator { 36 36 public ILookupParameter<IRandom> RandomParameter { 37 37 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 38 38 } 39 public ILookupParameter<ItemArray<Int Array>> ParentsParameter {40 get { return (SubScopesLookupParameter<Int Array>)Parameters["Parents"]; }39 public ILookupParameter<ItemArray<IntegerVector>> ParentsParameter { 40 get { return (SubScopesLookupParameter<IntegerVector>)Parameters["Parents"]; } 41 41 } 42 public ILookupParameter<Int Array> ChildParameter {43 get { return (ILookupParameter<Int Array>)Parameters["Child"]; }42 public ILookupParameter<IntegerVector> ChildParameter { 43 get { return (ILookupParameter<IntegerVector>)Parameters["Child"]; } 44 44 } 45 45 46 protected Int VectorCrossover()46 protected IntegerVectorCrossover() 47 47 : base() { 48 48 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic crossover operators.")); 49 Parameters.Add(new SubScopesLookupParameter<Int Array>("Parents", "The parent vectors which should be crossed."));50 Parameters.Add(new LookupParameter<Int Array>("Child", "The child vector resulting from the crossover."));49 Parameters.Add(new SubScopesLookupParameter<IntegerVector>("Parents", "The parent vectors which should be crossed.")); 50 Parameters.Add(new LookupParameter<IntegerVector>("Child", "The child vector resulting from the crossover.")); 51 51 } 52 52 … … 56 56 } 57 57 58 protected abstract Int Array Cross(IRandom random, ItemArray<IntArray> parents);58 protected abstract IntegerVector Cross(IRandom random, ItemArray<IntegerVector> parents); 59 59 } 60 60 } -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorManipulator.cs
r3054 r3059 31 31 /// A base class for operators that manipulate int-valued vectors. 32 32 /// </summary> 33 [Item("Int VectorManipulator", "A base class for operators that manipulate int-valued vectors.")]33 [Item("IntegerVectorManipulator", "A base class for operators that manipulate int-valued vectors.")] 34 34 [StorableClass] 35 public abstract class Int VectorManipulator : SingleSuccessorOperator, IIntVectorManipulator, IStochasticOperator {35 public abstract class IntegerVectorManipulator : SingleSuccessorOperator, IIntegerVectorManipulator, IStochasticOperator { 36 36 public ILookupParameter<IRandom> RandomParameter { 37 37 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 38 38 } 39 public ILookupParameter<Int Array> IntVectorParameter {40 get { return (ILookupParameter<Int Array>)Parameters["IntVector"]; }39 public ILookupParameter<IntegerVector> IntegerVectorParameter { 40 get { return (ILookupParameter<IntegerVector>)Parameters["IntegerVector"]; } 41 41 } 42 42 43 protected Int VectorManipulator()43 protected IntegerVectorManipulator() 44 44 : base() { 45 45 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 46 Parameters.Add(new LookupParameter<Int Array>("IntVector", "The vector which should be manipulated."));46 Parameters.Add(new LookupParameter<IntegerVector>("IntegerVector", "The vector which should be manipulated.")); 47 47 } 48 48 49 49 public sealed override IOperation Apply() { 50 Manipulate(RandomParameter.ActualValue, Int VectorParameter.ActualValue);50 Manipulate(RandomParameter.ActualValue, IntegerVectorParameter.ActualValue); 51 51 return base.Apply(); 52 52 } 53 53 54 protected abstract void Manipulate(IRandom random, Int Array intVector);54 protected abstract void Manipulate(IRandom random, IntegerVector integerVector); 55 55 } 56 56 } -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Interfaces/IIntegerVectorCreator.cs
r3054 r3059 28 28 /// An interface which represents an operator for creating vectors of int-valued data. 29 29 /// </summary> 30 public interface IInt VectorCreator : IIntVectorOperator, ISolutionCreator {30 public interface IIntegerVectorCreator : IIntegerVectorOperator, ISolutionCreator { 31 31 IValueLookupParameter<IntValue> LengthParameter { get; } 32 32 IValueLookupParameter<IntValue> MinimumParameter { get; } 33 33 IValueLookupParameter<IntValue> MaximumParameter { get; } 34 ILookupParameter<Int Array> IntVectorParameter { get; }34 ILookupParameter<IntegerVector> IntegerVectorParameter { get; } 35 35 } 36 36 } -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Interfaces/IIntegerVectorCrossover.cs
r3054 r3059 28 28 /// An interface which represents an operator for crossing vectors of int-valued data. 29 29 /// </summary> 30 public interface IInt VectorCrossover : IIntVectorOperator, ICrossover {31 ILookupParameter<ItemArray<Int Array>> ParentsParameter { get; }32 ILookupParameter<Int Array> ChildParameter { get; }30 public interface IIntegerVectorCrossover : IIntegerVectorOperator, ICrossover { 31 ILookupParameter<ItemArray<IntegerVector>> ParentsParameter { get; } 32 ILookupParameter<IntegerVector> ChildParameter { get; } 33 33 } 34 34 } -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Interfaces/IIntegerVectorManipulator.cs
r3054 r3059 28 28 /// An interface which represents an operator for manipulating vectors of int-valued data. 29 29 /// </summary> 30 public interface IInt VectorManipulator : IIntVectorOperator, IManipulator {31 ILookupParameter<Int Array> IntVectorParameter { get; }30 public interface IIntegerVectorManipulator : IIntegerVectorOperator, IManipulator { 31 ILookupParameter<IntegerVector> IntegerVectorParameter { get; } 32 32 } 33 33 } -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Interfaces/IIntegerVectorOperator.cs
r3054 r3059 26 26 /// An interface which represents an operator dealing with vectors of int-valued data. 27 27 /// </summary> 28 public interface IInt VectorOperator : IOperator { }28 public interface IIntegerVectorOperator : IOperator { } 29 29 } -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Manipulators/UniformOnePositionManipulator.cs
r3053 r3059 32 32 /// Uniformly distributed change of a single position of an integer vector. 33 33 /// </summary> 34 /// It is implemented as described in Michalewicz, Z. 1999. Genetic Algorithms + Data Structures = Evolution Programs. Third, Revised and Extended Edition, Spring-Verlag Berlin Heidelberg.35 34 /// <remarks> 36 35 /// It is implemented as described in Michalewicz, Z. 1999. Genetic Algorithms + Data Structures = Evolution Programs. Third, Revised and Extended Edition, Spring-Verlag Berlin Heidelberg. … … 38 37 [Item("UniformOnePositionManipulator", " Uniformly distributed change of a single position of an integer vector. It is implemented as described in Michalewicz, Z. 1999. Genetic Algorithms + Data Structures = Evolution Programs. Third, Revised and Extended Edition, Spring-Verlag Berlin Heidelberg.")] 39 38 [StorableClass] 40 public class UniformOnePositionManipulator : Int VectorManipulator {39 public class UniformOnePositionManipulator : IntegerVectorManipulator { 41 40 /// <summary> 42 41 /// The lower bound of the values in the int vector. … … 70 69 /// <param name="max">The maximum value of the sampling range for 71 70 /// the vector element to change (exclusive).</param> 72 public static void Apply(IRandom random, Int Arrayvector, IntValue min, IntValue max) {71 public static void Apply(IRandom random, IntegerVector vector, IntValue min, IntValue max) { 73 72 int index = random.Next(vector.Length); 74 73 vector[index] = random.Next(min.Value, max.Value); … … 81 80 /// <param name="random">A random number generator.</param> 82 81 /// <param name="vector">The integer vector to manipulate.</param> 83 protected override void Manipulate(IRandom random, Int Arrayvector) {82 protected override void Manipulate(IRandom random, IntegerVector vector) { 84 83 if (MinimumParameter.ActualValue == null) throw new InvalidOperationException("UniformOnePositionManipulator: Parameter " + MinimumParameter.ActualName + " could not be found."); 85 84 if (MaximumParameter.ActualValue == null) throw new InvalidOperationException("UniformOnePositionManipulator: Parameter " + MaximumParameter.ActualName + " could not be found."); -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Tests/DiscreteCrossoverTest.cs
r3053 r3059 68 68 public void DiscreteCrossoverCrossTest() { 69 69 DiscreteCrossover_Accessor target = new DiscreteCrossover_Accessor(new PrivateObject(typeof(DiscreteCrossover))); 70 ItemArray<Int Array> parents;70 ItemArray<IntegerVector> parents; 71 71 TestRandom random = new TestRandom(); 72 72 bool exceptionFired; 73 73 // The following test checks if there is an exception when there are less than 2 parents 74 74 random.Reset(); 75 parents = new ItemArray<Int Array>(new IntArray[] { new IntArray(4) });75 parents = new ItemArray<IntegerVector>(new IntegerVector[] { new IntegerVector(4) }); 76 76 exceptionFired = false; 77 77 try { … … 90 90 public void DiscreteCrossoverApplyTest() { 91 91 TestRandom random = new TestRandom(); 92 Int Arrayparent1, parent2, expected, actual;92 IntegerVector parent1, parent2, expected, actual; 93 93 bool exceptionFired; 94 94 // The following test is not based on published examples 95 95 random.Reset(); 96 96 random.DoubleNumbers = new double[] { 0, 0, 0.9, 0, 0.9 }; 97 parent1 = new Int Array(new int[] { 2, 2, 3, 5, 1 });98 parent2 = new Int Array(new int[] { 4, 1, 3, 2, 8 });99 expected = new Int Array(new int[] { 2, 2, 3, 5, 8 });97 parent1 = new IntegerVector(new int[] { 2, 2, 3, 5, 1 }); 98 parent2 = new IntegerVector(new int[] { 4, 1, 3, 2, 8 }); 99 expected = new IntegerVector(new int[] { 2, 2, 3, 5, 8 }); 100 100 actual = DiscreteCrossover.Apply(random, parent1, parent2); 101 101 Assert.IsTrue(Auxiliary.IntVectorIsEqualByPosition(actual, expected)); … … 104 104 random.Reset(); 105 105 random.DoubleNumbers = new double[] { 0, 0, 0.9, 0, 0.9 }; 106 parent1 = new Int Array(new int[] { 2, 2, 3, 5, 1, 9 }); // this parent is longer107 parent2 = new Int Array(new int[] { 4, 1, 3, 2, 8 });106 parent1 = new IntegerVector(new int[] { 2, 2, 3, 5, 1, 9 }); // this parent is longer 107 parent2 = new IntegerVector(new int[] { 4, 1, 3, 2, 8 }); 108 108 exceptionFired = false; 109 109 try { -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Tests/SinglePointCrossoverTest.cs
r3053 r3059 68 68 public void SinglePointCrossoverCrossTest() { 69 69 SinglePointCrossover_Accessor target = new SinglePointCrossover_Accessor(new PrivateObject(typeof(SinglePointCrossover))); 70 ItemArray<Int Array> parents;70 ItemArray<IntegerVector> parents; 71 71 TestRandom random = new TestRandom(); 72 72 bool exceptionFired; 73 73 // The following test checks if there is an exception when there are more than 2 parents 74 74 random.Reset(); 75 parents = new ItemArray<Int Array>(new IntArray[] { new IntArray(5), new IntArray(6), new IntArray(4) });75 parents = new ItemArray<IntegerVector>(new IntegerVector[] { new IntegerVector(5), new IntegerVector(6), new IntegerVector(4) }); 76 76 exceptionFired = false; 77 77 try { 78 Int Arrayactual;78 IntegerVector actual; 79 79 actual = target.Cross(random, parents); 80 80 } … … 85 85 // The following test checks if there is an exception when there are less than 2 parents 86 86 random.Reset(); 87 parents = new ItemArray<Int Array>(new IntArray[] { new IntArray(4) });87 parents = new ItemArray<IntegerVector>(new IntegerVector[] { new IntegerVector(4) }); 88 88 exceptionFired = false; 89 89 try { 90 Int Arrayactual;90 IntegerVector actual; 91 91 actual = target.Cross(random, parents); 92 92 } catch (System.ArgumentException) { … … 102 102 public void SinglePointCrossoverApplyTest() { 103 103 TestRandom random = new TestRandom(); 104 Int Arrayparent1, parent2, expected, actual;104 IntegerVector parent1, parent2, expected, actual; 105 105 bool exceptionFired; 106 106 // The following test is not based on published examples 107 107 random.Reset(); 108 108 random.IntNumbers = new int[] { 3 }; 109 parent1 = new Int Array(new int[] { 2, 2, 3, 5, 1 });110 parent2 = new Int Array(new int[] { 4, 1, 3, 2, 8 });111 expected = new Int Array(new int[] { 2, 2, 3, 2, 8 });109 parent1 = new IntegerVector(new int[] { 2, 2, 3, 5, 1 }); 110 parent2 = new IntegerVector(new int[] { 4, 1, 3, 2, 8 }); 111 expected = new IntegerVector(new int[] { 2, 2, 3, 2, 8 }); 112 112 actual = SinglePointCrossover.Apply(random, parent1, parent2); 113 113 Assert.IsTrue(Auxiliary.IntVectorIsEqualByPosition(actual, expected)); … … 115 115 random.Reset(); 116 116 random.IntNumbers = new int[] { 2 }; 117 parent1 = new Int Array(new int[] { 2, 2, 3, 5, 1, 9 }); // this parent is longer118 parent2 = new Int Array(new int[] { 4, 1, 3, 2, 8 });117 parent1 = new IntegerVector(new int[] { 2, 2, 3, 5, 1, 9 }); // this parent is longer 118 parent2 = new IntegerVector(new int[] { 4, 1, 3, 2, 8 }); 119 119 exceptionFired = false; 120 120 try { -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Tests/UniformOnePositionManipulatorTest.cs
r3053 r3059 85 85 public void UniformOnePositionManipulatorApplyTest() { 86 86 TestRandom random = new TestRandom(); 87 Int Arrayparent, expected;87 IntegerVector parent, expected; 88 88 IntValue min, max; 89 89 // The following test is not based on published examples 90 90 random.Reset(); 91 91 random.IntNumbers = new int[] { 3, 3 }; 92 parent = new Int Array(new int[] { 2, 2, 3, 5, 1 });93 expected = new Int Array(new int[] { 2, 2, 3, 3, 1 });92 parent = new IntegerVector(new int[] { 2, 2, 3, 5, 1 }); 93 expected = new IntegerVector(new int[] { 2, 2, 3, 3, 1 }); 94 94 min = new IntValue(2); 95 95 max = new IntValue(7);
Note: See TracChangeset
for help on using the changeset viewer.