Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/06/10 10:28:34 (14 years ago)
Author:
mkommend
Message:

Added branched projects for new GP symbols (ticket #1256).

Location:
branches/GP.Symbols (TimeLag, Diff, Integral)
Files:
2 added
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/GP.Symbols (TimeLag, Diff, Integral)

    • Property svn:ignore set to
      GP.Symbols.suo
  • branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedTreeNode.cs

    r5005 r5026  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Random;
    2727namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
    2828  [StorableClass]
    29   public class VariableTreeNode : SymbolicExpressionTreeTerminalNode {
    30     public new Variable Symbol {
    31       get { return (Variable)base.Symbol; }
     29  public class LaggedTreeNode : SymbolicExpressionTreeNode, ILaggedTreeNode {
     30    public new LaggedSymbol Symbol {
     31      get { return (LaggedSymbol)base.Symbol; }
    3232    }
    3333    [Storable]
    34     private double weight;
    35     public double Weight {
    36       get { return weight; }
    37       set { weight = value; }
    38     }
    39     [Storable]
    40     private string variableName;
    41     public string VariableName {
    42       get { return variableName; }
    43       set { variableName = value; }
     34    private int lag;
     35    public int Lag {
     36      get { return lag; }
     37      set { lag = value; }
    4438    }
    4539
    4640    [StorableConstructor]
    47     protected VariableTreeNode(bool deserializing) : base(deserializing) { }
    48     protected VariableTreeNode(VariableTreeNode original, Cloner cloner)
     41    protected LaggedTreeNode(bool deserializing) : base(deserializing) { }
     42    protected LaggedTreeNode(LaggedTreeNode original, Cloner cloner)
    4943      : base(original, cloner) {
    50       weight = original.weight;
    51       variableName = original.variableName;
     44      lag = original.lag;
    5245    }
    53     protected VariableTreeNode() { }
    54     public VariableTreeNode(Variable variableSymbol) : base(variableSymbol) { }
     46    public LaggedTreeNode(LaggedSymbol timeLagSymbol) : base(timeLagSymbol) { }
    5547
    5648    public override bool HasLocalParameters {
    57       get {
    58         return true;
    59       }
     49      get { return true; }
    6050    }
    6151
    6252    public override void ResetLocalParameters(IRandom random) {
    6353      base.ResetLocalParameters(random);
    64       weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma);
    65       variableName = Symbol.VariableNames.SelectRandom(random);
     54      lag = random.Next(Symbol.MinLag, Symbol.MaxLag + 1);
    6655    }
    6756
    6857    public override void ShakeLocalParameters(IRandom random, double shakingFactor) {
    6958      base.ShakeLocalParameters(random, shakingFactor);
    70       double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma);
    71       weight = weight + x * shakingFactor;
    72       variableName = Symbol.VariableNames.SelectRandom(random);
     59      lag = Math.Min(Symbol.MaxLag, Math.Max(Symbol.MinLag, lag + random.Next(-1, 2)));
    7360    }
    7461
    7562    public override IDeepCloneable Clone(Cloner cloner) {
    76       return new VariableTreeNode(this, cloner);
     63      return new LaggedTreeNode(this, cloner);
    7764    }
    7865
    7966    public override string ToString() {
    80       if (weight.IsAlmost(1.0)) return variableName;
    81       else return weight.ToString("E4") + " " + variableName;
     67      return base.ToString() + " " + lag.ToString();
    8268    }
    8369  }
  • branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs

    r4722 r5026  
    2626namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
    2727  [StorableClass]
    28   public sealed class LaggedVariableTreeNode : VariableTreeNode {
     28  public sealed class LaggedVariableTreeNode : VariableTreeNode, ILaggedTreeNode {
    2929    public new LaggedVariable Symbol {
    3030      get { return (LaggedVariable)base.Symbol; }
Note: See TracChangeset for help on using the changeset viewer.