Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3722


Ignore:
Timestamp:
05/08/10 18:06:55 (15 years ago)
Author:
gkronber
Message:

Fixed bug in subroutine duplicator. #937 (Data types and operators for symbolic expression tree encoding)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineDuplicater.cs

    r3539 r3722  
    5959      int maxFunctionDefiningBranches, int maxFunctionArguments) {
    6060      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;
    6164
    6265      string formatString = new StringBuilder().Append('0', (int)Math.Log10(maxFunctionDefiningBranches) + 1).ToString(); // >= 100 functions => ###
    6366      var allowedFunctionNames = from index in Enumerable.Range(0, maxFunctionDefiningBranches)
    6467                                 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 ADFs
    67         return false;
    6868      var selectedBranch = functionDefiningBranches.SelectRandom(random);
    6969      var duplicatedDefunBranch = (DefunTreeNode)selectedBranch.Clone();
Note: See TracChangeset for help on using the changeset viewer.