Changeset 7000 for branches/Benchmarking/sources/HeuristicLab.Tests
- Timestamp:
- 11/16/11 15:07:36 (12 years ago)
- Location:
- branches/Benchmarking
- Files:
-
- 1 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Benchmarking
- Property svn:mergeinfo changed
/trunk (added) merged: 6918-6919,6921-6923,6928-6930,6933,6935,6938-6939,6942,6944,6949-6954,6959,6961-6964,6974-6983,6985-6986,6993-6995,6997-6999
- Property svn:mergeinfo changed
-
branches/Benchmarking/sources
- Property svn:mergeinfo changed
/trunk/sources (added) merged: 6918-6919,6921-6923,6928-6930,6935,6938-6939,6942,6944,6949-6954,6959,6961-6964,6974-6983,6986,6993-6995,6997-6999
- Property svn:mergeinfo changed
-
branches/Benchmarking/sources/HeuristicLab.Tests
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Tests (added) merged: 6918-6919,6921-6923,6928,6930,6938,6944,6949,6962,6974,6994,6999
- Property svn:mergeinfo changed
-
branches/Benchmarking/sources/HeuristicLab.Tests/HeuristicLab-3.3/DeepCloneableCloningTest.cs
r6915 r7000 37 37 public class DeepCloneableCloningTest { 38 38 39 [ClassInitialize] 40 public static void MyClassInitialize(TestContext testContext) { 41 PluginLoader.Assemblies.Any(); 42 } 43 39 44 public DeepCloneableCloningTest() { 40 45 excludedTypes = new HashSet<Type>(); … … 43 48 excludedTypes.Add(typeof(HeuristicLab.Problems.DataAnalysis.ClassificationEnsembleSolution)); 44 49 excludedTypes.Add(typeof(HeuristicLab.Problems.DataAnalysis.RegressionEnsembleSolution)); 50 51 foreach (var symbolType in ApplicationManager.Manager.GetTypes(typeof(HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbol))) 52 excludedTypes.Add(symbolType); 53 foreach (var grammarType in ApplicationManager.Manager.GetTypes(typeof(HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.SymbolicExpressionGrammarBase))) 54 excludedTypes.Add(grammarType); 45 55 } 46 56 … … 109 119 try { 110 120 item = (IDeepCloneable)Activator.CreateInstance(deepCloneableType, nonPublic: false); 111 } catch { continue; } // no default constructor 121 } 122 catch { continue; } // no default constructor 112 123 113 124 var clone = (IDeepCloneable)item.Clone(new Cloner()); … … 134 145 string typeName = o.GetType().FullName; 135 146 if (excludedTypes.Contains(o.GetType())) { 136 TestContext.WriteLine("Skipping excluded type " + typeName);147 //TestContext.WriteLine("Skipping excluded type " + typeName); 137 148 } else if (o is IDeepCloneable) { 138 149 string info = (o is IItem) ? ((IItem)o).ItemName + ((o is INamedItem) ? ", " + ((INamedItem)o).Name : String.Empty) : String.Empty; -
branches/Benchmarking/sources/HeuristicLab.Tests/HeuristicLab-3.3/SamplesTest.cs
r6866 r7000 85 85 TravelingSalesmanProblem tspProblem = new TravelingSalesmanProblem(); 86 86 tspProblem.ImportFromTSPLIB("ch130.tsp", "ch130.opt.tour", 6110); 87 tspProblem.Evaluator = new TSPRoundedEuclideanPathEvaluator();88 tspProblem.SolutionCreator = new RandomPermutationCreator();87 tspProblem.EvaluatorParameter.Value = new TSPRoundedEuclideanPathEvaluator(); 88 tspProblem.SolutionCreatorParameter.Value = new RandomPermutationCreator(); 89 89 tspProblem.UseDistanceMatrix.Value = true; 90 90 tspProblem.Name = "ch130 TSP (imported from TSPLIB)"; … … 140 140 vrpProblem.TardinessPenaltyParameter.Value.Value = 100; 141 141 vrpProblem.TimeFactorParameter.Value.Value = 0; 142 vrpProblem.Evaluator = new VRPEvaluator();142 vrpProblem.EvaluatorParameter.Value = new VRPEvaluator(); 143 143 vrpProblem.MaximizationParameter.Value.Value = false; 144 vrpProblem.SolutionCreator = new RandomCreator();144 vrpProblem.SolutionCreatorParameter.Value = new RandomCreator(); 145 145 vrpProblem.UseDistanceMatrix.Value = true; 146 146 vrpProblem.Vehicles.Value = 25; … … 187 187 [TestMethod] 188 188 public void RunGpArtificialAntSampleTest() { 189 var ga = (GeneticAlgorithm)XmlParser.Deserialize("../../SGP_SantaFe.hl"); 190 //var ga = CreateGpArtificialAntSample(); 189 var ga = CreateGpArtificialAntSample(); 191 190 ga.SetSeedRandomly.Value = false; 192 191 RunAlgorithm(ga); 193 Assert.AreEqual(6 6, GetDoubleResult(ga, "BestQuality"));194 Assert.AreEqual(47.2 49, GetDoubleResult(ga, "CurrentAverageQuality"));192 Assert.AreEqual(63, GetDoubleResult(ga, "BestQuality")); 193 Assert.AreEqual(47.26, GetDoubleResult(ga, "CurrentAverageQuality")); 195 194 Assert.AreEqual(0, GetDoubleResult(ga, "CurrentWorstQuality")); 196 195 Assert.AreEqual(50950, GetIntResult(ga, "EvaluatedSolutions")); … … 242 241 ga.SetSeedRandomly.Value = false; 243 242 RunAlgorithm(ga); 244 Assert.AreEqual(0.8 5210077972315257, GetDoubleResult(ga, "BestQuality"));245 Assert.AreEqual(0. 60279777130086876, GetDoubleResult(ga, "CurrentAverageQuality"));243 Assert.AreEqual(0.82932035115203739, GetDoubleResult(ga, "BestQuality")); 244 Assert.AreEqual(0.53850226351927422, GetDoubleResult(ga, "CurrentAverageQuality")); 246 245 Assert.AreEqual(0, GetDoubleResult(ga, "CurrentWorstQuality")); 247 246 Assert.AreEqual(50950, GetIntResult(ga, "EvaluatedSolutions")); … … 281 280 // configure grammar 282 281 var grammar = new TypeCoherentExpressionGrammar(); 283 grammar.Symbols.OfType<Sine>().Single().InitialFrequency = 0.0; 284 grammar.Symbols.OfType<Cosine>().Single().InitialFrequency = 0.0; 285 grammar.Symbols.OfType<Tangent>().Single().InitialFrequency = 0.0; 286 grammar.Symbols.OfType<IfThenElse>().Single().InitialFrequency = 0.0; 287 grammar.Symbols.OfType<GreaterThan>().Single().InitialFrequency = 0.0; 288 grammar.Symbols.OfType<LessThan>().Single().InitialFrequency = 0.0; 289 grammar.Symbols.OfType<And>().Single().InitialFrequency = 0.0; 290 grammar.Symbols.OfType<Or>().Single().InitialFrequency = 0.0; 291 grammar.Symbols.OfType<Not>().Single().InitialFrequency = 0.0; 292 grammar.Symbols.OfType<TimeLag>().Single().InitialFrequency = 0.0; 293 grammar.Symbols.OfType<Integral>().Single().InitialFrequency = 0.0; 294 grammar.Symbols.OfType<Derivative>().Single().InitialFrequency = 0.0; 295 grammar.Symbols.OfType<LaggedVariable>().Single().InitialFrequency = 0.0; 282 grammar.ConfigureAsDefaultRegressionGrammar(); 296 283 grammar.Symbols.OfType<VariableCondition>().Single().InitialFrequency = 0.0; 297 284 var varSymbol = grammar.Symbols.OfType<Variable>().Where(x => !(x is LaggedVariable)).Single(); … … 357 344 ga.SetSeedRandomly.Value = false; 358 345 RunAlgorithm(ga); 359 Assert.AreEqual(0.1 4086907039442381, GetDoubleResult(ga, "BestQuality"));360 Assert.AreEqual( 6.2259209614881534, GetDoubleResult(ga, "CurrentAverageQuality"));361 Assert.AreEqual(102. 80512656249992, GetDoubleResult(ga, "CurrentWorstQuality"));346 Assert.AreEqual(0.13941049901558636, GetDoubleResult(ga, "BestQuality")); 347 Assert.AreEqual(5.7121443289014842, GetDoubleResult(ga, "CurrentAverageQuality")); 348 Assert.AreEqual(102.59400156249991, GetDoubleResult(ga, "CurrentWorstQuality")); 362 349 Assert.AreEqual(100900, GetIntResult(ga, "EvaluatedSolutions")); 363 350 } … … 394 381 // configure grammar 395 382 var grammar = new TypeCoherentExpressionGrammar(); 396 grammar.Symbols.OfType<Sine>().Single().InitialFrequency = 0.0; 397 grammar.Symbols.OfType<Cosine>().Single().InitialFrequency = 0.0; 398 grammar.Symbols.OfType<Tangent>().Single().InitialFrequency = 0.0; 399 grammar.Symbols.OfType<Power>().Single().InitialFrequency = 0.0; 400 grammar.Symbols.OfType<Root>().Single().InitialFrequency = 0.0; 401 grammar.Symbols.OfType<TimeLag>().Single().InitialFrequency = 0.0; 402 grammar.Symbols.OfType<Integral>().Single().InitialFrequency = 0.0; 403 grammar.Symbols.OfType<Derivative>().Single().InitialFrequency = 0.0; 404 grammar.Symbols.OfType<LaggedVariable>().Single().InitialFrequency = 0.0; 405 grammar.Symbols.OfType<VariableCondition>().Single().InitialFrequency = 0.0; 383 grammar.ConfigureAsDefaultClassificationGrammar(); 384 grammar.Symbols.OfType<VariableCondition>().Single().Enabled = false; 406 385 var varSymbol = grammar.Symbols.OfType<Variable>().Where(x => !(x is LaggedVariable)).Single(); 407 386 varSymbol.WeightMu = 1.0; … … 481 460 482 461 problem.ProblemSize.Value = 10; 483 problem.Evaluator = new GriewankEvaluator();484 problem.SolutionCreator = new UniformRandomRealVectorCreator();462 problem.EvaluatorParameter.Value = new GriewankEvaluator(); 463 problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator(); 485 464 problem.Maximization.Value = false; 486 465 problem.Bounds = new DoubleMatrix(new double[,] { { -600, 600 } }); … … 534 513 TravelingSalesmanProblem tspProblem = new TravelingSalesmanProblem(); 535 514 tspProblem.ImportFromTSPLIB("ch130.tsp", "ch130.opt.tour", 6110); 536 tspProblem.Evaluator = new TSPRoundedEuclideanPathEvaluator();537 tspProblem.SolutionCreator = new RandomPermutationCreator();515 tspProblem.EvaluatorParameter.Value = new TSPRoundedEuclideanPathEvaluator(); 516 tspProblem.SolutionCreatorParameter.Value = new RandomPermutationCreator(); 538 517 tspProblem.UseDistanceMatrix.Value = true; 539 518 tspProblem.Name = "ch130 TSP (imported from TSPLIB)"; … … 582 561 #region Problem Configuration 583 562 KnapsackProblem problem = new KnapsackProblem(); 584 problem.BestKnownQuality = new DoubleValue(362);563 problem.BestKnownQuality.Value = 362; 585 564 problem.BestKnownSolution = new HeuristicLab.Encodings.BinaryVectorEncoding.BinaryVector(new bool[] { 586 565 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}); 587 problem.Evaluator = new KnapsackEvaluator();588 problem.SolutionCreator = new RandomBinaryVectorCreator();566 problem.EvaluatorParameter.Value = new KnapsackEvaluator(); 567 problem.SolutionCreatorParameter.Value = new RandomBinaryVectorCreator(); 589 568 problem.KnapsackCapacity.Value = 297; 590 569 problem.Maximization.Value = true; … … 652 631 problem.BestKnownSolutionParameter.Value = new RealVector(new double[] { 420.968746, 420.968746 }); 653 632 problem.Bounds = new DoubleMatrix(new double[,] { { -500, 500 } }); 654 problem.Evaluator = new SchwefelEvaluator();633 problem.EvaluatorParameter.Value = new SchwefelEvaluator(); 655 634 problem.Maximization.Value = false; 656 635 problem.ProblemSize.Value = 2; 657 problem.SolutionCreator = new UniformRandomRealVectorCreator();636 problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator(); 658 637 #endregion 659 638 #region Algorithm Configuration … … 722 701 problem.BestKnownSolutionParameter.Value = new RealVector(new double[] { 0, 0 }); 723 702 problem.Bounds = new DoubleMatrix(new double[,] { { -5.12, 5.12 } }); 724 problem.Evaluator = new RastriginEvaluator();703 problem.EvaluatorParameter.Value = new RastriginEvaluator(); 725 704 problem.Maximization.Value = false; 726 705 problem.ProblemSize.Value = 2; 727 problem.SolutionCreator = new UniformRandomRealVectorCreator();706 problem.SolutionCreatorParameter.Value = new UniformRandomRealVectorCreator(); 728 707 #endregion 729 708 #region Algorithm Configuration … … 789 768 var tspProblem = new TravelingSalesmanProblem(); 790 769 tspProblem.ImportFromTSPLIB("ch130.tsp", "ch130.opt.tour", 6110); 791 tspProblem.Evaluator = new TSPRoundedEuclideanPathEvaluator();792 tspProblem.SolutionCreator = new RandomPermutationCreator();770 tspProblem.EvaluatorParameter.Value = new TSPRoundedEuclideanPathEvaluator(); 771 tspProblem.SolutionCreatorParameter.Value = new RandomPermutationCreator(); 793 772 tspProblem.UseDistanceMatrix.Value = true; 794 773 tspProblem.Name = "ch130 TSP (imported from TSPLIB)"; … … 871 850 {48, 71}, {49, 71}, {50, 71}, {44, 70}, {45, 70}, {52, 70}, {53, 70}, {54, 70}, {41, 69}, {42, 69}, {55, 69}, {56, 69}, {40, 68}, {56, 68}, {57, 68}, {39, 67}, {57, 67}, {58, 67}, {59, 67}, {38, 66}, {59, 66}, {60, 66}, {37, 65}, {60, 65}, {36, 64}, {43, 64}, {35, 63}, {37, 63}, {41, 63}, {42, 63}, {43, 63}, {47, 63}, {61, 63}, {40, 62}, {41, 62}, {42, 62}, {43, 62}, {45, 62}, {46, 62}, {47, 62}, {62, 62}, {34, 61}, {38, 61}, {39, 61}, {42, 61}, {43, 61}, {44, 61}, {45, 61}, {46, 61}, {47, 61}, {52, 61}, {62, 61}, {63, 61}, {26, 60}, {38, 60}, {42, 60}, {43, 60}, {44, 60}, {46, 60}, {47, 60}, {63, 60}, {23, 59}, {24, 59}, {27, 59}, {29, 59}, {30, 59}, {31, 59}, {33, 59}, {42, 59}, {46, 59}, {47, 59}, {63, 59}, {21, 58}, {32, 58}, {33, 58}, {34, 58}, {35, 58}, {46, 58}, {47, 58}, {48, 58}, {53, 58}, {21, 57}, {35, 57}, {47, 57}, {48, 57}, {53, 57}, {36, 56}, {37, 56}, {46, 56}, {47, 56}, {48, 56}, {64, 56}, {65, 56}, {20, 55}, {38, 55}, {46, 55}, {47, 55}, {48, 55}, {52, 55}, {21, 54}, {40, 54}, {47, 54}, {48, 54}, {52, 54}, {65, 54}, {30, 53}, {41, 53}, {46, 53}, {47, 53}, {48, 53}, {52, 53}, {65, 53}, {21, 52}, {32, 52}, {33, 52}, {42, 52}, {51, 52}, {21, 51}, {33, 51}, {34, 51}, {43, 51}, {51, 51}, {21, 50}, {35, 50}, {44, 50}, {50, 50}, {66, 50}, {67, 50}, {21, 49}, {34, 49}, {36, 49}, {37, 49}, {46, 49}, {49, 49}, {67, 49}, {22, 48}, {36, 48}, {37, 48}, {46, 48}, {47, 48}, {22, 47}, {30, 47}, {34, 47}, {37, 47}, {38, 47}, {39, 47}, {47, 47}, {48, 47}, {67, 47}, {23, 46}, {28, 46}, {29, 46}, {30, 46}, {31, 46}, {32, 46}, {35, 46}, {37, 46}, {38, 46}, {39, 46}, {49, 46}, {67, 46}, {23, 45}, {28, 45}, {29, 45}, {31, 45}, {32, 45}, {40, 45}, {41, 45}, {49, 45}, {50, 45}, {68, 45}, {24, 44}, {29, 44}, {32, 44}, {41, 44}, {51, 44}, {68, 44}, {25, 43}, {30, 43}, {32, 43}, {42, 43}, {43, 43}, {51, 43}, {68, 43}, {69, 43}, {31, 42}, {32, 42}, {43, 42}, {52, 42}, {55, 42}, {26, 41}, {27, 41}, {31, 41}, {32, 41}, {33, 41}, {44, 41}, {45, 41}, {46, 41}, {47, 41}, {48, 41}, {49, 41}, {53, 41}, {25, 40}, {27, 40}, {32, 40}, {43, 40}, {44, 40}, {45, 40}, {46, 40}, {48, 40}, {49, 40}, {50, 40}, {51, 40}, {53, 40}, {56, 40}, {32, 39}, {33, 39}, {43, 39}, {50, 39}, {51, 39}, {54, 39}, {56, 39}, {69, 39}, {24, 38}, {32, 38}, {41, 38}, {42, 38}, {51, 38}, {52, 38}, {54, 38}, {57, 38}, {69, 38}, {31, 37}, {32, 37}, {40, 37}, {41, 37}, {42, 37}, {43, 37}, {44, 37}, {45, 37}, {46, 37}, {47, 37}, {48, 37}, {51, 37}, {52, 37}, {55, 37}, {57, 37}, {69, 37}, {24, 36}, {31, 36}, {32, 36}, {39, 36}, {40, 36}, {41, 36}, {42, 36}, {43, 36}, {45, 36}, {48, 36}, {49, 36}, {51, 36}, {53, 36}, {55, 36}, {58, 36}, {22, 35}, {23, 35}, {24, 35}, {25, 35}, {30, 35}, {31, 35}, {32, 35}, {39, 35}, {41, 35}, {49, 35}, {51, 35}, {55, 35}, {56, 35}, {58, 35}, {71, 35}, {20, 34}, {27, 34}, {30, 34}, {31, 34}, {51, 34}, {53, 34}, {57, 34}, {60, 34}, {18, 33}, {19, 33}, {29, 33}, {30, 33}, {31, 33}, {45, 33}, {46, 33}, {47, 33}, {52, 33}, {53, 33}, {55, 33}, {57, 33}, {58, 33}, {17, 32}, {30, 32}, {44, 32}, {47, 32}, {54, 32}, {57, 32}, {59, 32}, {61, 32}, {71, 32}, {72, 32}, {43, 31}, {47, 31}, {56, 31}, {58, 31}, {59, 31}, {61, 31}, {72, 31}, {74, 31}, {16, 30}, {43, 30}, {46, 30}, {47, 30}, {59, 30}, {63, 30}, {71, 30}, {75, 30}, {43, 29}, {46, 29}, {47, 29}, {59, 29}, {60, 29}, {75, 29}, {15, 28}, {43, 28}, {46, 28}, {61, 28}, {76, 28}, {15, 27}, {43, 27}, {44, 27}, {45, 27}, {46, 27}, {60, 27}, {62, 27}, {15, 26}, {43, 26}, {44, 26}, {46, 26}, {59, 26}, {60, 26}, {64, 26}, {77, 26}, {15, 25}, {58, 25}, {61, 25}, {77, 25}, {15, 24}, {53, 24}, {55, 24}, {61, 24}, {77, 24}, {62, 23}, {16, 22}, {61, 22}, {62, 22}, {15, 21}, {16, 21}, {52, 21}, {63, 21}, {77, 21}, {16, 20}, {17, 20}, {46, 20}, {47, 20}, {60, 20}, {62, 20}, {63, 20}, {65, 20}, {76, 20}, {15, 19}, {17, 19}, {18, 19}, {44, 19}, {45, 19}, {48, 19}, {53, 19}, {56, 19}, {60, 19}, {62, 19}, {67, 19}, {68, 19}, {76, 19}, {15, 18}, {18, 18}, {19, 18}, {20, 18}, {32, 18}, {33, 18}, {34, 18}, {41, 18}, {42, 18}, {43, 18}, {46, 18}, {48, 18}, {53, 18}, {59, 18}, {60, 18}, {69, 18}, {75, 18}, {16, 17}, {17, 17}, {20, 17}, {21, 17}, {22, 17}, {23, 17}, {24, 17}, {26, 17}, {28, 17}, {29, 17}, {30, 17}, {31, 17}, {32, 17}, {34, 17}, {35, 17}, {36, 17}, {37, 17}, {38, 17}, {39, 17}, {40, 17}, {44, 17}, {46, 17}, {48, 17}, {53, 17}, {56, 17}, {58, 17}, {75, 17}, {17, 16}, {18, 16}, {20, 16}, {24, 16}, {26, 16}, {27, 16}, {29, 16}, {33, 16}, {41, 16}, {42, 16}, {44, 16}, {47, 16}, {52, 16}, {57, 16}, {70, 16}, {73, 16}, {74, 16}, {17, 15}, {18, 15}, {20, 15}, {22, 15}, {24, 15}, {27, 15}, {29, 15}, {31, 15}, {33, 15}, {35, 15}, {36, 15}, {38, 15}, {39, 15}, {42, 15}, {45, 15}, {47, 15}, {52, 15}, {53, 15}, {55, 15}, {56, 15}, {70, 15}, {73, 15}, {17, 14}, {19, 14}, {21, 14}, {24, 14}, {26, 14}, {29, 14}, {31, 14}, {34, 14}, {37, 14}, {40, 14}, {42, 14}, {44, 14}, {46, 14}, {47, 14}, {53, 14}, {54, 14}, {55, 14}, {62, 14}, {70, 14}, {72, 14}, {17, 13}, {19, 13}, {21, 13}, {23, 13}, {25, 13}, {27, 13}, {30, 13}, {32, 13}, {34, 13}, {36, 13}, {38, 13}, {41, 13}, {43, 13}, {44, 13}, {45, 13}, {60, 13}, {70, 13}, {71, 13}, {18, 12}, {21, 12}, {23, 12}, {26, 12}, {28, 12}, {31, 12}, {34, 12}, {37, 12}, {39, 12}, {41, 12}, {42, 12}, {70, 12}, {18, 11}, {19, 11}, {20, 11}, {21, 11}, {24, 11}, {25, 11}, {27, 11}, {29, 11}, {31, 11}, {33, 11}, {35, 11}, {38, 11}, {41, 11}, {59, 11}, {26, 10}, {29, 10}, {32, 10}, {34, 10}, {36, 10}, {39, 10}, {40, 10}, {69, 10}, {21, 9}, {26, 9}, {28, 9}, {30, 9}, {32, 9}, {33, 9}, {35, 9}, {36, 9}, {37, 9}, {38, 9}, {39, 9}, {22, 8}, {27, 8}, {28, 8}, {29, 8}, {30, 8}, {31, 8}, {68, 8}, {23, 7}, {66, 7}, {24, 6}, {65, 6}, {25, 5}, {62, 5}, {63, 5}, {26, 4}, {55, 4}, {56, 4}, {57, 4}, {58, 4}, {59, 4}, {60, 4}, {61, 4}, {28, 3}, {53, 3}, {29, 2}, {50, 2}, {51, 2}, {52, 2}, {31, 1}, {32, 1}, {48, 1} 872 851 }); 873 tspProblem.BestKnownQuality = new DoubleValue(867);874 875 tspProblem.Evaluator = new TSPRoundedEuclideanPathEvaluator();876 tspProblem.SolutionCreator = new RandomPermutationCreator();852 tspProblem.BestKnownQuality.Value = 867; 853 854 tspProblem.EvaluatorParameter.Value = new TSPRoundedEuclideanPathEvaluator(); 855 tspProblem.SolutionCreatorParameter.Value = new RandomPermutationCreator(); 877 856 tspProblem.UseDistanceMatrix.Value = true; 878 857 tspProblem.Name = "Funny TSP"; -
branches/Benchmarking/sources/HeuristicLab.Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4/AllArchitectureAlteringOperatorsTest.cs
r6866 r7000 51 51 52 52 [TestMethod()] 53 [Timeout(3600000)] 53 54 public void AllArchitectureAlteringOperatorsDistributionTest() { 54 55 var trees = new List<ISymbolicExpressionTree>(); -
branches/Benchmarking/sources/HeuristicLab.Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4/FullTreeCreatorTest.cs
r6888 r7000 58 58 } 59 59 stopwatch.Stop(); 60 60 double msPerRandomTreeCreation = stopwatch.ElapsedMilliseconds / (double)POPULATION_SIZE; 61 int count = 0; 62 int depth = 0; 63 int maxLength = 0; 61 64 foreach (var tree in randomTrees) { 62 65 Util.IsValid(tree); 63 66 Assert.IsTrue(tree.Depth == MAX_TREE_DEPTH); 67 if (maxLength < tree.Length) 68 maxLength = tree.Length; 69 count += tree.Length; 70 depth += tree.Depth; 64 71 } 65 double msPerRandomTreeCreation = stopwatch.ElapsedMilliseconds / (double)POPULATION_SIZE;66 72 67 73 Console.WriteLine("FullTreeCreator: " + Environment.NewLine + 68 msPerRandomTreeCreation + " ms per random tree (~" + Math.Round(1000.0 / (msPerRandomTreeCreation)) + "random trees / s)" + Environment.NewLine + 69 Util.GetSizeDistributionString(randomTrees, 105, 5) + Environment.NewLine + 74 msPerRandomTreeCreation + " ms per random tree (~" + 75 Math.Round(1000.0 / (msPerRandomTreeCreation)) + "random trees / s)" + Environment.NewLine + 76 Util.GetSizeDistributionString(randomTrees, maxLength, 5) + Environment.NewLine + 70 77 Util.GetFunctionDistributionString(randomTrees) + Environment.NewLine + 71 78 Util.GetNumberOfSubtreesDistributionString(randomTrees) + Environment.NewLine + 72 Util.GetTerminalDistributionString(randomTrees) + Environment.NewLine 79 Util.GetTerminalDistributionString(randomTrees) + Environment.NewLine + 80 "Average tree depth: " + depth / POPULATION_SIZE + Environment.NewLine + 81 "Average tree length: " + count / POPULATION_SIZE + Environment.NewLine + 82 "Maximum tree length: " + maxLength + Environment.NewLine + 83 "Total nodes created: " + count + Environment.NewLine 73 84 ); 74 Assert.IsTrue(Math.Round(1000.0 / (msPerRandomTreeCreation)) > 300); // must achieve more than 500 random trees / s85 Assert.IsTrue(Math.Round(1000.0 / (msPerRandomTreeCreation)) > 300); // must achieve more than 300 random trees / s 75 86 } 76 87 } -
branches/Benchmarking/sources/HeuristicLab.Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4/GrowTreeCreatorTest.cs
r6888 r7000 59 59 stopwatch.Stop(); 60 60 61 int count = 0; 62 int depth = 0; 63 int maxLength = 0; 61 64 foreach (var tree in randomTrees) { 62 65 Util.IsValid(tree); 66 if (maxLength < tree.Length) 67 maxLength = tree.Length; 68 count += tree.Length; 69 depth += tree.Depth; 63 70 } 71 64 72 double msPerRandomTreeCreation = stopwatch.ElapsedMilliseconds / (double)POPULATION_SIZE; 65 73 66 74 Console.WriteLine("GrowTreeCreator: " + Environment.NewLine + 67 75 msPerRandomTreeCreation + " ms per random tree (~" + Math.Round(1000.0 / (msPerRandomTreeCreation)) + "random trees / s)" + Environment.NewLine + 68 Util.GetSizeDistributionString(randomTrees, 105, 5) + Environment.NewLine +76 Util.GetSizeDistributionString(randomTrees, maxLength, 5) + Environment.NewLine + 69 77 Util.GetFunctionDistributionString(randomTrees) + Environment.NewLine + 70 78 Util.GetNumberOfSubtreesDistributionString(randomTrees) + Environment.NewLine + 71 Util.GetTerminalDistributionString(randomTrees) + Environment.NewLine 79 Util.GetTerminalDistributionString(randomTrees) + Environment.NewLine + 80 "Average tree depth: " + depth / POPULATION_SIZE + Environment.NewLine + 81 "Average tree length: " + count / POPULATION_SIZE + Environment.NewLine + 82 "Total nodes created: " + count + Environment.NewLine 72 83 ); 73 Assert.IsTrue(Math.Round(1000.0 / (msPerRandomTreeCreation)) > 300); // must achieve more than 500 random trees / s84 Assert.IsTrue(Math.Round(1000.0 / (msPerRandomTreeCreation)) > 300); // must achieve more than 300 random trees / s 74 85 } 75 86 } -
branches/Benchmarking/sources/HeuristicLab.Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4/ProbabilisticTreeCreaterTest.cs
r6911 r7000 60 60 stopwatch.Stop(); 61 61 62 int count = 0; 63 int depth = 0; 62 64 foreach (var tree in randomTrees) { 63 65 Util.IsValid(tree); 66 count += tree.Length; 67 depth += tree.Depth; 64 68 } 65 69 double msPerRandomTreeCreation = stopwatch.ElapsedMilliseconds / (double)POPULATION_SIZE; … … 70 74 Util.GetFunctionDistributionString(randomTrees) + Environment.NewLine + 71 75 Util.GetNumberOfSubtreesDistributionString(randomTrees) + Environment.NewLine + 72 Util.GetTerminalDistributionString(randomTrees) + Environment.NewLine 76 Util.GetTerminalDistributionString(randomTrees) + Environment.NewLine + 77 "Average tree depth: " + depth / POPULATION_SIZE + Environment.NewLine + 78 "Average tree length: " + count / POPULATION_SIZE + Environment.NewLine + 79 "Total nodes created: " + count + Environment.NewLine 73 80 ); 74 81 Assert.IsTrue(Math.Round(1000.0 / (msPerRandomTreeCreation)) > 250); // must achieve more than 250 random trees / s -
branches/Benchmarking/sources/HeuristicLab.Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4/Util.cs
r6911 r7000 137 137 Assert.IsTrue(otherRootNode.Grammar.GetMinimumSubtreeCount(invoke) == arity); 138 138 Assert.IsTrue(otherRootNode.Grammar.GetMaximumSubtreeCount(invoke) == arity); 139 Assert.IsFalse(otherRootNode.Grammar.IsAllowedChildSymbol(invoke, invoke)); 140 for (int i = 0; i < arity; i++) { 141 Assert.IsFalse(otherRootNode.Grammar.IsAllowedChildSymbol(invoke, invoke, i)); 142 } 139 143 } 140 144 } … … 161 165 162 166 foreach (var symbol in grammar.ModifyableSymbols) { 163 //check if ever symbol has at least on 167 //check if ever symbol has at least one allowed child 164 168 for (int i = 0; i < grammar.GetMaximumSubtreeCount(symbol); i++) 165 169 Assert.IsTrue(grammar.GetAllowedChildSymbols(symbol, i).Any()); -
branches/Benchmarking/sources/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/StatisticCalculatorsTest.cs
r6880 r7000 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 140 141 } 141 142 } 143 144 [TestMethod] 145 public void CalculateDirectionalSymmetryTest() { 146 // delta: +0.01, +1, -0.01, -2, -0.01, -1, +0.01, +2 147 var original = new double[] 148 { 149 0, 150 0.01, 151 1.01, 152 1, 153 -1, 154 -1.01, 155 -2.01, 156 -2, 157 0 158 }; 159 // delta to original(t-1): +1, +0, -1, -0, -1, +0.01, +0.01, +2 160 var estimated = new double[] 161 { 162 -1, 163 1, 164 0.01, 165 0.01, 166 1, 167 -1, 168 -1.02, 169 -2.02, 170 0 171 }; 172 173 // one-step forecast 174 var startValues = original; 175 var actualContinuations = from x in original.Skip(1) 176 select Enumerable.Repeat(x, 1); 177 var predictedContinuations = from x in estimated.Skip(1) 178 select Enumerable.Repeat(x, 1); 179 double expected = 0.5; // half of the predicted deltas are correct 180 OnlineCalculatorError errorState; 181 double actual = OnlineDirectionalSymmetryCalculator.Calculate(startValues, actualContinuations, predictedContinuations, out errorState); 182 Assert.AreEqual(expected, actual, 1E-9); 183 } 184 [TestMethod] 185 public void CalculateWeightedDirectionalSymmetryTest() { 186 var original = new double[] { 0, 0.01, 1.01, 1, -1, -1.01, -2.01, -2, 0 }; // +0.01, +1, -0.01, -2, -0.01, -1, +0.01, +2 187 var estimated = new double[] { 1, 2, 2, 1, 1, 0, 0.01, 0.02, 2.02 }; // delta to original: +2, +1.99, -0.01, 0, +1, -1.02, +2.01, +4.02 188 // one-step forecast 189 var startValues = original; 190 var actualContinuations = from x in original.Skip(1) 191 select Enumerable.Repeat(x, 1); 192 var predictedContinuations = from x in estimated.Skip(1) 193 select Enumerable.Repeat(x, 1); 194 // absolute errors = 1.99, 0.99, 0, 2, 1.01, 2.02, 2.02, 2.02 195 // sum of absolute errors for correctly predicted deltas = 2.97 196 // sum of absolute errors for incorrectly predicted deltas = 3.03 197 double expected = 5.03 / 7.02; 198 OnlineCalculatorError errorState; 199 double actual = OnlineWeightedDirectionalSymmetryCalculator.Calculate(startValues, actualContinuations, predictedContinuations, out errorState); 200 Assert.AreEqual(expected, actual, 1E-9); 201 } 202 [TestMethod] 203 public void CalculateTheilsUTest() { 204 var original = new double[] { 0, 0.01, 1.01, 1, -1, -1.01, -2.01, -2, 0 }; 205 var estimated = new double[] { 1, 1.01, 0.01, 2, 0, -0.01, -1.01, -3, 1 }; 206 // one-step forecast 207 var startValues = original; 208 var actualContinuations = from x in original.Skip(1) 209 select Enumerable.Repeat(x, 1); 210 var predictedContinuations = from x in estimated.Skip(1) 211 select Enumerable.Repeat(x, 1); 212 // Sum of squared errors of model y(t+1) = y(t) = 10.0004 213 // Sum of squared errors of predicted values = 8 214 double expected = Math.Sqrt(8 / 10.0004); 215 OnlineCalculatorError errorState; 216 double actual = OnlineTheilsUStatisticCalculator.Calculate(startValues, actualContinuations, predictedContinuations, out errorState); 217 Assert.AreEqual(expected, actual, 1E-9); 218 } 219 [TestMethod] 220 public void CalculateAccuracyTest() { 221 var original = new double[] { 1, 1, 0, 0 }; 222 var estimated = new double[] { 1, 0, 1, 0 }; 223 double expected = 0.5; 224 OnlineCalculatorError errorState; 225 double actual = OnlineAccuracyCalculator.Calculate(original, estimated, out errorState); 226 Assert.AreEqual(expected, actual, 1E-9); 227 } 228 229 [TestMethod] 230 public void CalculateMeanAbsolutePercentageErrorTest() { 231 var original = new double[] { 1, 2, 3, 1, 5 }; 232 var estimated = new double[] { 2, 1, 3, 1, 0 }; 233 double expected = 0.5; 234 OnlineCalculatorError errorState; 235 double actual = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(original, estimated, out errorState); 236 Assert.AreEqual(expected, actual, 1E-9); 237 Assert.AreEqual(OnlineCalculatorError.None, errorState); 238 239 // if the original contains zero values the result is not defined 240 var original2 = new double[] { 1, 2, 0, 0, 0 }; 241 OnlineMeanAbsolutePercentageErrorCalculator.Calculate(original2, estimated, out errorState); 242 Assert.AreEqual(OnlineCalculatorError.InvalidValueAdded, errorState); 243 } 142 244 } 143 245 } -
branches/Benchmarking/sources/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/TableFileParserTest.cs
r6866 r7000 185 185 186 186 [TestMethod] 187 public void ParseEnglishCSVWithoutCommasWithoutSpace() { 188 string tempFileName = Path.GetTempFileName(); 189 WriteToFile(tempFileName, 190 @"0,0,0,3 191 0,0,0,0 192 0,0,0,0 193 0,0,0,0 194 0,0,0,0 195 0,0,0,0"); 196 TableFileParser parser = new TableFileParser(); 197 try { 198 parser.Parse(tempFileName); 199 Assert.AreEqual(6, parser.Rows); 200 Assert.AreEqual(4, parser.Columns); 201 Assert.AreEqual((double)parser.Values[3][0], 3); 202 } 203 finally { 204 File.Delete(tempFileName); 205 } 206 } 207 208 [TestMethod] 187 209 public void ParseEnglishCSVWithoutCommasWithNames() { 188 210 string tempFileName = Path.GetTempFileName(); … … 195 217 0, 0, 0, 0 196 218 0, 0, 0, 0"); 219 TableFileParser parser = new TableFileParser(); 220 try { 221 parser.Parse(tempFileName); 222 Assert.AreEqual(6, parser.Rows); 223 Assert.AreEqual(4, parser.Columns); 224 Assert.AreEqual((double)parser.Values[3][0], 3); 225 } 226 finally { 227 File.Delete(tempFileName); 228 } 229 } 230 231 [TestMethod] 232 public void ParseEnglishCSVWithoutCommasWithoutSpacesWithNames() { 233 string tempFileName = Path.GetTempFileName(); 234 WriteToFile(tempFileName, 235 @"x01,x02,x03,x04 236 0,0,0,3 237 0,0,0,0 238 0,0,0,0 239 0,0,0,0 240 0,0,0,0 241 0,0,0,0"); 197 242 TableFileParser parser = new TableFileParser(); 198 243 try { -
branches/Benchmarking/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj
r6915 r7000 181 181 <Compile Include="HeuristicLab-3.3\StorableConstructorTest.cs" /> 182 182 <Compile Include="HeuristicLab-3.3\SupportVectorMachineTest.cs" /> 183 <Compile Include="HeuristicLab-3.3\SymbolicRegressionTest.cs" />184 183 <Compile Include="HeuristicLab-3.3\ThreadSafeLogTest.cs" /> 185 184 <Compile Include="HeuristicLab.Analysis-3.3\MultidimensionalScalingTest.cs" /> … … 627 626 <Name>HeuristicLab.Clients.Common-3.3</Name> 628 627 </ProjectReference> 628 <ProjectReference Include="..\HeuristicLab.Clients.Hive.Administrator\3.3\HeuristicLab.Clients.Hive.Administrator-3.3.csproj"> 629 <Project>{5211F1AD-BBA2-4C62-8749-DCA0A25CF5D8}</Project> 630 <Name>HeuristicLab.Clients.Hive.Administrator-3.3</Name> 631 </ProjectReference> 632 <ProjectReference Include="..\HeuristicLab.Clients.Hive.JobManager\3.3\HeuristicLab.Clients.Hive.JobManager-3.3.csproj"> 633 <Project>{DBFD7205-61AF-40EF-8776-3052DEF91CF3}</Project> 634 <Name>HeuristicLab.Clients.Hive.JobManager-3.3</Name> 635 </ProjectReference> 636 <ProjectReference Include="..\HeuristicLab.Clients.Hive.Views\3.3\HeuristicLab.Clients.Hive.Views-3.3.csproj"> 637 <Project>{E1D6C801-892A-406A-B606-F158E36DD3C3}</Project> 638 <Name>HeuristicLab.Clients.Hive.Views-3.3</Name> 639 </ProjectReference> 640 <ProjectReference Include="..\HeuristicLab.Clients.Hive\3.3\HeuristicLab.Clients.Hive-3.3.csproj"> 641 <Project>{B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}</Project> 642 <Name>HeuristicLab.Clients.Hive-3.3</Name> 643 </ProjectReference> 629 644 <ProjectReference Include="..\HeuristicLab.CodeEditor\3.3\HeuristicLab.CodeEditor-3.3.csproj"> 630 645 <Project>{489CFE09-FDF7-4C89-BAB5-BD09CADD61AD}</Project> … … 690 705 <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project> 691 706 <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name> 707 </ProjectReference> 708 <ProjectReference Include="..\HeuristicLab.Hive\3.3\HeuristicLab.Hive-3.3.csproj"> 709 <Project>{F98A1740-9AC9-4D36-A582-6A2D0D06978D}</Project> 710 <Name>HeuristicLab.Hive-3.3</Name> 692 711 </ProjectReference> 693 712 <ProjectReference Include="..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj">
Note: See TracChangeset
for help on using the changeset viewer.