Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3485 for trunk


Ignore:
Timestamp:
04/22/10 08:53:04 (14 years ago)
Author:
gkronber
Message:

Bug fixes in cloning and persistence code. #938

Location:
trunk/sources
Files:
5 edited

Legend:

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

    r3462 r3485  
    3636  [StorableClass]
    3737  public sealed class SymbolicRegressionSolution : DataAnalysisSolution {
     38    [Storable]
    3839    private SymbolicRegressionModel model;
    3940    public SymbolicRegressionModel Model {
     
    5253      : base(problemData) {
    5354      this.model = model;
    54       RecalculateEstimatedValues();
    5555    }
    5656
     
    7575    public override IEnumerable<double> EstimatedValues {
    7676      get {
     77        if (estimatedValues == null) RecalculateEstimatedValues();
    7778        return estimatedValues.AsEnumerable();
    7879      }
     
    8182    public override IEnumerable<double> EstimatedTrainingValues {
    8283      get {
     84        if (estimatedValues == null) RecalculateEstimatedValues();
    8385        int start = ProblemData.TrainingSamplesStart.Value;
    8486        int n = ProblemData.TrainingSamplesEnd.Value - start;
     
    8991    public override IEnumerable<double> EstimatedTestValues {
    9092      get {
     93        if (estimatedValues == null) RecalculateEstimatedValues();
    9194        int start = ProblemData.TestSamplesStart.Value;
    9295        int n = ProblemData.TestSamplesEnd.Value - start;
     
    9497      }
    9598    }
     99
     100    public override IDeepCloneable Clone(Cloner cloner) {
     101      SymbolicRegressionSolution clone = (SymbolicRegressionSolution)base.Clone(cloner);
     102      clone.model = (SymbolicRegressionModel)model.Clone(cloner);
     103      return clone;
     104    }
    96105  }
    97106}
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Constant.cs

    r3462 r3485  
    3333  public sealed class Constant : Symbol {
    3434    #region Propeties
     35    [Storable]
    3536    private double minValue;
    3637    public double MinValue {
     
    3839      set { minValue = value; }
    3940    }
     41    [Storable]
    4042    private double maxValue;
    4143    public double MaxValue {
     
    5153      return new ConstantTreeNode(this);
    5254    }
     55
     56    public override IDeepCloneable Clone(Cloner cloner) {
     57      Constant clone = (Constant) base.Clone(cloner);
     58      clone.minValue = minValue;
     59      clone.maxValue = maxValue;
     60      return clone;
     61    }
    5362  }
    5463}
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/ConstantTreeNode.cs

    r3465 r3485  
    4141      set { constantValue = value; }
    4242    }
     43
     44    private ConstantTreeNode() : base() { }
     45
    4346    // copy constructor
    4447    private ConstantTreeNode(ConstantTreeNode original)
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs

    r3462 r3485  
    3636  public sealed class Variable : Symbol {
    3737    #region Properties
     38    [Storable]
    3839    private double weightNu;
    39     [Storable]
    4040    public double WeightNu {
    4141      get { return weightNu; }
    4242      set { weightNu = value; }
    4343    }
     44    [Storable]
    4445    private double weightSigma;
    45     [Storable]
    4646    public double WeightSigma {
    4747      get { return weightSigma; }
     
    5151      }
    5252    }
     53    [Storable]
    5354    private List<string> variableNames;
    54     [Storable]
    5555    public IEnumerable<string> VariableNames {
    5656      get { return variableNames; }
     
    7272      return new VariableTreeNode(this);
    7373    }
     74
     75    public override IDeepCloneable Clone(Cloner cloner) {
     76      Variable clone = (Variable)base.Clone(cloner);
     77      clone.weightNu = weightNu;
     78      clone.weightSigma = weightSigma;
     79      clone.variableNames = new List<string>(variableNames);
     80      return clone;
     81    }
    7482  }
    7583}
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableTreeNode.cs

    r3465 r3485  
    3434      get { return (Variable)base.Symbol; }
    3535    }
     36    [Storable]
    3637    private double weight;
    37     [Storable]
    3838    public double Weight {
    3939      get { return weight; }
    4040      set { weight = value; }
    4141    }
     42    [Storable]
    4243    private string variableName;
    43     [Storable]
    4444    public string VariableName {
    4545      get { return variableName; }
    4646      set { variableName = value; }
    4747    }
     48
     49
     50    private VariableTreeNode() { }
    4851
    4952    // copy constructor
Note: See TracChangeset for help on using the changeset viewer.