Changeset 2455
- Timestamp:
- 10/29/09 18:10:07 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.GP.Tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.Tests/ProbabilisticTreeCreatorTest.cs
r2447 r2455 68 68 strBuilder.Append(Environment.NewLine); 69 69 strBuilder.Append("< "); strBuilder.Append((i + 1) * 5); 70 strBuilder.Append(": "); strBuilder.Append (histogram[i]);70 strBuilder.Append(": "); strBuilder.AppendFormat("{0:#0.00%}", histogram[i] / (double)randomTrees.Length); 71 71 } 72 72 Assert.Inconclusive("Size distribution of ProbabilisticTreeCreator: " + strBuilder); … … 76 76 public void FunctionDistributionTest() { 77 77 Dictionary<IFunction, int> occurances = new Dictionary<IFunction, int>(); 78 double n = 0.0; 78 79 for (int i = 0; i < randomTrees.Length; i++) { 79 80 foreach (var node in FunctionTreeIterator.IteratePrefix(randomTrees[i])) { … … 82 83 occurances[node.Function] = 0; 83 84 occurances[node.Function]++; 85 n++; 84 86 } 85 87 } … … 89 91 strBuilder.Append(Environment.NewLine); 90 92 strBuilder.Append(function.Name); strBuilder.Append(": "); 91 strBuilder.Append (occurances[function]);93 strBuilder.AppendFormat("{0:#0.00%}", occurances[function] / n); 92 94 } 93 95 Assert.Inconclusive("Function distribution of ProbabilisticTreeCreator: " + strBuilder); … … 95 97 96 98 [TestMethod()] 99 public void NumberOfSubTreesDistributionTest() { 100 Dictionary<int, int> occurances = new Dictionary<int, int>(); 101 double n = 0.0; 102 for (int i = 0; i < randomTrees.Length; i++) { 103 foreach (var node in FunctionTreeIterator.IteratePrefix(randomTrees[i])) { 104 if (!occurances.ContainsKey(node.SubTrees.Count)) 105 occurances[node.SubTrees.Count] = 0; 106 occurances[node.SubTrees.Count]++; 107 n++; 108 } 109 } 110 StringBuilder strBuilder = new StringBuilder(); 111 foreach (var arity in occurances.Keys) { 112 strBuilder.Append(Environment.NewLine); 113 strBuilder.Append(arity); strBuilder.Append(": "); 114 strBuilder.AppendFormat("{0:#0.00%}", occurances[arity] / n); 115 } 116 Assert.Inconclusive("Distribution of function arities of ProbabilisticTreeCreator: " + strBuilder); 117 } 118 119 120 [TestMethod()] 97 121 public void TerminalDistributionTest() { 98 122 Dictionary<IFunction, int> occurances = new Dictionary<IFunction, int>(); 123 double n = 0.0; 99 124 for (int i = 0; i < randomTrees.Length; i++) { 100 125 foreach (var node in FunctionTreeIterator.IteratePrefix(randomTrees[i])) { … … 103 128 occurances[node.Function] = 0; 104 129 occurances[node.Function]++; 130 n++; 105 131 } 106 132 } … … 110 136 strBuilder.Append(Environment.NewLine); 111 137 strBuilder.Append(function.Name); strBuilder.Append(": "); 112 strBuilder.Append (occurances[function]);138 strBuilder.AppendFormat("{0:#0.00%}", occurances[function] / n); 113 139 } 114 140 Assert.Inconclusive("Terminal distribution of ProbabilisticTreeCreator: " + strBuilder); -
trunk/sources/HeuristicLab.GP.Tests/Util.cs
r2447 r2455 90 90 doubleFunctions.Add(constant); 91 91 doubleFunctions.Add(addition); 92 // doubleFunctions.Add(average);92 // doubleFunctions.Add(average); 93 93 doubleFunctions.Add(cosinus); 94 94 doubleFunctions.Add(division); … … 132 132 functionLibrary.AddFunction(constant); 133 133 functionLibrary.AddFunction(addition); 134 // functionLibrary.AddFunction(average);134 // functionLibrary.AddFunction(average); 135 135 functionLibrary.AddFunction(and); 136 136 functionLibrary.AddFunction(cosinus);
Note: See TracChangeset
for help on using the changeset viewer.