Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/05/10 18:52:23 (14 years ago)
Author:
gkronber
Message:

Implemented initialization of Variable and Constant terminal nodes. #938 (Data types and operators for regression problems)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Symbols/ConstantTreeNode.cs

    r3258 r3269  
    2424using System.Collections.Generic;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HeuristicLab.Core;
     27using HeuristicLab.Data;
     28using HeuristicLab.Random;
    2629namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols {
    2730  [StorableClass]
    2831  public sealed class ConstantTreeNode : SymbolicExpressionTreeTerminalNode {
     32    public new Constant Symbol {
     33      get { return (Constant)base.Symbol; }
     34    }
    2935    public override bool HasLocalParameters {
    3036      get {
     
    3945      set { constantValue = value; }
    4046    }
    41 
    4247    // copy constructor
    4348    private ConstantTreeNode(ConstantTreeNode original)
     
    4853    public ConstantTreeNode(Constant constantSymbol) : base(constantSymbol) { }
    4954
     55    public override void ResetLocalParameters(IRandom random) {
     56      base.ResetLocalParameters(random);
     57      var range = Symbol.MaxValue.Value - Symbol.MaxValue.Value;
     58      Value = random.NextDouble() * range - Symbol.MinValue.Value;
     59    }
     60
    5061    public override object Clone() {
    5162      return new ConstantTreeNode(this);
Note: See TracChangeset for help on using the changeset viewer.