Changeset 163 for trunk/sources/HeuristicLab.StructureIdentification/Manipulation/DeleteSubTreeManipulation.cs
- Timestamp:
- 04/22/08 20:28:26 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.StructureIdentification/Manipulation/DeleteSubTreeManipulation.cs
r155 r163 60 60 if(parent == null) { 61 61 IFunctionTree newTree = gardener.CreateRandomTree(1, 1, false); 62 63 62 // check if the tree is ok 64 63 if(!gardener.IsValidTree(newTree)) { 65 64 throw new InvalidOperationException(); 66 65 } 67 68 66 // update sizes to match the new tree 69 67 GetVariableValue<IntData>("TreeSize", scope, true).Data = gardener.GetTreeSize(newTree); … … 91 89 throw new InvalidOperationException(); 92 90 } 93 94 91 GetVariableValue<IntData>("TreeSize", scope, true).Data = gardener.GetTreeSize(root); 95 92 GetVariableValue<IntData>("TreeHeight", scope, true).Data = gardener.GetTreeHeight(root); … … 99 96 // replace with a minimal random seedling 100 97 parent.RemoveSubTree(childIndex); 101 102 98 ICollection<IFunction> allowedFunctions = gardener.GetAllowedSubFunctions(parent.Function, childIndex); 103 IFunctionTree newFunctionTree = gardener.CreateRandomTree(allowedFunctions, 1, 1, true); 104 99 IFunctionTree newFunctionTree = gardener.CreateRandomTree(allowedFunctions, 1, 1); 105 100 parent.InsertSubTree(childIndex, newFunctionTree); 106 107 101 if(!gardener.IsValidTree(root)) { 108 102 throw new InvalidProgramException(); 109 103 } 110 111 104 GetVariableValue<IntData>("TreeSize", scope, true).Data = gardener.GetTreeSize(root); 112 105 GetVariableValue<IntData>("TreeHeight", scope, true).Data = gardener.GetTreeHeight(root);
Note: See TracChangeset
for help on using the changeset viewer.