- Timestamp:
- 08/20/08 11:06:11 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.StructureIdentification/Manipulation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.StructureIdentification/Manipulation/ChangeNodeTypeManipulation.cs
r324 r526 152 152 // try to make a tree with the same arity as the old child. 153 153 int actualArity = child.SubTrees.Count; 154 // arity of the selected operator155 int minArity;156 int maxArity;157 154 // create a new tree-node for a randomly selected function 158 155 IFunction selectedFunction = allowedFunctions[random.Next(allowedFunctions.Count)]; 159 gardener.GetMinMaxArity(selectedFunction, out minArity, out maxArity); 156 // arity of the selected operator 157 int minArity = selectedFunction.MinArity; 158 int maxArity = selectedFunction.MaxArity; 160 159 // if the old child had too many sub-trees then the new child should keep as many sub-trees as possible 161 160 if (actualArity > maxArity) -
trunk/sources/HeuristicLab.StructureIdentification/Manipulation/DeleteSubTreeManipulation.cs
r324 r526 74 74 // select a branch to prune 75 75 int childIndex = random.Next(parent.SubTrees.Count); 76 int min; 77 int max; 78 gardener.GetMinMaxArity(parent.Function, out min, out max); 79 if(parent.SubTrees.Count > min) { 76 if(parent.SubTrees.Count > parent.Function.MinArity) { 80 77 parent.RemoveSubTree(childIndex); 81 78 // actually since the next sub-trees are shifted in the place of the removed branch
Note: See TracChangeset
for help on using the changeset viewer.