Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/03/11 13:47:16 (13 years ago)
Author:
gkronber
Message:

Improved test cases for symbolic expression tree encoding and fixed minor bugs. #1336

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineDeleter.cs

    r4722 r5411  
    2828using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using System.Collections.Generic;
    3031
    3132namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
     
    9798        // deletion by random regeneration
    9899        SymbolicExpressionTreeNode replacementTree = null;
    99         // TODO: should weight symbols by tickets
    100         var selectedSymbol = invocationCutPoint.Parent.GetAllowedSymbols(invocationCutPoint.ReplacedChildIndex).SelectRandom(random);
     100        var allowedSymbolsList = invocationCutPoint.Parent.GetAllowedSymbols(invocationCutPoint.ReplacedChildIndex).ToList();
     101        var weights = allowedSymbolsList.Select(s => s.InitialFrequency);
     102        var selectedSymbol = allowedSymbolsList.SelectRandom(weights, random);
    101103
    102104        int minPossibleSize = invocationCutPoint.Parent.Grammar.GetMinExpressionLength(selectedSymbol);
Note: See TracChangeset for help on using the changeset viewer.