Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/31/16 17:05:49 (8 years ago)
Author:
gkronber
Message:

#2608 worked on glucose prediction problem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GeneticProgramming.BloodGlucosePrediction/CurvedChVariableTreeNode.cs

    r13865 r13867  
    3232      get { return (CurvedChVariableSymbol)base.Symbol; }
    3333    }
     34
     35    [Storable]
     36    private double alpha;
     37    public double Alpha {
     38      get { return alpha; }
     39      set { alpha = value; }
     40    }
     41
     42    [Storable]
     43    private double beta;
     44    public double Beta {
     45      get { return beta; }
     46      set { beta = value; }
     47    }
     48    [Storable]
     49    private double weight;
     50    public double Weight {
     51      get { return weight; }
     52      set { weight = value; }
     53    }
    3454    [StorableConstructor]
    3555    protected CurvedChVariableTreeNode(bool deserializing) : base(deserializing) { }
    3656    protected CurvedChVariableTreeNode(CurvedChVariableTreeNode original, Cloner cloner)
    3757      : base(original, cloner) {
     58      this.alpha = original.alpha;
     59      this.beta = original.beta;
     60      this.weight = original.weight;
    3861    }
    3962    protected CurvedChVariableTreeNode() { }
     
    4164
    4265    public override bool HasLocalParameters {
    43       get { return false; }
     66      get { return true; }
    4467    }
    4568
    4669    public override void ResetLocalParameters(IRandom random) {
    4770      base.ResetLocalParameters(random);
     71      weight = NormalDistributedRandom.NextDouble(random, 0, 10);
     72      alpha = UniformDistributedRandom.NextDouble(random, Symbol.MinAlpha, Symbol.MaxAlpha);
     73      beta = UniformDistributedRandom.NextDouble(random, Symbol.MinBeta, Symbol.MaxBeta);
    4874    }
    4975
    5076    public override void ShakeLocalParameters(IRandom random, double shakingFactor) {
    5177      base.ShakeLocalParameters(random, shakingFactor);
     78      weight += NormalDistributedRandom.NextDouble(random, 0, 1.0 * shakingFactor);
     79      alpha += NormalDistributedRandom.NextDouble(random, 0, 1 * shakingFactor);
     80      beta += NormalDistributedRandom.NextDouble(random, 0, 1 * shakingFactor);
     81
     82      alpha = Math.Min(Symbol.MaxAlpha, Math.Max(Symbol.MinAlpha, alpha));
     83      beta = Math.Min(Symbol.MinBeta, Math.Max(Symbol.MinBeta, beta));
    5284    }
    5385
     
    5789
    5890    public override string ToString() {
    59       return string.Format("curvedCh(alpha: {0}, beta: {1})", Symbol.Alpha, Symbol.Beta);
     91      return string.Format("{0:N3}*curvedCh(alpha: {1:N3}, beta: {2:N3})", weight, alpha, beta);
    6092    }
    6193  }
Note: See TracChangeset for help on using the changeset viewer.