Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/26/10 16:16:49 (15 years ago)
Author:
gkronber
Message:

Fixed bugs in manipulation operators. #937 (Data types and operators for symbolic expression tree encoding)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/OnePointShaker.cs

    r3512 r3535  
    3737
    3838    protected override void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
     39      var parametricNodes = from node in symbolicExpressionTree.IterateNodesPrefix()
     40                            where node.HasLocalParameters
     41                            select node;
     42      if (parametricNodes.Count() > 0) {
     43        SymbolicExpressionTreeNode selectedPoint = parametricNodes.SelectRandom(random);
    3944
    40       SymbolicExpressionTreeNode selectedPoint = (from node in symbolicExpressionTree.IterateNodesPrefix()
    41                                                   where node.HasLocalParameters
    42                                                   select node).SelectRandom(random);
    43 
    44       selectedPoint.ShakeLocalParameters(random, 1.0);
    45       success = true;
     45        selectedPoint.ShakeLocalParameters(random, 1.0);
     46        success = true;
     47      } else {
     48        success = false;
     49      }
    4650    }
    4751  }
Note: See TracChangeset for help on using the changeset viewer.