Changeset 5549 for branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators
- Timestamp:
- 02/22/11 19:04:54 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/ArgumentCreater.cs
r5529 r5549 101 101 ArgumentTreeNode newArgumentNode = MakeArgumentNode(newArgumentIndex); 102 102 103 // this operation potentially creates very big trees so the access to the sizeproperty might throw overflow exception103 // this operation potentially creates very big trees so the access to the length property might throw overflow exception 104 104 try { 105 if (CreateNewArgumentForDefun(random, clonedTree, selectedDefunBranch, newArgumentNode) && clonedTree. Size <= maxTreeLength && clonedTree.Height<= maxTreeDepth) {105 if (CreateNewArgumentForDefun(random, clonedTree, selectedDefunBranch, newArgumentNode) && clonedTree.Length <= maxTreeLength && clonedTree.Depth <= maxTreeDepth) { 106 106 107 107 // size constraints are fulfilled -
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; -
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/SubroutineDeleter.cs
r5529 r5549 95 95 var selectedSymbol = allowedSymbolsList.SelectRandom(weights, random); 96 96 97 int minPossible Size= invocationCutPoint.Parent.Grammar.GetMinExpressionLength(selectedSymbol);98 int max Size = Math.Max(minPossibleSize, invocationCutPoint.ReplacedChild.GetSize());99 int minPossible Height= invocationCutPoint.Parent.Grammar.GetMinExpressionDepth(selectedSymbol);100 int max Height = Math.Max(minPossibleHeight, invocationCutPoint.ReplacedChild.GetHeight());97 int minPossibleLength = invocationCutPoint.Parent.Grammar.GetMinExpressionLength(selectedSymbol); 98 int maxLength = Math.Max(minPossibleLength, invocationCutPoint.ReplacedChild.GetLength()); 99 int minPossibleDepth = invocationCutPoint.Parent.Grammar.GetMinExpressionDepth(selectedSymbol); 100 int maxDepth = Math.Max(minPossibleDepth, invocationCutPoint.ReplacedChild.GetDepth()); 101 101 replacementTree = selectedSymbol.CreateTreeNode(); 102 102 if (replacementTree.HasLocalParameters) … … 105 105 invocationCutPoint.Parent.InsertSubTree(invocationCutPoint.ReplacedChildIndex, replacementTree); 106 106 107 ProbabilisticTreeCreator.PTC2(random, replacementTree, max Size, maxHeight, 0, 0);107 ProbabilisticTreeCreator.PTC2(random, replacementTree, maxLength, maxDepth, 0, 0); 108 108 109 109 invocationCutPoint = (from node in symbolicExpressionTree.IterateNodesPrefix()
Note: See TracChangeset
for help on using the changeset viewer.