Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/10/15 12:02:20 (9 years ago)
Author:
mkommend
Message:

#2320: Merged r12422, r12423, r12424, r12480, r12481 and r12482 into stable.

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs

    r12009 r12706  
    2525using HeuristicLab.Common;
    2626using HeuristicLab.Core;
    27 using HeuristicLab.Data;
    28 using HeuristicLab.Parameters;
    2927using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3028using HeuristicLab.PluginInfrastructure;
     
    3735    ISymbolicExpressionTreeSizeConstraintOperator, ISymbolicExpressionTreeGrammarBasedOperator {
    3836    private const int MAX_TRIES = 100;
    39     private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
    40     private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
    41     #region Parameter Properties
    42     public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {
    43       get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }
    44     }
    45     public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter {
    46       get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; }
    47     }
    48     #endregion
    49     #region Properties
    50     public IntValue MaximumSymbolicExpressionTreeLength {
    51       get { return MaximumSymbolicExpressionTreeLengthParameter.ActualValue; }
    52     }
    53     public IntValue MaximumSymbolicExpressionTreeDepth {
    54       get { return MaximumSymbolicExpressionTreeDepthParameter.ActualValue; }
    55     }
    56     #endregion
    5737
    5838    [StorableConstructor]
     
    6141    public ProbabilisticTreeCreator()
    6242      : base() {
    63       Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "The maximal length (number of nodes) of the symbolic expression tree."));
    64       Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0)."));
     43
    6544    }
    6645
     
    7150
    7251    protected override ISymbolicExpressionTree Create(IRandom random) {
    73       return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue, MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value);
     52      return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue,
     53        MaximumSymbolicExpressionTreeLengthParameter.ActualValue.Value, MaximumSymbolicExpressionTreeDepthParameter.ActualValue.Value);
    7454    }
    7555
     
    186166          if (allowedSymbols.Count == 0) return false;
    187167          var weights = allowedSymbols.Select(x => x.InitialFrequency).ToList();
     168
     169#pragma warning disable 612, 618
    188170          var selectedSymbol = allowedSymbols.SelectRandom(weights, random);
     171#pragma warning restore 612, 618
     172
    189173          ISymbolicExpressionTreeNode newTree = selectedSymbol.CreateTreeNode();
    190174          if (newTree.HasLocalParameters) newTree.ResetLocalParameters(random);
     
    232216                             select g).First().ToList();
    233217      var weights = possibleSymbols.Select(x => x.InitialFrequency).ToList();
     218
     219#pragma warning disable 612, 618
    234220      var selectedSymbol = possibleSymbols.SelectRandom(weights, random);
     221#pragma warning restore 612, 618
     222
    235223      var tree = selectedSymbol.CreateTreeNode();
    236224      if (tree.HasLocalParameters) tree.ResetLocalParameters(random);
Note: See TracChangeset for help on using the changeset viewer.