Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/11/10 11:06:51 (14 years ago)
Author:
gkronber
Message:

Implemented manipulation operator for symbolic expression tree encoding that replaces one randomly chosen branch with a new randomly initialized branch. #1070

Location:
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators
Files:
1 added
1 edited

Legend:

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

    r4068 r4189  
    3030namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators {
    3131  [StorableClass]
    32   [Item("ChangeNodeTypeManipulation", "Selects a random tree node and changes the symbol size.")]
     32  [Item("ChangeNodeTypeManipulation", "Selects a random tree node and changes the symbol.")]
    3333  public class ChangeNodeTypeManipulation : SymbolicExpressionTreeManipulator {
    3434
     
    3838
    3939    protected override void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
     40      ChangeNodeType(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, out success);
     41    }
    4042
    41       // select any node except the with a parent where the parent is not the root node)
     43    public static void ChangeNodeType(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, int maxTreeSize, int maxTreeHeight, out bool success) {
     44
     45      // select any node as parent (except the root node)
    4246      var manipulationPoint = (from parent in symbolicExpressionTree.Root.IterateNodesPrefix().Skip(1)
    4347                               from subtree in parent.SubTrees
Note: See TracChangeset for help on using the changeset viewer.