Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5925


Ignore:
Timestamp:
04/01/11 13:45:24 (14 years ago)
Author:
gkronber
Message:

#1418 fixed bugs in symbolic expression tree operators.

Location:
trunk/sources
Files:
4 edited

Legend:

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

    r5809 r5925  
    153153        } else {
    154154          var allowedSymbols = (from s in parent.Grammar.Symbols
     155                                where s.InitialFrequency > 0.0
    155156                                where parent.Grammar.IsAllowedChildSymbol(parent.Symbol, s, argumentIndex)
    156157                                where parent.Grammar.GetMinimumExpressionDepth(s) + extensionDepth - 1 < maxDepth
     
    200201      // determine possible symbols that will lead to the smallest possible tree
    201202      var possibleSymbols = (from s in parent.Grammar.GetAllowedChildSymbols(parent.Symbol, childIndex)
     203                             where s.InitialFrequency > 0.0
    202204                             group s by parent.Grammar.GetMinimumExpressionLength(s) into g
    203205                             orderby g.Key
     
    239241      for (int i = 0; i < maxArity; i++) {
    240242        aggregatedLongestExpressionLength += (from s in node.Grammar.GetAllowedChildSymbols(node.Symbol, i)
     243                                              where s.InitialFrequency > 0.0
    241244                                              select node.Grammar.GetMaximumExpressionLength(s)).Max();
    242         if (aggregatedLongestExpressionLength < targetLength) minArity = i;
     245        if (aggregatedLongestExpressionLength < targetLength) minArity = i + 1;
    243246        else break;
    244247      }
     
    249252      for (int i = 0; i < maxArity; i++) {
    250253        aggregatedShortestExpressionLength += (from s in node.Grammar.GetAllowedChildSymbols(node.Symbol, i)
     254                                               where s.InitialFrequency > 0.0
    251255                                               select node.Grammar.GetMinimumExpressionLength(s)).Min();
    252256        if (aggregatedShortestExpressionLength > targetLength) {
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/ChangeNodeTypeManipulation.cs

    r5809 r5925  
    5353                                                      // do not replace the existing symbol with itself
    5454                                                      where symbol.Name != subtree.Symbol.Name
     55                                                      where symbol.InitialFrequency > 0
    5556                                                      where existingSubtreeCount <= parent.Grammar.GetMaximumSubtreeCount(symbol)
    5657                                                      where existingSubtreeCount >= parent.Grammar.GetMinimumSubtreeCount(symbol)
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/ReplaceBranchManipulation.cs

    r5809 r5925  
    7878                                                      // do not replace symbol with the same symbol
    7979                                                      where symbol.Name != subtree.Symbol.Name
     80                                                      where symbol.InitialFrequency > 0
    8081                                                      where parent.Grammar.GetMinimumExpressionDepth(symbol) <= maxDepth
    8182                                                      where parent.Grammar.GetMinimumExpressionLength(symbol) <= maxLength
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeInterpreter.cs

    r5923 r5925  
    364364        case OpCodes.Derivative: {
    365365            int savedPc = state.ProgramCounter;
    366             double f_0 = Evaluate(dataset, ref row, state); ; row--;
     366            double f_0 = Evaluate(dataset, ref row, state); row--;
    367367            state.ProgramCounter = savedPc;
    368             double f_1 = Evaluate(dataset, ref row, state); ; row -= 2;
     368            double f_1 = Evaluate(dataset, ref row, state); row -= 2;
    369369            state.ProgramCounter = savedPc;
    370             double f_3 = Evaluate(dataset, ref row, state); ; row--;
     370            double f_3 = Evaluate(dataset, ref row, state); row--;
    371371            state.ProgramCounter = savedPc;
    372             double f_4 = Evaluate(dataset, ref row, state); ;
     372            double f_4 = Evaluate(dataset, ref row, state);
    373373            row += 4;
    374374
Note: See TracChangeset for help on using the changeset viewer.