Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6918 for trunk


Ignore:
Timestamp:
10/13/11 15:31:27 (13 years ago)
Author:
mkommend
Message:

#1657: Corrected ADFs for GP and adapted and extended the specific unit test.

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/ArgumentCreater.cs

    r5809 r6918  
    180180          foreach (var symb in subtree.Grammar.Symbols) {
    181181            if (symb is StartSymbol || symb is ProgramRootSymbol) continue;
     182            if (symb.Name == matchingSymbol.Name) continue; //don't allow invoke as child of invoke
    182183            if (subtree.Grammar.IsAllowedChildSymbol(selectedCutPoint.Parent.Symbol, symb, selectedCutPoint.ChildIndex))
    183184              subtree.Grammar.AddAllowedChildSymbol(matchingSymbol, symb, newArgumentNode.Symbol.ArgumentIndex);
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/GrammarModifier.cs

    r5809 r6918  
    3838        //set allowed child symbols of invoke symbol
    3939        foreach (ISymbol child in grammar.Symbols) {
     40          if (child.Name == invokeSym.Name) continue;
    4041          int i = 0;
    4142          foreach (CutPoint argumentCutPoint in argumentCutPoints) {
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4/Util.cs

    r6911 r6918  
    137137            Assert.IsTrue(otherRootNode.Grammar.GetMinimumSubtreeCount(invoke) == arity);
    138138            Assert.IsTrue(otherRootNode.Grammar.GetMaximumSubtreeCount(invoke) == arity);
     139            Assert.IsFalse(otherRootNode.Grammar.IsAllowedChildSymbol(invoke, invoke));
     140            for (int i = 0; i < arity; i++) {
     141              Assert.IsFalse(otherRootNode.Grammar.IsAllowedChildSymbol(invoke, invoke, i));
     142            }
    139143          }
    140144        }
     
    161165
    162166      foreach (var symbol in grammar.ModifyableSymbols) {
    163         //check if ever symbol has at least on 
     167        //check if ever symbol has at least one allowed child
    164168        for (int i = 0; i < grammar.GetMaximumSubtreeCount(symbol); i++)
    165169          Assert.IsTrue(grammar.GetAllowedChildSymbols(symbol, i).Any());
Note: See TracChangeset for help on using the changeset viewer.