Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/12/11 17:06:14 (13 years ago)
Author:
mkommend
Message:

#1657: Corrected and adapted implementation of !PTC2 to handle symbol frequencies correctly and to always create trees of the target size. Additionally the performance of the grammars have been improved and a unit test was added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4/Util.cs

    r6866 r6911  
    154154      Assert.IsTrue(grammar.Symbols.Count() == grammar.Symbols.Distinct().Count());
    155155      foreach (ISymbol symbol in grammar.AllowedSymbols) {
    156         Assert.IsTrue(grammar.GetMinimumSubtreeCount(symbol) <= grammar.GetMaximumExpressionLength(symbol));
    157156        Assert.IsTrue(grammar.GetAllowedChildSymbols(symbol).Count() == grammar.GetAllowedChildSymbols(symbol).Distinct().Count());
    158157        for (int i = 0; i < grammar.GetMaximumSubtreeCount(symbol); i++) {
     
    165164        for (int i = 0; i < grammar.GetMaximumSubtreeCount(symbol); i++)
    166165          Assert.IsTrue(grammar.GetAllowedChildSymbols(symbol, i).Any());
    167 
    168         //if (symbol is ProgramRootSymbol) continue;
    169         ////check if symbol is allowed as at least one child symbol
    170         //bool result = false;
    171         //foreach (var parentSymbol in grammar.Symbols) {
    172         //  if (result) break;
    173         //  for (int i = 0; i < grammar.GetMaximumSubtreeCount(parentSymbol); i++)
    174         //    result = result || grammar.IsAllowedChildSymbol(parentSymbol, symbol, i);
    175         //}
    176         //Assert.IsTrue(result);
    177 
    178166      }
    179167    }
Note: See TracChangeset for help on using the changeset viewer.