Changeset 13408 for branches/ProblemRefactoring
- Timestamp:
- 11/26/15 17:36:54 (9 years ago)
- Location:
- branches/ProblemRefactoring/HeuristicLab.Tests
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/Samples/EsGriewankSampleTest.cs
r12012 r13408 62 62 SingleObjectiveTestFunctionProblem problem = new SingleObjectiveTestFunctionProblem(); 63 63 64 problem.ProblemSize .Value= 10;65 problem. EvaluatorParameter.Value = new GriewankEvaluator();64 problem.ProblemSize = 10; 65 problem.TestFunction = new Griewank(); 66 66 problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator(); 67 problem.Maximization.Value = false;68 67 problem.Bounds = new DoubleMatrix(new double[,] { { -600, 600 } }); 69 problem.BestKnownQuality .Value= 0;68 problem.BestKnownQuality = 0; 70 69 problem.BestKnownSolutionParameter.Value = new RealVector(10); 71 70 problem.Name = "Single Objective Test Function"; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/Samples/LocalSearchKnapsackSampleTest.cs
r12012 r13408 59 59 #region Problem Configuration 60 60 KnapsackProblem problem = new KnapsackProblem(); 61 problem.BestKnownQuality = new DoubleValue(362);61 problem.BestKnownQuality = 362; 62 62 problem.BestKnownSolution = new HeuristicLab.Encodings.BinaryVectorEncoding.BinaryVector(new bool[] { 63 63 true , false, false, true , true , true , true , true , false, true , true , true , true , true , true , false, true , false, true , true , false, true , true , false, true , false, true , true , true , false, true , true , false, true , true , false, true , false, true , true , true , true , true , true , true , true , true , true , true , true , true , false, true , false, false, true , true , false, true , true , true , true , true , true , true , true , false, true , false, true , true , true , true , false, true , true , true , true , true , true , true , true}); 64 problem.EvaluatorParameter.Value = new KnapsackEvaluator();65 64 problem.SolutionCreatorParameter.Value = new RandomBinaryVectorCreator(); 66 problem.KnapsackCapacity.Value = 297; 67 problem.Maximization.Value = true; 68 problem.Penalty.Value = 1; 65 problem.KnapsackCapacity = 297; 69 66 problem.Values = new IntArray(new int[] { 70 67 6, 1, 1, 6, 7, 8, 7, 4, 2, 5, 2, 6, 7, 8, 7, 1, 7, 1, 9, 4, 2, 6, 5, 3, 5, 3, 3, 6, 5, 2, 4, 9, 4, 5, 7, 1, 4, 3, 5, 5, 8, 3, 6, 7, 3, 9, 7, 7, 5, 5, 7, 1, 4, 4, 3, 9, 5, 1, 6, 2, 2, 6, 1, 6, 5, 4, 4, 7, 1, 8, 9, 9, 7, 4, 3, 8, 7, 5, 7, 4, 4, 5}); -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/Samples/OSESGriewankSampleTest.cs
r13237 r13408 21 21 22 22 using System.IO; 23 using HeuristicLab.Algorithms.EvolutionStrategy;24 23 using HeuristicLab.Algorithms.OffspringSelectionEvolutionStrategy; 25 24 using HeuristicLab.Data; … … 63 62 SingleObjectiveTestFunctionProblem problem = new SingleObjectiveTestFunctionProblem(); 64 63 65 problem.ProblemSize .Value= 10;66 problem. EvaluatorParameter.Value = new GriewankEvaluator();64 problem.ProblemSize = 10; 65 problem.TestFunction = new Griewank(); 67 66 problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator(); 68 problem.Maximization.Value = false;69 67 problem.Bounds = new DoubleMatrix(new double[,] { { -600, 600 } }); 70 problem.BestKnownQuality .Value= 0;68 problem.BestKnownQuality = 0; 71 69 problem.BestKnownSolutionParameter.Value = new RealVector(10); 72 70 problem.Name = "Single Objective Test Function"; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/Samples/PsoSchwefelSampleTest.cs
r12012 r13408 68 68 #region Problem Configuration 69 69 var problem = new SingleObjectiveTestFunctionProblem(); 70 problem.BestKnownQuality .Value= 0.0;70 problem.BestKnownQuality = 0.0; 71 71 problem.BestKnownSolutionParameter.Value = new RealVector(new double[] { 420.968746, 420.968746 }); 72 72 problem.Bounds = new DoubleMatrix(new double[,] { { -500, 500 } }); 73 problem.EvaluatorParameter.Value = new SchwefelEvaluator(); 74 problem.Maximization.Value = false; 75 problem.ProblemSize.Value = 2; 73 problem.TestFunction = new Schwefel(); 74 problem.ProblemSize = 2; 76 75 problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator(); 77 76 #endregion -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab-3.3/Samples/SimulatedAnnealingRastriginSampleTest.cs
r12012 r13408 57 57 #region Problem Configuration 58 58 var problem = new SingleObjectiveTestFunctionProblem(); 59 problem.BestKnownQuality .Value= 0.0;59 problem.BestKnownQuality = 0.0; 60 60 problem.BestKnownSolutionParameter.Value = new RealVector(new double[] { 0, 0 }); 61 61 problem.Bounds = new DoubleMatrix(new double[,] { { -5.12, 5.12 } }); 62 problem.EvaluatorParameter.Value = new RastriginEvaluator(); 63 problem.Maximization.Value = false; 64 problem.ProblemSize.Value = 2; 62 problem.TestFunction= new Rastrigin(); 63 problem.ProblemSize = 2; 65 64 problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator(); 66 65 #endregion … … 79 78 sa.MaximumIterations.Value = 100; 80 79 var moveEvaluator = sa.MoveEvaluatorParameter.ValidValues 81 .OfType< RastriginAdditiveMoveEvaluator>()80 .OfType<AdditiveMoveEvaluator>() 82 81 .Single(); 83 moveEvaluator.A.Value = 10;84 82 sa.MoveEvaluator = moveEvaluator; 85 83 -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.QuadraticAssignment-3.3/QAPLIBInstancesTest.cs
r12012 r13408 223 223 qap.Load(provider.LoadData(instance)); 224 224 if (qaplibInstances.ContainsKey(instance.Name) 225 && qap.BestKnownQuality != null && qap.BestKnownQuality .Value!= qaplibInstances[instance.Name])226 failedInstances.AppendLine(instance.Name + ": " + qap.BestKnownQuality. Value.ToString() + " vs " + qaplibInstances[instance.Name]);225 && qap.BestKnownQuality != null && qap.BestKnownQuality != qaplibInstances[instance.Name]) 226 failedInstances.AppendLine(instance.Name + ": " + qap.BestKnownQuality.ToString() + " vs " + qaplibInstances[instance.Name]); 227 227 } 228 228 Assert.IsTrue(failedInstances.Length == 0, "Following instances/solutions have suspicious best quality: " + Environment.NewLine + failedInstances.ToString()); -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.QuadraticAssignment-3.3/QAPMoveEvaluatorTest.cs
r12012 r13408 35 35 private const int ProblemSize = 10; 36 36 private static DoubleMatrix symmetricDistances, symmetricWeights, asymmetricDistances, asymmetricWeights, nonZeroDiagonalWeights, nonZeroDiagonalDistances; 37 38 private static QuadraticAssignmentProblem symmetricProblem, asymmetricProblem, nonZeroDiagonalProblem; 37 39 private static Permutation assignment; 38 40 private static MersenneTwister random; … … 82 84 nonZeroDiagonalWeights[index, index] = random.Next(1, ProblemSize * 100); 83 85 assignment = new Permutation(PermutationTypes.Absolute, ProblemSize, random); 86 87 symmetricProblem = new QuadraticAssignmentProblem(); 88 symmetricProblem.Distances = symmetricDistances; 89 symmetricProblem.Weights = symmetricWeights; 90 91 asymmetricProblem = new QuadraticAssignmentProblem(); 92 asymmetricProblem.Distances = asymmetricDistances; 93 asymmetricProblem.Weights = asymmetricWeights; 94 95 nonZeroDiagonalProblem = new QuadraticAssignmentProblem(); 96 nonZeroDiagonalProblem.Distances = nonZeroDiagonalDistances; 97 nonZeroDiagonalProblem.Weights = nonZeroDiagonalWeights; 84 98 } 85 99 … … 88 102 [TestProperty("Time", "short")] 89 103 public void Swap2MoveEvaluatorFastEvaluationTest() { 90 91 104 for (int i = 0; i < 500; i++) { 92 105 Swap2Move lastMove = new Swap2Move(random.Next(ProblemSize), random.Next(ProblemSize)); … … 100 113 double moveAfter = QAPSwap2MoveEvaluator.Apply(assignment, currentMove, 101 114 moveBefore, symmetricWeights, symmetricDistances, lastMove); 102 double before = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);103 double after = QAPEvaluator.Apply(nextAssignment, symmetricWeights, symmetricDistances);115 double before = symmetricProblem.Evaluate(assignment); 116 double after = symmetricProblem.Evaluate(nextAssignment); 104 117 105 118 Assert.IsTrue(moveAfter.IsAlmost(after - before), "Failed on symmetric matrices: " + Environment.NewLine … … 109 122 moveAfter = QAPSwap2MoveEvaluator.Apply(assignment, currentMove, 110 123 moveBefore, asymmetricWeights, asymmetricDistances, lastMove); 111 before = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);112 after = QAPEvaluator.Apply(nextAssignment, asymmetricWeights, asymmetricDistances);124 before = asymmetricProblem.Evaluate(assignment); 125 after = asymmetricProblem.Evaluate(nextAssignment); 113 126 114 127 Assert.IsTrue(moveAfter.IsAlmost(after - before), "Failed on asymmetric matrices: " + Environment.NewLine … … 118 131 moveAfter = QAPSwap2MoveEvaluator.Apply(assignment, currentMove, 119 132 moveBefore, nonZeroDiagonalWeights, nonZeroDiagonalDistances, lastMove); 120 before = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);121 after = QAPEvaluator.Apply(nextAssignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);133 before = nonZeroDiagonalProblem.Evaluate(assignment); 134 after = nonZeroDiagonalProblem.Evaluate(nextAssignment); 122 135 123 136 Assert.IsTrue(moveAfter.IsAlmost(after - before), "Failed on non-zero diagonal matrices: " + Environment.NewLine … … 130 143 [TestProperty("Time", "short")] 131 144 public void Swap2MoveEvaluatorTest() { 145 132 146 for (int i = 0; i < 500; i++) { 133 147 int index1 = random.Next(ProblemSize); … … 135 149 136 150 // SYMMETRIC MATRICES 137 double before = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);151 double before = symmetricProblem.Evaluate(assignment); 138 152 Swap2Manipulator.Apply(assignment, index1, index2); 139 double after = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);153 double after = symmetricProblem.Evaluate(assignment); 140 154 double move = QAPSwap2MoveEvaluator.Apply(assignment, new Swap2Move(index1, index2, assignment), symmetricWeights, symmetricDistances); 141 155 Assert.IsTrue(move.IsAlmost(before - after), "Failed on symmetric matrices"); 142 156 143 157 // ASYMMETRIC MATRICES 144 before = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);158 before = asymmetricProblem.Evaluate(assignment); 145 159 Permutation clone = (Permutation)assignment.Clone(); 146 160 Swap2Manipulator.Apply(assignment, index1, index2); 147 after = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);161 after = asymmetricProblem.Evaluate(assignment); 148 162 move = QAPSwap2MoveEvaluator.Apply(clone, new Swap2Move(index1, index2), asymmetricWeights, asymmetricDistances); 149 163 Assert.IsTrue(move.IsAlmost(after - before), "Failed on asymmetric matrices"); 150 164 151 165 // NON-ZERO DIAGONAL ASSYMETRIC MATRICES 152 before = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);166 before = nonZeroDiagonalProblem.Evaluate(assignment); 153 167 clone = (Permutation)assignment.Clone(); 154 168 Swap2Manipulator.Apply(assignment, index1, index2); 155 after = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);169 after = nonZeroDiagonalProblem.Evaluate(assignment); 156 170 move = QAPSwap2MoveEvaluator.Apply(clone, new Swap2Move(index1, index2), nonZeroDiagonalWeights, nonZeroDiagonalDistances); 157 171 Assert.IsTrue(move.IsAlmost(after - before), "Failed on non-zero diagonal matrices"); … … 169 183 170 184 // SYMMETRIC MATRICES 171 double before = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);185 double before = symmetricProblem.Evaluate(assignment); 172 186 InversionManipulator.Apply(assignment, Math.Min(index1, index2), Math.Max(index1, index2)); 173 double after = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);187 double after = symmetricProblem.Evaluate(assignment); 174 188 double move = QAPInversionMoveEvaluator.Apply(assignment, new InversionMove(index1, index2, assignment), symmetricWeights, symmetricDistances); 175 189 Assert.IsTrue(move.IsAlmost(before - after), "Failed on symmetric matrices"); 176 190 177 191 // ASYMMETRIC MATRICES 178 before = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);192 before = asymmetricProblem.Evaluate(assignment); 179 193 Permutation clone = (Permutation)assignment.Clone(); 180 194 InversionManipulator.Apply(assignment, index1, index2); 181 after = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);195 after = asymmetricProblem.Evaluate(assignment); 182 196 move = QAPInversionMoveEvaluator.Apply(clone, new InversionMove(index1, index2), asymmetricWeights, asymmetricDistances); 183 197 Assert.IsTrue(move.IsAlmost(after - before), "Failed on asymmetric matrices"); 184 198 185 199 // NON-ZERO DIAGONAL ASYMMETRIC MATRICES 186 before = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);200 before = nonZeroDiagonalProblem.Evaluate(assignment); 187 201 clone = (Permutation)assignment.Clone(); 188 202 InversionManipulator.Apply(assignment, index1, index2); 189 after = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);203 after = nonZeroDiagonalProblem.Evaluate(assignment); 190 204 move = QAPInversionMoveEvaluator.Apply(clone, new InversionMove(index1, index2), nonZeroDiagonalWeights, nonZeroDiagonalDistances); 191 205 Assert.IsTrue(move.IsAlmost(after - before), "Failed on non-zero diagonal matrices"); … … 208 222 209 223 // SYMMETRIC MATRICES 210 double before = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);224 double before = symmetricProblem.Evaluate(assignment); 211 225 Permutation clone = new Cloner().Clone(assignment); 212 226 TranslocationManipulator.Apply(assignment, index1, index2, insertPoint); 213 double after = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);227 double after = symmetricProblem.Evaluate(assignment); 214 228 double move = QAPTranslocationMoveEvaluator.Apply(clone, new TranslocationMove(index1, index2, insertPoint, assignment), symmetricWeights, symmetricDistances); 215 229 Assert.IsTrue(move.IsAlmost(after - before), "Failed on symmetric matrices"); 216 230 217 231 // ASYMMETRIC MATRICES 218 before = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);232 before = asymmetricProblem.Evaluate(assignment); 219 233 clone = new Cloner().Clone(assignment); 220 234 TranslocationManipulator.Apply(assignment, index1, index2, insertPoint); 221 after = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);235 after = asymmetricProblem.Evaluate(assignment); 222 236 move = QAPTranslocationMoveEvaluator.Apply(clone, new TranslocationMove(index1, index2, insertPoint, assignment), asymmetricWeights, asymmetricDistances); 223 237 Assert.IsTrue(move.IsAlmost(after - before), "Failed on asymmetric matrices"); 224 238 225 239 // NON-ZERO DIAGONAL ASYMMETRIC MATRICES 226 before = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);240 before = nonZeroDiagonalProblem.Evaluate(assignment); 227 241 clone = new Cloner().Clone(assignment); 228 242 TranslocationManipulator.Apply(assignment, index1, index2, insertPoint); 229 after = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);243 after = nonZeroDiagonalProblem.Evaluate(assignment); 230 244 move = QAPTranslocationMoveEvaluator.Apply(clone, new TranslocationMove(index1, index2, insertPoint, assignment), nonZeroDiagonalWeights, nonZeroDiagonalDistances); 231 245 Assert.IsTrue(move.IsAlmost(after - before), "Failed on non-zero diagonal matrices"); … … 241 255 242 256 // SYMMETRIC MATRICES 243 double before = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);257 double before = symmetricProblem.Evaluate(assignment); 244 258 double move = QAPScrambleMoveEvaluator.Apply(assignment, scramble, symmetricWeights, symmetricDistances); 245 259 ScrambleManipulator.Apply(assignment, scramble.StartIndex, scramble.ScrambledIndices); 246 double after = QAPEvaluator.Apply(assignment, symmetricWeights, symmetricDistances);260 double after = symmetricProblem.Evaluate(assignment); 247 261 Assert.IsTrue(move.IsAlmost(after - before), "Failed on symmetric matrices"); 248 262 249 263 // ASYMMETRIC MATRICES 250 before = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);264 before = asymmetricProblem.Evaluate(assignment); 251 265 move = QAPScrambleMoveEvaluator.Apply(assignment, scramble, asymmetricWeights, asymmetricDistances); 252 266 ScrambleManipulator.Apply(assignment, scramble.StartIndex, scramble.ScrambledIndices); 253 after = QAPEvaluator.Apply(assignment, asymmetricWeights, asymmetricDistances);267 after = asymmetricProblem.Evaluate(assignment); 254 268 Assert.IsTrue(move.IsAlmost(after - before), "Failed on asymmetric matrices"); 255 269 256 270 // NON-ZERO DIAGONAL ASYMMETRIC MATRICES 257 before = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);271 before = nonZeroDiagonalProblem.Evaluate(assignment); 258 272 move = QAPScrambleMoveEvaluator.Apply(assignment, scramble, nonZeroDiagonalWeights, nonZeroDiagonalDistances); 259 273 ScrambleManipulator.Apply(assignment, scramble.StartIndex, scramble.ScrambledIndices); 260 after = QAPEvaluator.Apply(assignment, nonZeroDiagonalWeights, nonZeroDiagonalDistances);274 after = nonZeroDiagonalProblem.Evaluate(assignment); 261 275 Assert.IsTrue(move.IsAlmost(after - before), "Failed on non-zero diagonal matrices"); 262 276 } -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/AckleyEvaluatorTest.cs
r13235 r13408 37 37 [TestProperty("Time", "short")] 38 38 public void AckleyEvaluateFunctionTest() { 39 AckleyEvaluator target = new AckleyEvaluator();39 var target = new Ackley(); 40 40 RealVector point = null; 41 41 double expected = target.BestKnownQuality; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/BealeEvaluatorTest.cs
r13235 r13408 37 37 [TestProperty("Time", "short")] 38 38 public void BealeEvaluateFunctionTest() { 39 BealeEvaluator target = new BealeEvaluator();39 var target = new Beale(); 40 40 RealVector point = null; 41 41 double expected = target.BestKnownQuality; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/BoothEvaluatorTest.cs
r13235 r13408 37 37 [TestProperty("Time", "short")] 38 38 public void BoothEvaluateFunctionTest() { 39 BoothEvaluator target = new BoothEvaluator();39 var target = new Booth(); 40 40 RealVector point = null; 41 41 double expected = target.BestKnownQuality; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/GriewankEvaluatorTest.cs
r13235 r13408 37 37 [TestProperty("Time", "short")] 38 38 public void GriewankEvaluateFunctionTest() { 39 GriewankEvaluator target = new GriewankEvaluator();39 var target = new Griewank(); 40 40 RealVector point = null; 41 41 double expected = target.BestKnownQuality; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/LevyEvaluatorTest.cs
r13235 r13408 37 37 [TestProperty("Time", "short")] 38 38 public void LevyEvaluateFunctionTest() { 39 LevyEvaluator target = new LevyEvaluator();39 var target = new Levy(); 40 40 RealVector point = null; 41 41 double expected = target.BestKnownQuality; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/MatyasEvaluatorTest.cs
r13235 r13408 37 37 [TestProperty("Time", "short")] 38 38 public void MatyasEvaluateFunctionTest() { 39 MatyasEvaluator target = new MatyasEvaluator();39 var target = new Matyas(); 40 40 RealVector point = null; 41 41 double expected = target.BestKnownQuality; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/RastriginEvaluatorTest.cs
r13235 r13408 37 37 [TestProperty("Time", "short")] 38 38 public void RastriginEvaluateFunctionTest() { 39 RastriginEvaluator target = new RastriginEvaluator();39 var target = new Rastrigin(); 40 40 RealVector point = null; 41 41 double expected = target.BestKnownQuality; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/RosenbrockEvaluatorTest.cs
r13235 r13408 37 37 [TestProperty("Time", "short")] 38 38 public void RosenbrockEvaluateFunctionTest() { 39 RosenbrockEvaluator target = new RosenbrockEvaluator();39 var target = new Rosenbrock(); 40 40 RealVector point = null; 41 41 double expected = target.BestKnownQuality; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/SphereEvaluatorTest.cs
r13235 r13408 37 37 [TestProperty("Time", "short")] 38 38 public void SphereEvaluateFunctionTest() { 39 SphereEvaluator target = new SphereEvaluator();39 var target = new Sphere(); 40 40 RealVector point = null; 41 41 double expected = target.BestKnownQuality; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/SumSquaresEvaluatorTest.cs
r13235 r13408 37 37 [TestProperty("Time", "short")] 38 38 public void SumSquaresEvaluateFunctionTest() { 39 SumSquaresEvaluator target = new SumSquaresEvaluator();39 var target = new SumSquares(); 40 40 RealVector point = null; 41 41 double expected = target.BestKnownQuality; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/ZakharovEvaluatorTest.cs
r13235 r13408 37 37 [TestProperty("Time", "short")] 38 38 public void ZakharovEvaluateFunctionTest() { 39 ZakharovEvaluator target = new ZakharovEvaluator();39 var target = new Zakharov(); 40 40 RealVector point = null; 41 41 double expected = target.BestKnownQuality; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/Script Sources/GAQAPScriptSource.cs
r11789 r13408 42 42 for (int i = 0; i < popSize; i++) { 43 43 population[i] = new Permutation(PermutationTypes.Absolute, qap.Weights.Rows, random); 44 qualities[i] = QAPEvaluator.Apply(population[i], qap.Weights, qap.Distances);44 qualities[i] = qap.Evaluate(population[i]); 45 45 } 46 46 var bestQuality = qualities.Min(); … … 52 52 nextGen[i] = PartiallyMatchedCrossover.Apply(random, parents[i * 2], parents[i * 2 + 1]); 53 53 if (random.NextDouble() < mutationRate) Swap2Manipulator.Apply(random, nextGen[i]); 54 nextQual[i] = QAPEvaluator.Apply(nextGen[i], qap.Weights, qap.Distances);54 nextQual[i] = qap.Evaluate(nextGen[i]); 55 55 if (nextQual[i] < bestQuality) { 56 56 bestQuality = nextQual[i]; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Tests.csproj
r13266 r13408 440 440 <Compile Include="HeuristicLab-3.3\PluginLoader.cs" /> 441 441 <Compile Include="HeuristicLab-3.3\Samples\AlpsSampleTest.cs" /> 442 <Compile Include="HeuristicLab-3.3\Samples\EsGriewankSampleTest.cs"> 443 <SubType>Code</SubType> 444 </Compile> 442 445 <Compile Include="HeuristicLab-3.3\Samples\GPRobocodeSampleTest.cs" /> 443 <Compile Include="HeuristicLab-3.3\Samples\OSESGriewankSampleTest.cs" />444 446 <Compile Include="HeuristicLab-3.3\Samples\GAGroupingProblemSampleTest.cs" /> 447 <Compile Include="HeuristicLab-3.3\Samples\LocalSearchKnapsackSampleTest.cs"> 448 <SubType>Code</SubType> 449 </Compile> 450 <Compile Include="HeuristicLab-3.3\Samples\OSESGriewankSampleTest.cs"> 451 <SubType>Code</SubType> 452 </Compile> 453 <Compile Include="HeuristicLab-3.3\Samples\PsoSchwefelSampleTest.cs"> 454 <SubType>Code</SubType> 455 </Compile> 456 <Compile Include="HeuristicLab-3.3\Samples\SimulatedAnnealingRastriginSampleTest.cs"> 457 <SubType>Code</SubType> 458 </Compile> 445 459 <Compile Include="HeuristicLab-3.3\Samples\VnsOpSampleTest.cs" /> 446 <Compile Include="HeuristicLab-3.3\Samples\EsGriewankSampleTest.cs" />447 460 <Compile Include="HeuristicLab-3.3\Samples\GaussianProcessRegressionSampleTest.cs" /> 448 461 <Compile Include="HeuristicLab-3.3\Samples\GAVrpSampleTest.cs" /> … … 454 467 <Compile Include="HeuristicLab-3.3\Samples\GPTimeSeriesSampleTest.cs" /> 455 468 <Compile Include="HeuristicLab-3.3\Samples\GPMultiplexerSampleTest.cs" /> 456 <Compile Include="HeuristicLab-3.3\Samples\LocalSearchKnapsackSampleTest.cs" />457 <Compile Include="HeuristicLab-3.3\Samples\PsoSchwefelSampleTest.cs" />458 469 <Compile Include="HeuristicLab-3.3\Samples\RAPGASchedulingSampleTest.cs" /> 459 470 <Compile Include="HeuristicLab-3.3\Samples\SamplesUtils.cs" /> … … 461 472 <Compile Include="HeuristicLab-3.3\Samples\IslandGaTspSampleTest.cs" /> 462 473 <Compile Include="HeuristicLab-3.3\Samples\ScatterSearchVRPSampleTest.cs" /> 463 <Compile Include="HeuristicLab-3.3\Samples\SimulatedAnnealingRastriginSampleTest.cs" />464 474 <Compile Include="HeuristicLab-3.3\Samples\TabuSearchTspSampleTest.cs" /> 465 475 <Compile Include="HeuristicLab-3.3\Samples\TabuSearchVRPSampleTest.cs" /> … … 572 582 <Compile Include="HeuristicLab.Problems.Instances-3.3\TSPLIBInstanceProviderTest.cs" /> 573 583 <Compile Include="HeuristicLab.Problems.Instances.DataAnalysis-3.3\ClassificationInstanceProviderTest.cs" /> 574 <Compile Include="HeuristicLab.Problems.QuadraticAssignment-3.3\QAPLIBInstancesTest.cs" /> 575 <Compile Include="HeuristicLab.Problems.QuadraticAssignment-3.3\QAPMoveEvaluatorTest.cs" /> 576 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\AckleyEvaluatorTest.cs" /> 577 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\BealeEvaluatorTest.cs" /> 578 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\BoothEvaluatorTest.cs" /> 579 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\GriewankEvaluatorTest.cs" /> 580 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\LevyEvaluatorTest.cs" /> 581 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\MatyasEvaluatorTest.cs" /> 582 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\RastriginEvaluatorTest.cs" /> 583 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\RosenbrockEvaluatorTest.cs" /> 584 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\SphereEvaluatorTest.cs" /> 585 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\SumSquaresEvaluatorTest.cs" /> 586 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\ZakharovEvaluatorTest.cs" /> 584 <Compile Include="HeuristicLab.Problems.QuadraticAssignment-3.3\QAPLIBInstancesTest.cs"> 585 <SubType>Code</SubType> 586 </Compile> 587 <Compile Include="HeuristicLab.Problems.QuadraticAssignment-3.3\QAPMoveEvaluatorTest.cs"> 588 <SubType>Code</SubType> 589 </Compile> 590 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\AckleyEvaluatorTest.cs"> 591 <SubType>Code</SubType> 592 </Compile> 593 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\BealeEvaluatorTest.cs"> 594 <SubType>Code</SubType> 595 </Compile> 596 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\BoothEvaluatorTest.cs"> 597 <SubType>Code</SubType> 598 </Compile> 599 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\GriewankEvaluatorTest.cs"> 600 <SubType>Code</SubType> 601 </Compile> 602 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\LevyEvaluatorTest.cs"> 603 <SubType>Code</SubType> 604 </Compile> 605 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\MatyasEvaluatorTest.cs"> 606 <SubType>Code</SubType> 607 </Compile> 608 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\RastriginEvaluatorTest.cs"> 609 <SubType>Code</SubType> 610 </Compile> 611 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\RosenbrockEvaluatorTest.cs"> 612 <SubType>Code</SubType> 613 </Compile> 614 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\SphereEvaluatorTest.cs"> 615 <SubType>Code</SubType> 616 </Compile> 617 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\SumSquaresEvaluatorTest.cs"> 618 <SubType>Code</SubType> 619 </Compile> 620 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\ZakharovEvaluatorTest.cs"> 621 <SubType>Code</SubType> 622 </Compile> 587 623 <Compile Include="HeuristicLab.Problems.TravelingSalesman-3.3\TSPMoveEvaluatorTest.cs" /> 588 624 <Compile Include="HeuristicLab.Problems.LinearAssignment-3.3\LinearAssignmentProblemSolverTest.cs" /> … … 660 696 </EmbeddedResource> 661 697 </ItemGroup> 698 <ItemGroup /> 662 699 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 663 700 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.