Changeset 3722
- Timestamp:
- 05/08/10 18:06:55 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineDuplicater.cs
r3539 r3722 59 59 int maxFunctionDefiningBranches, int maxFunctionArguments) { 60 60 var functionDefiningBranches = symbolicExpressionTree.IterateNodesPrefix().OfType<DefunTreeNode>(); 61 if (functionDefiningBranches.Count() == 0 || functionDefiningBranches.Count() == maxFunctionDefiningBranches) 62 // no function defining branches to duplicate or already reached the max number of ADFs 63 return false; 61 64 62 65 string formatString = new StringBuilder().Append('0', (int)Math.Log10(maxFunctionDefiningBranches) + 1).ToString(); // >= 100 functions => ### 63 66 var allowedFunctionNames = from index in Enumerable.Range(0, maxFunctionDefiningBranches) 64 67 select "ADF" + index.ToString(formatString); 65 if (functionDefiningBranches.Count() == 0 || functionDefiningBranches.Count() == maxFunctionDefiningBranches)66 // no function defining branches to duplicate or already reached the max number of ADFs67 return false;68 68 var selectedBranch = functionDefiningBranches.SelectRandom(random); 69 69 var duplicatedDefunBranch = (DefunTreeNode)selectedBranch.Clone();
Note: See TracChangeset
for help on using the changeset viewer.