Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/10/15 11:29:34 (9 years ago)
Author:
mkommend
Message:

#2320: Merged the encoding class and all accompanying changes in the trunk.

Location:
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/RampedHalfAndHalfTreeCreator.cs

    r12012 r12422  
    2222using HeuristicLab.Common;
    2323using HeuristicLab.Core;
    24 using HeuristicLab.Data;
    25 using HeuristicLab.Parameters;
    2624using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2725using HeuristicLab.PluginInfrastructure;
     
    3129  [StorableClass]
    3230  [Item("RampedHalfAndHalfTreeCreator", "An operator that creates new symbolic expression trees in an alternate way: half the trees are created usign the 'Grow' method while the other half are created using the 'Full' method")]
    33   public class RampedHalfAndHalfTreeCreator : SymbolicExpressionTreeCreator,
    34                                  ISymbolicExpressionTreeSizeConstraintOperator,
    35                                  ISymbolicExpressionTreeGrammarBasedOperator {
    36     private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
    37     private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
    38 
    39     #region Parameter Properties
    40     public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {
    41       get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }
    42     }
    43 
    44     public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter {
    45       get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; }
    46     }
    47 
    48     #endregion
    49     #region Properties
    50     public IntValue MaximumSymbolicExpressionTreeDepth {
    51       get { return MaximumSymbolicExpressionTreeDepthParameter.ActualValue; }
    52     }
    53 
    54     public IntValue MaximumSymbolicExpressionTreeLength {
    55       get { return MaximumSymbolicExpressionTreeLengthParameter.ActualValue; }
    56     }
    57     #endregion
    58 
     31  public class RampedHalfAndHalfTreeCreator : SymbolicExpressionTreeCreator {
    5932    [StorableConstructor]
    6033    protected RampedHalfAndHalfTreeCreator(bool deserializing) : base(deserializing) { }
    6134    protected RampedHalfAndHalfTreeCreator(RampedHalfAndHalfTreeCreator original, Cloner cloner) : base(original, cloner) { }
    6235
    63     public RampedHalfAndHalfTreeCreator()
    64       : base() {
    65       Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName,
    66         "The maximal length (number of nodes) of the symbolic expression tree (this parameter is ignored)."));
    67       Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName,
    68         "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0)."));
    69     }
     36    public RampedHalfAndHalfTreeCreator() : base() { }
    7037
    7138    public override IDeepCloneable Clone(Cloner cloner) {
     
    7441
    7542    protected override ISymbolicExpressionTree Create(IRandom random) {
    76       return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue, MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value);
     43      return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue,
     44        MaximumSymbolicExpressionTreeLengthParameter.ActualValue.Value, MaximumSymbolicExpressionTreeDepthParameter.ActualValue.Value);
    7745    }
    7846
Note: See TracChangeset for help on using the changeset viewer.