Changeset 5549 for branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/SubroutineCreater.cs
- Timestamp:
- 02/22/11 19:04:54 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/SubroutineCreater.cs
r5510 r5549 86 86 // allowed maximum number of ADF reached => abort 87 87 return false; 88 if (symbolicExpressionTree. Size+ 4 > maxTreeLength)89 // defining a new function causes an size increase by 4 nodes (max) if the max tree sizeis reached => abort88 if (symbolicExpressionTree.Length + 4 > maxTreeLength) 89 // defining a new function causes an length increase by 4 nodes (max) if the max tree length is reached => abort 90 90 return false; 91 91 string formatString = new StringBuilder().Append('0', (int)Math.Log10(maxFunctionDefinitions * 10 - 1)).ToString(); // >= 100 functions => ### … … 95 95 // select a random body (either the result producing branch or an ADF branch) 96 96 var bodies = from node in symbolicExpressionTree.Root.SubTrees 97 select new { Tree = node, Size = node.GetSize() };98 var totalNumberOfBodyNodes = bodies.Select(x => x. Size).Sum();97 select new { Tree = node, Length = node.GetLength() }; 98 var totalNumberOfBodyNodes = bodies.Select(x => x.Length).Sum(); 99 99 int r = random.Next(totalNumberOfBodyNodes); 100 100 int aggregatedNumberOfBodyNodes = 0; 101 101 ISymbolicExpressionTreeNode selectedBody = null; 102 102 foreach (var body in bodies) { 103 aggregatedNumberOfBodyNodes += body. Size;103 aggregatedNumberOfBodyNodes += body.Length; 104 104 if (aggregatedNumberOfBodyNodes > r) 105 105 selectedBody = body.Tree;
Note: See TracChangeset
for help on using the changeset viewer.