Changeset 5917
- Timestamp:
- 03/31/11 19:23:18 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/AllArchitectureAlteringOperatorsTest.cs
r5809 r5917 75 75 var selectedTree = (ISymbolicExpressionTree)trees.SelectRandom(random).Clone(); 76 76 var oldTree = (ISymbolicExpressionTree)selectedTree.Clone(); 77 var oldFormatedTree = formatter.Format(oldTree);78 77 bool success = false; 79 78 int sw = random.Next(6); … … 88 87 stopwatch.Stop(); 89 88 if (!success) failedEvents++; 90 var newFormatedTree = formatter.Format(selectedTree);91 89 Util.IsValid(selectedTree); 92 90 newTrees.Add(selectedTree); … … 107 105 newTrees.Clear(); 108 106 } 109 var msPerOperation = stopwatch.ElapsedMilliseconds / ( double)POPULATION_SIZE / (double)N_ITERATIONS;107 var msPerOperation = stopwatch.ElapsedMilliseconds / ((double)POPULATION_SIZE * (double)N_ITERATIONS); 110 108 Console.WriteLine("AllArchitectureAlteringOperators: " + Environment.NewLine + 111 109 "Operations / s: ~" + Math.Round(1000.0 / (msPerOperation)) + "operations / s)" + Environment.NewLine + 112 "Failed events: " + failedEvents * 100.0 / (double)(POPULATION_SIZE * N_ITERATIONS *2.0) + "%" + Environment.NewLine +110 "Failed events: " + failedEvents * 100.0 / (double)(POPULATION_SIZE * N_ITERATIONS / 2.0) + "%" + Environment.NewLine + 113 111 Util.GetSizeDistributionString(trees, 200, 5) + Environment.NewLine + 114 112 Util.GetFunctionDistributionString(trees) + Environment.NewLine + … … 117 115 ); 118 116 119 Assert.IsTrue(failedEvents * 100.0 / (POPULATION_SIZE * N_ITERATIONS *2.0) < 25.0); // 75% of architecture operations must succeed117 Assert.IsTrue(failedEvents * 100.0 / (POPULATION_SIZE * N_ITERATIONS / 2.0) < 25.0); // 75% of architecture operations must succeed 120 118 Assert.IsTrue(Math.Round(1000.0 / (msPerOperation)) > 1000); // must achieve more than 1000 ops per second 121 119 }
Note: See TracChangeset
for help on using the changeset viewer.