Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4189


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
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/ProbabilisticTreeCreator.cs

    r4068 r4189  
    7979        bool success = CreateFullTreeFromSeed(random, seedNode, seedNode.Grammar, treeSize, maxDepth, maxFunctionDefinitions, maxFunctionArguments);
    8080
    81         // if successfull => check constraints and return the tree if everything looks ok       
     81        // if successful => check constraints and return the tree if everything looks ok       
    8282        if (success && seedNode.GetSize() <= maxTreeSize && seedNode.GetHeight() <= maxDepth) {
    8383          return seedNode;
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj

    r4065 r4189  
    130130    <Compile Include="Manipulators\ChangeNodeTypeManipulation.cs" />
    131131    <Compile Include="Interfaces\ISymbolicExpressionTreeManipulator.cs" />
     132    <Compile Include="Manipulators\ReplaceBranchManipulation.cs" />
    132133    <Compile Include="Manipulators\FullTreeShaker.cs" />
    133134    <Compile Include="Manipulators\MultiSymbolicExpressionTreeManipulator.cs" />
  • 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
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.Tests.csproj

    r4065 r4189  
    101101    <Compile Include="ArgumentDuplicaterTest.cs" />
    102102    <Compile Include="AllArchitectureAlteringOperatorsTest.cs" />
     103    <Compile Include="ChangeNodeTypeManipulationTest.cs" />
     104    <Compile Include="ReplaceBranchManipulationTest.cs" />
    103105    <Compile Include="SubroutineDeleterTest.cs" />
    104106    <Compile Include="SubroutineDuplicaterTest.cs" />
Note: See TracChangeset for help on using the changeset viewer.