Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/16/11 19:01:00 (14 years ago)
Author:
gkronber
Message:

#1418 changes in symbolic expression tree encoding.

Location:
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4

    • Property svn:ignore
      •  

        old new  
        22obj
        33HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs
         4*.user
  • branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/FullTreeShaker.cs

    r5445 r5499  
    2424using HeuristicLab.Data;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HeuristicLab.Parameters;
    2627
    27 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators {
     28namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
    2829  [StorableClass]
    2930  [Item("FullTreeShaker", "Manipulates all nodes that have local parameters.")]
    3031  public sealed class FullTreeShaker : SymbolicExpressionTreeManipulator {
     32    private const string ShakingFactorParameterName = "ShakingFactor";
     33    #region parameter properties
     34    public IValueLookupParameter<DoubleValue> ShakingFactorParameter {
     35      get { return (IValueLookupParameter<DoubleValue>)Parameters[ShakingFactorParameterName]; }
     36    }
     37    #endregion
     38    #region properties
     39    public DoubleValue ShakingFactor {
     40      get { return ShakingFactorParameter.ActualValue; }
     41    }
     42    #endregion
    3143
    3244    [StorableConstructor]
    3345    private FullTreeShaker(bool deserializing) : base(deserializing) { }
    3446    private FullTreeShaker(FullTreeShaker original, Cloner cloner) : base(original, cloner) { }
    35     public FullTreeShaker() : base() { }
     47    public FullTreeShaker()
     48      : base() {
     49      Parameters.Add(new ValueLookupParameter<DoubleValue>(ShakingFactorParameterName, "The shaking factor that should be used for the manipulation of constants (default=1.0).", new DoubleValue(1.0)));
     50    }
    3651
    3752    public override IDeepCloneable Clone(Cloner cloner) {
     
    3954    }
    4055
    41     protected override void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
    42       foreach (var node in symbolicExpressionTree.IterateNodesPrefix()) {
     56    protected override void Manipulate(IRandom random, SymbolicExpressionTree tree) {
     57      tree.Root.ForEachNodePostfix(node => {
    4358        if (node.HasLocalParameters) {
    44           node.ShakeLocalParameters(random, 1.0);
     59          node.ShakeLocalParameters(random, ShakingFactor.Value);
    4560        }
    46       }
    47       success = true;
     61      });
    4862    }
    4963  }
Note: See TracChangeset for help on using the changeset viewer.