Changeset 3297
- Timestamp:
- 04/10/10 11:26:26 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureAlteringOperators/SubroutineCreater.cs
r3294 r3297 119 119 // add new function name to original branch 120 120 selectedBody.AddDynamicSymbol(functionName, argumentBranches.Count); 121 Debug.Assert(grammar.IsValidExpression(symbolicExpressionTree));122 121 return true; 123 122 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/ProbabilisticTreeCreator.cs
r3294 r3297 57 57 } 58 58 } while (tree.Root.SubTrees.Count == 0 || tree.Size > maxTreeSize || tree.Height > maxTreeHeight); 59 System.Diagnostics.Debug.Assert(grammar.IsValidExpression(tree));60 59 return tree; 61 60 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SubtreeCrossover.cs
r3294 r3297 74 74 select branch; 75 75 76 if (allowedBranches.Count() > 0) { 76 if (allowedBranches.Count() == 0) { 77 success = false; 78 return parent0; 79 } else { 77 80 var selectedBranch = SelectRandomBranch(random, allowedBranches, internalCrossoverPointProbability); 78 81 … … 84 87 return parent0; 85 88 } 86 87 success = false;88 return parent0;89 89 } 90 90 -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.Tests.csproj
r3294 r3297 39 39 </ItemGroup> 40 40 <ItemGroup> 41 <Compile Include="SubroutineCreaterTest.cs" /> 42 <Compile Include="SubtreeCrossoverTest.cs" /> 41 43 <Compile Include="Properties\AssemblyInfo.cs" /> 42 44 <Compile Include="ProbabilisticTreeCreaterTest.cs" /> -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ProbabilisticTreeCreaterTest.cs
r3294 r3297 6 6 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 7 7 using HeuristicLab.Random; 8 using System.Diagnostics; 8 9 9 10 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests { … … 18 19 randomTrees.Add(ProbabilisticTreeCreator.Create(random, grammar, 100, 10)); 19 20 } 21 foreach (var tree in randomTrees) 22 Assert.IsTrue(grammar.IsValidExpression(tree)); 20 23 } 21 24 … … 77 80 78 81 [TestMethod()] 79 public void SizeDistributionTest() {82 public void ProbabilisticTreeCreaterSizeDistributionTest() { 80 83 int[] histogram = new int[105 / 5]; 81 84 for (int i = 0; i < randomTrees.Count; i++) { … … 92 95 93 96 [TestMethod()] 94 public void FunctionDistributionTest() {97 public void ProbabilisticTreeCreaterFunctionDistributionTest() { 95 98 Dictionary<Symbol, int> occurances = new Dictionary<Symbol, int>(); 96 99 double n = 0.0; … … 115 118 116 119 [TestMethod()] 117 public void NumberOfSubTreesDistributionTest() {120 public void ProbabilisticTreeCreaterNumberOfSubTreesDistributionTest() { 118 121 Dictionary<int, int> occurances = new Dictionary<int, int>(); 119 122 double n = 0.0; … … 137 140 138 141 [TestMethod()] 139 public void TerminalDistributionTest() {142 public void ProbabilisticTreeCreaterTerminalDistributionTest() { 140 143 Dictionary<Symbol, int> occurances = new Dictionary<Symbol, int>(); 141 144 double n = 0.0;
Note: See TracChangeset
for help on using the changeset viewer.