Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4678


Ignore:
Timestamp:
10/29/10 19:26:56 (14 years ago)
Author:
gkronber
Message:

Refactored cloning in DataAnalysis plugins. #922

Location:
branches/CloningRefactoring
Files:
60 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Classification/3.3/ClassificationProblemData.cs

    r4618 r4678  
    196196    }
    197197
     198    [StorableConstructor]
     199    protected ClassificationProblemData(bool deserializing) : base(deserializing) { }
     200    protected ClassificationProblemData(ClassificationProblemData original, Cloner cloner)
     201      : base(original, cloner) {
     202      RegisterParameterEvents();
     203      UpdateClassValues();
     204    }
    198205    public ClassificationProblemData()
    199206      : base(new Dataset(defaultInputs, defaultData), defaultInputs, defaultInputs[defaultInputs.Length - 1], 0, 60, 60, 120) {
     
    207214    }
    208215
    209     [StorableConstructor]
    210     protected ClassificationProblemData(bool deserializing) : base(deserializing) { }
     216    public override IDeepCloneable Clone(Cloner cloner) {
     217      return new ClassificationProblemData(this, cloner);
     218    }
     219
    211220    [StorableHook(HookType.AfterDeserialization)]
    212     private void AfterDeserializationHook() {
     221    private void AfterDeserialization() {
    213222      RegisterParameterEvents();
    214223      RegisterParameterValueEvents();
    215     }
    216 
    217     public override IDeepCloneable Clone(Cloner cloner) {
    218       ClassificationProblemData clone = (ClassificationProblemData)base.Clone(cloner);
    219       clone.RegisterParameterEvents();
    220       clone.UpdateClassValues();
    221       return clone;
    222224    }
    223225
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Classification/3.3/SingleObjectiveClassificationProblem.cs

    r4565 r4678  
    4949    [StorableConstructor]
    5050    protected SingleObjectiveClassificationProblem(bool deserializing) : base(deserializing) { }
     51    protected SingleObjectiveClassificationProblem(SingleObjectiveClassificationProblem<T, U> original, Cloner cloner)
     52      : base(original, cloner) {
     53      Initialize();
     54    }
    5155    public SingleObjectiveClassificationProblem()
    5256      : base() {
    5357      Parameters.Add(new ValueParameter<ClassificationProblemData>(ClassificationProblemDataParameterName, "The data set, target variable and input variables of the data analysis problem."));
    5458      ClassificationProblemData = new ClassificationProblemData();
    55       RegisterParameterEvents();
    56       RegisterParameterValueEvents();
     59      Initialize();
    5760    }
    5861
    5962    [StorableHook(HookType.AfterDeserialization)]
    60     private void AfterDeserializationHook() {
     63    private void AfterDeserialization() {
     64      Initialize();
     65    }
     66    private void Initialize() {
    6167      RegisterParameterEvents();
    6268      RegisterParameterValueEvents();
    63     }
    64 
    65     public override IDeepCloneable Clone(Cloner cloner) {
    66       SingleObjectiveClassificationProblem<T, U> clone = (SingleObjectiveClassificationProblem<T, U>)base.Clone(cloner);
    67       clone.RegisterParameterEvents();
    68       clone.RegisterParameterValueEvents();
    69       return clone;
    7069    }
    7170
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/Analyzer/ValidationBestSymbolicClassificationSolutionAnalyzer.cs

    r4469 r4678  
    2323using System.Linq;
    2424using HeuristicLab.Analysis;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
     
    180181    #endregion
    181182
     183    [StorableConstructor]
     184    private ValidationBestSymbolicClassificationSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     185    protected ValidationBestSymbolicClassificationSolutionAnalyzer(ValidationBestSymbolicClassificationSolutionAnalyzer original, Cloner cloner)
     186      : base(original, cloner) {
     187    }
    182188    public ValidationBestSymbolicClassificationSolutionAnalyzer()
    183189      : base() {
     
    204210    }
    205211
    206     [StorableConstructor]
    207     private ValidationBestSymbolicClassificationSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     212    public override IDeepCloneable Clone(Cloner cloner) {
     213      return new ValidationBestSymbolicClassificationSolutionAnalyzer(this, cloner);
     214    }
    208215
    209216    public override IOperation Apply() {
     
    304311      }
    305312    }
    306 
    307313  }
    308314}
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/Evaluators/SymbolicClassificationMeanSquaredErrorEvaluator.cs

    r4391 r4678  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    2728  [Item("SymbolicClassificationMeanSquaredErrorEvaluator", "Calculates the mean squared error of a symbolic classification solution.")]
    2829  [StorableClass]
    29   public class SymbolicClassifacitionMeanSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator, ISymbolicClassificationEvaluator {
     30  public sealed class SymbolicClassifacitionMeanSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator, ISymbolicClassificationEvaluator {
    3031    public ClassificationProblemData ClassificationProblemData {
    3132      get { return (ClassificationProblemData)RegressionProblemData; }
    3233    }
    3334
    34     public SymbolicClassifacitionMeanSquaredErrorEvaluator()
    35       : base() {
     35    [StorableConstructor]
     36    private SymbolicClassifacitionMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     37    private SymbolicClassifacitionMeanSquaredErrorEvaluator(SymbolicClassifacitionMeanSquaredErrorEvaluator original, Cloner cloner) : base(original, cloner) { }
     38    public SymbolicClassifacitionMeanSquaredErrorEvaluator() : base() { }
     39    public override IDeepCloneable Clone(Cloner cloner) {
     40      return new SymbolicClassifacitionMeanSquaredErrorEvaluator(this, cloner);
    3641    }
    3742  }
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/Evaluators/SymbolicClassificationPearsonRSquaredEvaluator.cs

    r4392 r4678  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    2728  [Item("SymbolicClassificationPearsonRSquaredEvaluator", "Calculates the pearson R² correlation coefficient of a symbolic classification solution.")]
    2829  [StorableClass]
    29   public class SymbolicClassificationPearsonRSquaredEvaluator : SymbolicRegressionPearsonsRSquaredEvaluator, ISymbolicClassificationEvaluator {
     30  public sealed class SymbolicClassificationPearsonRSquaredEvaluator : SymbolicRegressionPearsonsRSquaredEvaluator, ISymbolicClassificationEvaluator {
    3031    public ClassificationProblemData ClassificationProblemData {
    3132      get { return (ClassificationProblemData)RegressionProblemData; }
    3233    }
    3334
    34     public SymbolicClassificationPearsonRSquaredEvaluator()
    35       : base() {
     35    [StorableConstructor]
     36    private SymbolicClassificationPearsonRSquaredEvaluator(bool deserializing) : base(deserializing) { }
     37    private SymbolicClassificationPearsonRSquaredEvaluator(SymbolicClassificationPearsonRSquaredEvaluator original, Cloner cloner) : base(original, cloner) { }
     38    public SymbolicClassificationPearsonRSquaredEvaluator() : base() { }
     39
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new SymbolicClassificationPearsonRSquaredEvaluator(this, cloner);
    3642    }
    3743  }
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/SymbolicClassificationProblem.cs

    r4452 r4678  
    4242  [StorableClass]
    4343  [Creatable("Problems")]
    44   public class SymbolicClassificationProblem : SingleObjectiveClassificationProblem<ISymbolicClassificationEvaluator, ISymbolicExpressionTreeCreator>, IStorableContent {
     44  public sealed class SymbolicClassificationProblem : SingleObjectiveClassificationProblem<ISymbolicClassificationEvaluator, ISymbolicExpressionTreeCreator>, IStorableContent {
    4545    private const string SymbolicExpressionTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter";
    4646    private const string FunctionTreeGrammarParameterName = "FunctionTreeGrammar";
     
    133133
    134134    [StorableConstructor]
    135     protected SymbolicClassificationProblem(bool deserializing) : base(deserializing) { }
     135    private SymbolicClassificationProblem(bool deserializing) : base(deserializing) { }
     136    private SymbolicClassificationProblem(SymbolicClassificationProblem original, Cloner cloner)
     137      : base(original, cloner) {
     138      RegisterParameterEvents();
     139
     140      UpdateEstimationLimits();
     141      ParameterizeEvaluator();
     142      ParameterizeSolutionCreator();
     143      ParameterizeGrammar();
     144      ParameterizeOperators();
     145      ParameterizeAnalyzers();
     146    }
    136147    public SymbolicClassificationProblem()
    137148      : base() {
     
    167178    }
    168179
    169 
    170     [StorableHook(HookType.AfterDeserialization)]
    171     private void AfterDeserialization() {
    172 
     180    public override IDeepCloneable Clone(Cloner cloner) {
     181      return new SymbolicClassificationProblem(this, cloner);
    173182    }
    174183
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/SymbolicClassificationSolution.cs

    r4469 r4678  
    3535  [StorableClass]
    3636  public class SymbolicClassificationSolution : SymbolicRegressionSolution, IClassificationSolution {
     37    public new ClassificationProblemData ProblemData {
     38      get { return (ClassificationProblemData)base.ProblemData; }
     39      set { base.ProblemData = value; }
     40    }
     41
     42    #region properties
     43    private List<double> optimalThresholds;
     44    private List<double> actualThresholds;
     45    public IEnumerable<double> Thresholds {
     46      get {
     47        if (actualThresholds == null) RecalculateEstimatedValues();
     48        return actualThresholds;
     49      }
     50      set {
     51        if (actualThresholds != null && actualThresholds.SequenceEqual(value))
     52          return;
     53        actualThresholds = new List<double>(value);
     54        OnThresholdsChanged();
     55      }
     56    }
     57
     58    public IEnumerable<double> EstimatedClassValues {
     59      get { return GetEstimatedClassValues(Enumerable.Range(0, ProblemData.Dataset.Rows)); }
     60    }
     61
     62    public IEnumerable<double> EstimatedTrainingClassValues {
     63      get { return GetEstimatedClassValues(ProblemData.TrainingIndizes); }
     64    }
     65
     66    public IEnumerable<double> EstimatedTestClassValues {
     67      get { return GetEstimatedClassValues(ProblemData.TestIndizes); }
     68    }
     69
     70    [StorableConstructor]
     71    protected SymbolicClassificationSolution(bool deserializing) : base(deserializing) { }
     72    protected SymbolicClassificationSolution(SymbolicClassificationSolution original, Cloner cloner) : base(original, cloner) { }
    3773    private SymbolicClassificationSolution() : base() { }
    3874    public SymbolicClassificationSolution(ClassificationProblemData problemData, SymbolicRegressionModel model, double lowerEstimationLimit, double upperEstimationLimit)
     
    4076    }
    4177
    42     public new ClassificationProblemData ProblemData {
    43       get { return (ClassificationProblemData)base.ProblemData; }
    44       set { base.ProblemData = value; }
     78    public override IDeepCloneable Clone(Cloner cloner) {
     79      return new SymbolicClassificationSolution(this, cloner);
    4580    }
    4681
     
    114149    }
    115150
    116     #region properties
    117     private List<double> optimalThresholds;
    118     private List<double> actualThresholds;
    119     public IEnumerable<double> Thresholds {
    120       get {
    121         if (actualThresholds == null) RecalculateEstimatedValues();
    122         return actualThresholds;
    123       }
    124       set {
    125         if (actualThresholds != null && actualThresholds.SequenceEqual(value))
    126           return;
    127         actualThresholds = new List<double>(value);
    128         OnThresholdsChanged();
    129       }
    130     }
    131 
    132     public IEnumerable<double> EstimatedClassValues {
    133       get { return GetEstimatedClassValues(Enumerable.Range(0, ProblemData.Dataset.Rows)); }
    134     }
    135 
    136     public IEnumerable<double> EstimatedTrainingClassValues {
    137       get { return GetEstimatedClassValues(ProblemData.TrainingIndizes); }
    138     }
    139 
    140     public IEnumerable<double> EstimatedTestClassValues {
    141       get { return GetEstimatedClassValues(ProblemData.TestIndizes); }
    142     }
    143 
    144151    public IEnumerable<double> GetEstimatedClassValues(IEnumerable<int> rows) {
    145152      double[] classValues = ProblemData.SortedClassValues.ToArray();
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Analyzers/RegressionSolutionAnalyzer.cs

    r4468 r4678  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    8990    #endregion
    9091
     92
     93    [StorableConstructor]
     94    protected RegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     95    protected RegressionSolutionAnalyzer(RegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    9196    public RegressionSolutionAnalyzer()
    9297      : base() {
     
    101106
    102107    [StorableHook(HookType.AfterDeserialization)]
    103     private void Initialize() {
     108    private void AfterDeserialization() {
    104109      // backwards compatibility
    105110      if (!Parameters.ContainsKey(GenerationsParameterName)) {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/LinearRegression/LinearRegressionSolutionCreator.cs

    r4082 r4678  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
     
    3940  [Item("LinearRegressionSolutionCreator", "Uses linear regression to create a structure tree.")]
    4041  [StorableClass]
    41   public class LinearRegressionSolutionCreator : SingleSuccessorOperator, ISolutionCreator {
     42  public sealed class LinearRegressionSolutionCreator : SingleSuccessorOperator, ISolutionCreator {
    4243    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
    4344    private const string DataAnalysisProblemDataParameterName = "DataAnalysisProblemData";
     
    4546    private const string SamplesEndParameterName = "SamplesEnd";
    4647
     48    [StorableConstructor]
     49    private LinearRegressionSolutionCreator(bool deserializing) : base(deserializing) { }
     50    private LinearRegressionSolutionCreator(LinearRegressionSolutionCreator original, Cloner cloner) : base(original, cloner) { }
    4751    public LinearRegressionSolutionCreator() {
    4852      Parameters.Add(new LookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The resulting solution encoded as a symbolic expression tree."));
     
    5155      Parameters.Add(new ValueLookupParameter<IntValue>(SamplesEndParameterName, "The end of the samples on which the linear regression should be applied."));
    5256    }
    53     [StorableConstructor]
    54     public LinearRegressionSolutionCreator(bool deserializing)
    55       : base(deserializing) {
     57
     58    public override IDeepCloneable Clone(Cloner cloner) {
     59      return new LinearRegressionSolutionCreator(this, cloner);
    5660    }
    5761
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/SupportVectorRegression/BestSupportVectorRegressionSolutionAnalyzer.cs

    r4543 r4678  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    5253    #endregion
    5354
     55    [StorableConstructor]
     56    private BestSupportVectorRegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     57    private BestSupportVectorRegressionSolutionAnalyzer(BestSupportVectorRegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    5458    public BestSupportVectorRegressionSolutionAnalyzer()
    5559      : base() {
    5660      Parameters.Add(new ScopeTreeLookupParameter<SupportVectorMachineModel>(SupportVectorRegressionModelParameterName, "The support vector regression models to analyze."));
    5761      Parameters.Add(new LookupParameter<SupportVectorRegressionSolution>(BestSolutionParameterName, "The best support vector regression solution."));
     62    }
     63
     64    public override IDeepCloneable Clone(Cloner cloner) {
     65      return new BestSupportVectorRegressionSolutionAnalyzer(this, cloner);
    5866    }
    5967
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/SupportVectorRegression/SupportVectorRegressionSolution.cs

    r4543 r4678  
    2424using System.Drawing;
    2525using System.Linq;
     26using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3637  [StorableClass]
    3738  public sealed class SupportVectorRegressionSolution : DataAnalysisSolution {
    38     public SupportVectorRegressionSolution() : base() { }
    39     public SupportVectorRegressionSolution(DataAnalysisProblemData problemData, SupportVectorMachineModel model, IEnumerable<string> inputVariables, double lowerEstimationLimit, double upperEstimationLimit)
    40       : base(problemData, lowerEstimationLimit, upperEstimationLimit) {
    41       this.Model = model;
    42     }
    43 
    4439    public override Image ItemImage {
    4540      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Function; }
     
    5348    public Dataset SupportVectors {
    5449      get { return CalculateSupportVectors(); }
     50    }
     51
     52    private List<double> estimatedValues;
     53    public override IEnumerable<double> EstimatedValues {
     54      get {
     55        if (estimatedValues == null) RecalculateEstimatedValues();
     56        return estimatedValues;
     57      }
     58    }
     59
     60    public override IEnumerable<double> EstimatedTrainingValues {
     61      get {
     62        return GetEstimatedValues(ProblemData.TrainingIndizes);
     63      }
     64    }
     65
     66    public override IEnumerable<double> EstimatedTestValues {
     67      get {
     68        return GetEstimatedValues(ProblemData.TestIndizes);
     69      }
     70    }
     71
     72    [StorableConstructor]
     73    private SupportVectorRegressionSolution(bool deserializing) : base(deserializing) { }
     74    private SupportVectorRegressionSolution(SupportVectorRegressionSolution original, Cloner cloner) : base(original, cloner) { }
     75    public SupportVectorRegressionSolution() : base() { }
     76    public SupportVectorRegressionSolution(DataAnalysisProblemData problemData, SupportVectorMachineModel model, IEnumerable<string> inputVariables, double lowerEstimationLimit, double upperEstimationLimit)
     77      : base(problemData, lowerEstimationLimit, upperEstimationLimit) {
     78      this.Model = model;
     79    }
     80
     81    public override IDeepCloneable Clone(Cloner cloner) {
     82      return new SupportVectorRegressionSolution(this, cloner);
    5583    }
    5684
     
    83111    }
    84112
    85     private List<double> estimatedValues;
    86     public override IEnumerable<double> EstimatedValues {
    87       get {
    88         if (estimatedValues == null) RecalculateEstimatedValues();
    89         return estimatedValues;
    90       }
    91     }
    92 
    93     public override IEnumerable<double> EstimatedTrainingValues {
    94       get {
    95         return GetEstimatedValues(ProblemData.TrainingIndizes);
    96       }
    97     }
    98 
    99     public override IEnumerable<double> EstimatedTestValues {
    100       get {
    101         return GetEstimatedValues(ProblemData.TestIndizes);
    102       }
    103     }
    104113
    105114    private IEnumerable<double> GetEstimatedValues(IEnumerable<int> rows) {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/BestSymbolicRegressionSolutionAnalyzer.cs

    r4468 r4678  
    2222using System.Linq;
    2323using HeuristicLab.Analysis;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    6768    #endregion
    6869
     70    [StorableConstructor]
     71    private BestSymbolicRegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     72    private BestSymbolicRegressionSolutionAnalyzer(BestSymbolicRegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    6973    public BestSymbolicRegressionSolutionAnalyzer()
    7074      : base() {
     
    7579    }
    7680
     81    public override IDeepCloneable Clone(Cloner cloner) {
     82      return new BestSymbolicRegressionSolutionAnalyzer(this, cloner);
     83    }
     84
    7785    [StorableHook(HookType.AfterDeserialization)]
    78     private void Initialize() {
     86    private void AfterDeserialization() {
    7987      if (!Parameters.ContainsKey(VariableFrequenciesParameterName)) {
    8088        Parameters.Add(new LookupParameter<DataTable>(VariableFrequenciesParameterName, "The variable frequencies table to use for the calculation of variable impacts"));
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs

    r4468 r4678  
    2323using System.Linq;
    2424using HeuristicLab.Analysis;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
     
    165166    #endregion
    166167
     168    [StorableConstructor]
     169    private FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     170    protected FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    167171    public FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer()
    168172      : base() {
     
    186190    }
    187191
    188     [StorableConstructor]
    189     private FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(bool deserializing) : base() { }
     192    public override IDeepCloneable Clone(Cloner cloner) {
     193      return new FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(this, cloner);
     194    }
    190195
    191196    [StorableHook(HookType.AfterDeserialization)]
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionModelQualityAnalyzer.cs

    r4468 r4678  
    2424using System.Linq;
    2525using HeuristicLab.Analysis;
     26using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Data;
     
    118119    #endregion
    119120
     121    [StorableConstructor]
     122    private SymbolicRegressionModelQualityAnalyzer(bool deserializing) : base(deserializing) { }
     123    private SymbolicRegressionModelQualityAnalyzer(SymbolicRegressionModelQualityAnalyzer original, Cloner cloner) : base(original, cloner) { }
    120124    public SymbolicRegressionModelQualityAnalyzer()
    121125      : base() {
     
    131135    }
    132136
    133     [StorableConstructor]
    134     private SymbolicRegressionModelQualityAnalyzer(bool deserializing) : base() { }
     137    public override IDeepCloneable Clone(Cloner cloner) {
     138      return new SymbolicRegressionModelQualityAnalyzer(this, cloner);
     139    }
    135140
    136141    public override IOperation Apply() {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionModelQualityCalculator.cs

    r4468 r4678  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    8384    #endregion
    8485
     86    [StorableConstructor]
     87    private SymbolicRegressionModelQualityCalculator(bool deserializing) : base(deserializing) { }
     88    private SymbolicRegressionModelQualityCalculator(SymbolicRegressionModelQualityCalculator original, Cloner cloner) : base(original, cloner) { }
    8589    public SymbolicRegressionModelQualityCalculator()
    8690      : base() {
     
    138142
    139143    }
     144    public override IDeepCloneable Clone(Cloner cloner) {
     145      return new SymbolicRegressionModelQualityCalculator(this, cloner);
     146    }
    140147  }
    141148}
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionSolutionLinearScaler.cs

    r4068 r4678  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    5354    }
    5455
     56    [StorableConstructor]
     57    private SymbolicRegressionSolutionLinearScaler(bool deserializing) : base(deserializing) { }
     58    private SymbolicRegressionSolutionLinearScaler(SymbolicRegressionSolutionLinearScaler original, Cloner cloner) : base(original, cloner) { }
    5559    public SymbolicRegressionSolutionLinearScaler()
    5660      : base() {
     
    5963      Parameters.Add(new LookupParameter<DoubleValue>(AlphaParameterName, "Alpha parameter for linear transformation."));
    6064      Parameters.Add(new LookupParameter<DoubleValue>(BetaParameterName, "Beta parameter for linear transformation."));
     65    }
     66
     67    public override IDeepCloneable Clone(Cloner cloner) {
     68      return new SymbolicRegressionSolutionLinearScaler(this, cloner);
    6169    }
    6270
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionTournamentPruning.cs

    r4468 r4678  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3334
    3435namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers {
    35   public class SymbolicRegressionTournamentPruning : SingleSuccessorOperator, ISymbolicRegressionAnalyzer {
     36  public sealed class SymbolicRegressionTournamentPruning : SingleSuccessorOperator, ISymbolicRegressionAnalyzer {
    3637    private const string RandomParameterName = "Random";
    3738    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
     
    176177    }
    177178    #endregion
    178     protected SymbolicRegressionTournamentPruning(bool deserializing) : base(deserializing) { }
     179
     180    [StorableConstructor]
     181    private SymbolicRegressionTournamentPruning(bool deserializing) : base(deserializing) { }
     182    protected SymbolicRegressionTournamentPruning(SymbolicRegressionTournamentPruning original, Cloner cloner) : base(original, cloner) { }
    179183    public SymbolicRegressionTournamentPruning()
    180184      : base() {
     
    201205    }
    202206
     207    public override IDeepCloneable Clone(Cloner cloner) {
     208      return new SymbolicRegressionTournamentPruning(this, cloner);
     209    }
     210
    203211    [StorableHook(HookType.AfterDeserialization)]
    204212    private void AfterDeserialization() {
     
    241249      double lowerEstimationLimit, double upperEstimationLimit,
    242250      double maxPruningRatio, double qualityGainWeight) {
    243         IEnumerable<int> rows = Enumerable.Range(samplesStart, samplesEnd - samplesStart)
    244           .Where(i => i < problemData.TestSamplesStart.Value || problemData.TestSamplesEnd.Value <= i);
     251      IEnumerable<int> rows = Enumerable.Range(samplesStart, samplesEnd - samplesStart)
     252        .Where(i => i < problemData.TestSamplesStart.Value || problemData.TestSamplesEnd.Value <= i);
    245253      int originalSize = tree.Size;
    246254      double originalQuality = evaluator.Evaluate(interpreter, tree,
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionVariableFrequencyAnalyzer.cs

    r4068 r4678  
    2222using System.Linq;
    2323using HeuristicLab.Analysis;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    6061    #endregion
    6162
     63    [StorableConstructor]
     64    private SymbolicRegressionVariableFrequencyAnalyzer(bool deserializing) : base(deserializing) { }
     65    private SymbolicRegressionVariableFrequencyAnalyzer(SymbolicRegressionVariableFrequencyAnalyzer original, Cloner cloner) : base(original, cloner) { }
    6266    public SymbolicRegressionVariableFrequencyAnalyzer()
    6367      : base() {
     
    6670      Parameters.Add(new ValueLookupParameter<DataTable>(VariableFrequenciesParameterName, "The data table to store the variable frequencies."));
    6771      Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The result collection where the best symbolic regression solution should be stored."));
     72    }
     73
     74    public override IDeepCloneable Clone(Cloner cloner) {
     75      return new SymbolicRegressionVariableFrequencyAnalyzer(this, cloner);
    6876    }
    6977
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/ValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs

    r4468 r4678  
    135135    private ResultsCollector resultsCollector;
    136136
     137    [StorableConstructor]
     138    private ValidationBestScaledSymbolicRegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     139    private ValidationBestScaledSymbolicRegressionSolutionAnalyzer(ValidationBestScaledSymbolicRegressionSolutionAnalyzer original, Cloner cloner)
     140      : base(original, cloner) {
     141      Initialize();
     142    }
    137143    public ValidationBestScaledSymbolicRegressionSolutionAnalyzer()
    138144      : base() {
     
    249255    }
    250256
    251     [StorableConstructor]
    252     private ValidationBestScaledSymbolicRegressionSolutionAnalyzer(bool deserializing) : base() { }
     257    public override IDeepCloneable Clone(Cloner cloner) {
     258      return new ValidationBestScaledSymbolicRegressionSolutionAnalyzer(this, cloner);
     259    }
    253260
    254261    [StorableHook(HookType.AfterDeserialization)]
     262    private void AfterDeserialization() {
     263      Initialize();
     264    }
    255265    private void Initialize() {
    256266      SymbolicExpressionTreeParameter.DepthChanged += new EventHandler(SymbolicExpressionTreeParameter_DepthChanged);
    257267    }
    258268
    259     public override IDeepCloneable Clone(Cloner cloner) {
    260       ValidationBestScaledSymbolicRegressionSolutionAnalyzer clone = (ValidationBestScaledSymbolicRegressionSolutionAnalyzer)base.Clone(cloner);
    261       clone.Initialize();
    262       return clone;
    263     }
    264269
    265270    private void SymbolicExpressionTreeParameter_DepthChanged(object sender, EventArgs e) {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/MultiObjectiveSymbolicRegressionEvaluator.cs

    r4468 r4678  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    102103    #endregion
    103104
     105    [StorableConstructor]
     106    protected MultiObjectiveSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { }
     107    protected MultiObjectiveSymbolicRegressionEvaluator(MultiObjectiveSymbolicRegressionEvaluator original, Cloner cloner) : base(original, cloner) { }
    104108    public MultiObjectiveSymbolicRegressionEvaluator()
    105109      : base() {
     
    112116      Parameters.Add(new ValueLookupParameter<IntValue>(SamplesEndParameterName, "The end index of the dataset partition on which the symbolic regression solution should be evaluated."));
    113117      Parameters.Add(new ValueParameter<PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, "The relative number of samples of the dataset partition, which should be randomly chosen for evaluation between the start and end index.", new PercentValue(1)));
    114     }
    115 
    116     [StorableConstructor]
    117     protected MultiObjectiveSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { }
    118     [StorableHook(Persistence.Default.CompositeSerializers.Storable.HookType.AfterDeserialization)]
    119     private void AfterDeserialization() {
    120118    }
    121119
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator.cs

    r4166 r4678  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
     23using HeuristicLab.Common;
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     
    2727using HeuristicLab.Parameters;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29 using HeuristicLab.Problems.DataAnalysis.Evaluators;
    3029using HeuristicLab.Problems.DataAnalysis.Symbolic;
    3130using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
     
    3433  [Item("MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator", "Calculates the mean squared error and the number of variables of a symbolic regression solution.")]
    3534  [StorableClass]
    36   public class MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator : MultiObjectiveSymbolicRegressionEvaluator {
     35  public sealed class MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator : MultiObjectiveSymbolicRegressionEvaluator {
    3736    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    3837    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     
    5453    }
    5554    #endregion
     55    [StorableConstructor]
     56    private MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     57    private MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator(MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator original, Cloner cloner)
     58      : base(original, cloner) {
     59    }
    5660    public MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator()
    5761      : base() {
    5862      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit that should be used as cut off value for the output values of symbolic expression trees."));
    5963      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit that should be used as cut off value for the output values of symbolic expression trees."));
     64    }
     65
     66    public override IDeepCloneable Clone(Cloner cloner) {
     67      return new MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator(this, cloner);
    6068    }
    6169
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator.cs

    r4128 r4678  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
     23using HeuristicLab.Common;
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     
    2727using HeuristicLab.Parameters;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29 using HeuristicLab.Problems.DataAnalysis.Evaluators;
    3029using HeuristicLab.Problems.DataAnalysis.Symbolic;
    3130using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
     
    3433  [Item("MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator", "Calculates the correlation coefficient r² and the number of variables of a symbolic regression solution.")]
    3534  [StorableClass]
    36   public class MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator : MultiObjectiveSymbolicRegressionEvaluator {
     35  public sealed class MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator : MultiObjectiveSymbolicRegressionEvaluator {
    3736    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
    3837    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     
    5453    }
    5554    #endregion
     55    [StorableConstructor]
     56    protected MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(bool deserializing) : base(deserializing) { }
     57    protected MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator original, Cloner cloner)
     58      : base(original, cloner) {
     59    }
    5660    public MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator()
    5761      : base() {
    5862      Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit that should be used as cut off value for the output values of symbolic expression trees."));
    5963      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit that should be used as cut off value for the output values of symbolic expression trees."));
     64    }
     65
     66    public override IDeepCloneable Clone(Cloner cloner) {
     67      return new MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(this, cloner);
    6068    }
    6169
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SingleObjectiveSymbolicRegressionEvaluator.cs

    r4468 r4678  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
     
    115116    #endregion
    116117
     118    [StorableConstructor]
     119    protected SingleObjectiveSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { }
     120    protected SingleObjectiveSymbolicRegressionEvaluator(SingleObjectiveSymbolicRegressionEvaluator original, Cloner cloner)
     121      : base(original, cloner) {
     122    }
    117123    public SingleObjectiveSymbolicRegressionEvaluator()
    118124      : base() {
     
    129135    }
    130136
    131     [StorableConstructor]
    132     protected SingleObjectiveSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { }
     137
    133138    [StorableHook(Persistence.Default.CompositeSerializers.Storable.HookType.AfterDeserialization)]
    134139    private void AfterDeserialization() {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionMeanSquaredErrorEvaluator.cs

    r4190 r4678  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    25 using HeuristicLab.Data;
    2626using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    27 using HeuristicLab.Parameters;
    2827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2928using HeuristicLab.Problems.DataAnalysis.Evaluators;
     
    3534  public class SymbolicRegressionMeanSquaredErrorEvaluator : SingleObjectiveSymbolicRegressionEvaluator {
    3635
    37     public SymbolicRegressionMeanSquaredErrorEvaluator()
    38       : base() {
     36    [StorableConstructor]
     37    protected SymbolicRegressionMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     38    protected SymbolicRegressionMeanSquaredErrorEvaluator(SymbolicRegressionMeanSquaredErrorEvaluator original, Cloner cloner)
     39      : base(original, cloner) {
     40    }
     41    public SymbolicRegressionMeanSquaredErrorEvaluator() : base() { }
     42
     43    public override IDeepCloneable Clone(Cloner cloner) {
     44      return new SymbolicRegressionMeanSquaredErrorEvaluator(this, cloner);
    3945    }
    4046
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionPearsonsRSquaredEvaluator.cs

    r4190 r4678  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    25 using HeuristicLab.Data;
    2626using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    27 using HeuristicLab.Parameters;
    2827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2928using HeuristicLab.Problems.DataAnalysis.Evaluators;
     
    3433  [StorableClass]
    3534  public class SymbolicRegressionPearsonsRSquaredEvaluator : SingleObjectiveSymbolicRegressionEvaluator {
    36     public SymbolicRegressionPearsonsRSquaredEvaluator()
    37       : base() {
     35    [StorableConstructor]
     36    protected SymbolicRegressionPearsonsRSquaredEvaluator(bool deserializing) : base(deserializing) { }
     37    protected SymbolicRegressionPearsonsRSquaredEvaluator(SymbolicRegressionPearsonsRSquaredEvaluator original, Cloner cloner)
     38      : base(original, cloner) {
    3839    }
     40    public SymbolicRegressionPearsonsRSquaredEvaluator() : base() { }
    3941
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new SymbolicRegressionPearsonsRSquaredEvaluator(this, cloner);
     44    }
    4045    public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) {
    4146      double mse = Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows);
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator.cs

    r4190 r4678  
    3434  [Item("SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator", "Calculates the mean and the variance of the squared errors of a linearly scaled symbolic regression solution.")]
    3535  [StorableClass]
    36   public class SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator {
     36  public sealed class SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator {
    3737    private const string QualityVarianceParameterName = "QualityVariance";
    3838    private const string QualitySamplesParameterName = "QualitySamples";
     
    9090    }
    9191    #endregion
     92    [StorableConstructor]
     93    private SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     94    private SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator(SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator original, Cloner cloner) : base(original, cloner) { }
    9295    public SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator()
    9396      : base() {
     
    100103      Parameters.Add(new LookupParameter<DoubleValue>(DecompositionVarianceParameterName, "A parameter which stores the relativ bias of the MSE."));
    101104      Parameters.Add(new LookupParameter<DoubleValue>(DecompositionCovarianceParameterName, "A parameter which stores the relativ bias of the MSE."));
     105    }
     106
     107    public override IDeepCloneable Clone(Cloner cloner) {
     108      return new SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator(this, cloner);
    102109    }
    103110
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionScaledMeanSquaredErrorEvaluator.cs

    r4477 r4678  
    3434  [Item("SymbolicRegressionScaledMeanSquaredErrorEvaluator", "Calculates the mean squared error of a linearly scaled symbolic regression solution.")]
    3535  [StorableClass]
    36   public class SymbolicRegressionScaledMeanSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator {
     36  public sealed class SymbolicRegressionScaledMeanSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator {
    3737
    3838    #region parameter properties
     
    5454    }
    5555    #endregion
     56    [StorableConstructor]
     57    private SymbolicRegressionScaledMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     58    private SymbolicRegressionScaledMeanSquaredErrorEvaluator(SymbolicRegressionScaledMeanSquaredErrorEvaluator original, Cloner cloner) : base(original, cloner) { }
    5659    public SymbolicRegressionScaledMeanSquaredErrorEvaluator()
    5760      : base() {
    5861      Parameters.Add(new LookupParameter<DoubleValue>("Alpha", "Alpha parameter for linear scaling of the estimated values."));
    5962      Parameters.Add(new LookupParameter<DoubleValue>("Beta", "Beta parameter for linear scaling of the estimated values."));
     63    }
     64
     65    public override IDeepCloneable Clone(Cloner cloner) {
     66      return new SymbolicRegressionScaledMeanSquaredErrorEvaluator(this, cloner);
    6067    }
    6168
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Interfaces/ISymbolicRegressionEvaluator.cs

    r4190 r4678  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    2526using HeuristicLab.Optimization;
    2627using HeuristicLab.Problems.DataAnalysis.Symbolic;
    27 using System.Collections.Generic;
    2828
    2929namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/MultiObjectiveSymbolicRegressionProblem.cs

    r4545 r4678  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    2523using HeuristicLab.Common;
    2624using HeuristicLab.Core;
    2725using HeuristicLab.Data;
    28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers;
    30 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
    31 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
    3226using HeuristicLab.Optimization;
    3327using HeuristicLab.Parameters;
    3428using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    35 using HeuristicLab.PluginInfrastructure;
    36 using HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers;
    37 using HeuristicLab.Problems.DataAnalysis.Symbolic;
    3829
    3930namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
     
    7162    #endregion
    7263
    73 
    7464    [StorableConstructor]
    7565    protected MultiObjectiveSymbolicRegressionProblem(bool deserializing) : base(deserializing) { }
     66    protected MultiObjectiveSymbolicRegressionProblem(MultiObjectiveSymbolicRegressionProblem original, Cloner cloner)
     67      : base(original, cloner) {
     68      RegisterParameterEvents();
     69      RegisterParameterValueEvents();
     70    }
    7671    public MultiObjectiveSymbolicRegressionProblem()
    7772      : base() {
     
    8984
    9085    public override IDeepCloneable Clone(Cloner cloner) {
    91       MultiObjectiveSymbolicRegressionProblem clone = (MultiObjectiveSymbolicRegressionProblem)base.Clone(cloner);
    92       clone.RegisterParameterEvents();
    93       clone.RegisterParameterValueEvents();
    94       return clone;
     86      return new MultiObjectiveSymbolicRegressionProblem(this, cloner);
    9587    }
    9688
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SimpleSymbolicRegressionEvaluator.cs

    r4068 r4678  
    2222using System;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3334  [Item("SimpleSymbolicRegressionEvaluator", "Evaluates a symbolic regression solution and outputs a matrix of target and estimated values.")]
    3435  [StorableClass]
    35   public class SimpleSymbolicRegressionEvaluator : SingleSuccessorOperator {
     36  public sealed class SimpleSymbolicRegressionEvaluator : SingleSuccessorOperator {
    3637    private const string SymbolicExpressionTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter";
    3738    private const string FunctionTreeParameterName = "FunctionTree";
     
    100101    #endregion
    101102
     103    [StorableConstructor]
     104    private SimpleSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { }
     105    private SimpleSymbolicRegressionEvaluator(SimpleSymbolicRegressionEvaluator original, Cloner cloner) : base(original, cloner) { }
    102106    public SimpleSymbolicRegressionEvaluator()
    103107      : base() {
     
    110114      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit that should be used as cut off value for the output values of symbolic expression trees."));
    111115      Parameters.Add(new LookupParameter<DoubleMatrix>(ValuesParameterName, "The matrix of target and estimated values as generated by the symbolic regression solution."));
     116    }
     117
     118    public override IDeepCloneable Clone(Cloner cloner) {
     119      return new SimpleSymbolicRegressionEvaluator(this, cloner);
    112120    }
    113121
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionModel.cs

    r4468 r4678  
    3232  [StorableClass]
    3333  [Item("SymbolicRegressionModel", "A symbolic regression model represents an entity that provides estimated values based on input values.")]
    34   public class SymbolicRegressionModel : NamedItem, IDataAnalysisModel {
    35     private SymbolicRegressionModel() : base() { } // for cloning
     34  public sealed class SymbolicRegressionModel : NamedItem, IDataAnalysisModel {
    3635    [StorableConstructor]
    37     protected SymbolicRegressionModel(bool deserializing)
    38       : base(deserializing) {
     36    protected SymbolicRegressionModel(bool deserializing) : base(deserializing) { }
     37    protected SymbolicRegressionModel(SymbolicRegressionModel original, Cloner cloner)
     38      : base(original, cloner) {
     39      tree = (SymbolicExpressionTree)cloner.Clone(original.tree);
     40      interpreter = (ISymbolicExpressionTreeInterpreter)cloner.Clone(original.interpreter);
     41      inputVariables = new List<string>(inputVariables);
    3942    }
     43
    4044    public SymbolicRegressionModel(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree tree)
    4145      : base() {
     
    4549    }
    4650
     51    public override IDeepCloneable Clone(Cloner cloner) {
     52      return new SymbolicRegressionModel(this, cloner);
     53    }
     54
    4755    [StorableHook(HookType.AfterDeserialization)]
    48     private void AfterDeserializationHook() {
     56    private void AfterDeserialization() {
    4957      if (inputVariables == null)
    5058        this.inputVariables = tree.IterateNodesPrefix().OfType<VariableTreeNode>().Select(var => var.VariableName).Distinct().ToList();
     
    7381      return interpreter.GetSymbolicExpressionTreeValues(tree, problemData.Dataset, rows);
    7482    }
    75 
    76     public override IDeepCloneable Clone(Cloner cloner) {
    77       var clone = (SymbolicRegressionModel)base.Clone(cloner);
    78       clone.tree = (SymbolicExpressionTree)cloner.Clone(tree);
    79       clone.interpreter = (ISymbolicExpressionTreeInterpreter)cloner.Clone(interpreter);
    80       clone.inputVariables = new List<string>(inputVariables);
    81       return clone;
    82     }
    8383  }
    8484}
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs

    r4562 r4678  
    3434  [Creatable("Problems")]
    3535  [StorableClass]
    36   public class SymbolicRegressionProblem : SymbolicRegressionProblemBase, ISingleObjectiveDataAnalysisProblem {
     36  public sealed class SymbolicRegressionProblem : SymbolicRegressionProblemBase, ISingleObjectiveDataAnalysisProblem {
    3737
    3838    #region Parameter Properties
     
    7474
    7575    [StorableConstructor]
    76     protected SymbolicRegressionProblem(bool deserializing) : base(deserializing) { }
     76    private SymbolicRegressionProblem(bool deserializing) : base(deserializing) { }
     77    private SymbolicRegressionProblem(SymbolicRegressionProblem original, Cloner cloner)
     78      : base(original, cloner) {
     79      RegisterParameterEvents();
     80      RegisterParameterValueEvents();
     81    }
     82
    7783    public SymbolicRegressionProblem()
    7884      : base() {
     
    9298
    9399    public override IDeepCloneable Clone(Cloner cloner) {
    94       SymbolicRegressionProblem clone = (SymbolicRegressionProblem)base.Clone(cloner);
    95       clone.RegisterParameterEvents();
    96       clone.RegisterParameterValueEvents();
    97       return clone;
     100      return new SymbolicRegressionProblem(this, cloner);
    98101    }
    99102
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblemBase.cs

    r4486 r4678  
    130130      get {
    131131        int endIndex = (int)(DataAnalysisProblemData.TrainingIndizes.Count() * (1.0 - DataAnalysisProblemData.ValidationPercentage.Value) - 1);
    132         if (endIndex < 0) endIndex = 0; 
     132        if (endIndex < 0) endIndex = 0;
    133133        return new IntValue(DataAnalysisProblemData.TrainingIndizes.ElementAt(endIndex));
    134134      }
     
    153153    [StorableConstructor]
    154154    protected SymbolicRegressionProblemBase(bool deserializing) : base(deserializing) { }
     155    protected SymbolicRegressionProblemBase(SymbolicRegressionProblemBase original, Cloner cloner)
     156      : base(original, cloner) {
     157      operators = original.operators.Select(x => (IOperator)cloner.Clone(x)).ToList();
     158      RegisterParameterEvents();
     159      RegisterParameterValueEvents();
     160    }
    155161    public SymbolicRegressionProblemBase()
    156162      : base() {
     
    178184      RegisterParameterEvents();
    179185      RegisterParameterValueEvents();
    180     }
    181 
    182     public override IDeepCloneable Clone(Cloner cloner) {
    183       SymbolicRegressionProblemBase clone = (SymbolicRegressionProblemBase)base.Clone(cloner);
    184       clone.operators = operators.Select(x => (IOperator)cloner.Clone(x)).ToList();
    185       clone.RegisterParameterEvents();
    186       clone.RegisterParameterValueEvents();
    187       return clone;
    188186    }
    189187
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs

    r4468 r4678  
    2424using System.Drawing;
    2525using System.Linq;
     26using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3536  [StorableClass]
    3637  public class SymbolicRegressionSolution : DataAnalysisSolution {
    37     public SymbolicRegressionSolution() : base() { }
    38     public SymbolicRegressionSolution(DataAnalysisProblemData problemData, SymbolicRegressionModel model, double lowerEstimationLimit, double upperEstimationLimit)
    39       : base(problemData, lowerEstimationLimit, upperEstimationLimit) {
    40       this.Model = model;
    41     }
    42 
    4338    public override Image ItemImage {
    4439      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Function; }
     
    4843      get { return (SymbolicRegressionModel)base.Model; }
    4944      set { base.Model = value; }
    50     }
    51 
    52     protected override void RecalculateEstimatedValues() {
    53       int minLag = 0;
    54       var laggedTreeNodes = Model.SymbolicExpressionTree.IterateNodesPrefix().OfType<LaggedVariableTreeNode>();
    55       if (laggedTreeNodes.Any())
    56         minLag = laggedTreeNodes.Min(node => node.Lag);
    57       IEnumerable<double> calculatedValues =
    58           from x in Model.GetEstimatedValues(ProblemData, 0 - minLag, ProblemData.Dataset.Rows)
    59           let boundedX = Math.Min(UpperEstimationLimit, Math.Max(LowerEstimationLimit, x))
    60           select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX;
    61       estimatedValues = Enumerable.Repeat(double.NaN, Math.Abs(minLag)).Concat(calculatedValues).ToList();
    62       OnEstimatedValuesChanged();
    6345    }
    6446
     
    7961    }
    8062
     63    [StorableConstructor]
     64    protected SymbolicRegressionSolution(bool deserializing) : base(deserializing) { }
     65    protected SymbolicRegressionSolution(SymbolicRegressionSolution original, Cloner cloner)
     66      : base(original, cloner) {
     67    }
     68    public SymbolicRegressionSolution() : base() { }
     69    public SymbolicRegressionSolution(DataAnalysisProblemData problemData, SymbolicRegressionModel model, double lowerEstimationLimit, double upperEstimationLimit)
     70      : base(problemData, lowerEstimationLimit, upperEstimationLimit) {
     71      this.Model = model;
     72    }
     73
     74    public override IDeepCloneable Clone(Cloner cloner) {
     75      return new SymbolicRegressionSolution(this, cloner);
     76    }
     77
     78    protected override void RecalculateEstimatedValues() {
     79      int minLag = 0;
     80      var laggedTreeNodes = Model.SymbolicExpressionTree.IterateNodesPrefix().OfType<LaggedVariableTreeNode>();
     81      if (laggedTreeNodes.Any())
     82        minLag = laggedTreeNodes.Min(node => node.Lag);
     83      IEnumerable<double> calculatedValues =
     84          from x in Model.GetEstimatedValues(ProblemData, 0 - minLag, ProblemData.Dataset.Rows)
     85          let boundedX = Math.Min(UpperEstimationLimit, Math.Max(LowerEstimationLimit, x))
     86          select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX;
     87      estimatedValues = Enumerable.Repeat(double.NaN, Math.Abs(minLag)).Concat(calculatedValues).ToList();
     88      OnEstimatedValuesChanged();
     89    }
     90
    8191    public virtual IEnumerable<double> GetEstimatedValues(IEnumerable<int> rows) {
    8292      if (estimatedValues == null) RecalculateEstimatedValues();
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblem.cs

    r4419 r4678  
    5555    [StorableConstructor]
    5656    protected DataAnalysisProblem(bool deserializing) : base(deserializing) { }
     57    protected DataAnalysisProblem(DataAnalysisProblem original, Cloner cloner)
     58      : base(original, cloner) {
     59      RegisterParameterEvents();
     60      RegisterParameterValueEvents();
     61    }
     62
    5763    public DataAnalysisProblem()
    5864      : base() {
     
    6369
    6470    [StorableHook(HookType.AfterDeserialization)]
    65     private void AfterDeserializationHook() {
     71    private void AfterDeserialization() {
    6672      RegisterParameterEvents();
    6773      RegisterParameterValueEvents();
     
    9197
    9298    public override IDeepCloneable Clone(Cloner cloner) {
    93       DataAnalysisProblem clone = (DataAnalysisProblem)base.Clone(cloner);
    94       clone.RegisterParameterEvents();
    95       clone.RegisterParameterValueEvents();
    96       return clone;
     99      return new DataAnalysisProblem(this, cloner);
    97100    }
    98101
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisProblemData.cs

    r4543 r4678  
    191191    #endregion
    192192
    193 
     193    [StorableConstructor]
     194    protected DataAnalysisProblemData(bool deserializing) : base(deserializing) { }
     195    protected DataAnalysisProblemData(DataAnalysisProblemData original, Cloner cloner)
     196      : base(original, cloner) {
     197      RegisterParameterEventHandlers();
     198      RegisterParameterValueEventHandlers();
     199    }
    194200    public DataAnalysisProblemData()
    195201      : base() {
     
    233239    }
    234240
    235     [StorableConstructor]
    236     protected DataAnalysisProblemData(bool deserializing) : base(deserializing) { }
     241    public override IDeepCloneable Clone(Cloner cloner) {
     242      return new DataAnalysisProblemData(this, cloner);
     243    }
    237244
    238245    [StorableHook(HookType.AfterDeserialization)]
    239     private void AfterDeserializationHook() {
     246    private void AfterDeserialization() {
    240247      if (!Parameters.ContainsKey("ValidationPercentage"))
    241248        Parameters.Add(new ValueParameter<PercentValue>("ValidationPercentage", "The relative amount of the training samples that should be used as validation set.", new PercentValue(0.5)));
     
    405412      OnProblemDataChanged(EventArgs.Empty);
    406413    }
    407 
    408     public override IDeepCloneable Clone(Cloner cloner) {
    409       DataAnalysisProblemData clone = (DataAnalysisProblemData)base.Clone(cloner);
    410       clone.RegisterParameterEventHandlers();
    411       clone.RegisterParameterValueEventHandlers();
    412       return clone;
    413     }
    414414  }
    415415}
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisSolution.cs

    r4451 r4678  
    3737    public string Filename { get; set; }
    3838    #endregion
    39    
     39
     40    [StorableConstructor]
     41    protected DataAnalysisSolution(bool deserializing) : base(deserializing) { }
     42    protected DataAnalysisSolution(DataAnalysisSolution original, Cloner cloner)
     43      : base(original, cloner) {
     44      problemData = (DataAnalysisProblemData)cloner.Clone(original.problemData);
     45      model = (IDataAnalysisModel)cloner.Clone(original.model);
     46      lowerEstimationLimit = original.lowerEstimationLimit;
     47      upperEstimationLimit = original.upperEstimationLimit;
     48      AfterDeserialization();
     49    }
    4050    protected DataAnalysisSolution()
    4151      : base() { }
     
    4656      this.lowerEstimationLimit = lowerEstimationLimit;
    4757      this.upperEstimationLimit = upperEstimationLimit;
    48       Initialize();
     58      AfterDeserialization();
    4959    }
    5060
    51     [StorableConstructor]
    52     private DataAnalysisSolution(bool deserializing) : base(deserializing) { }
    5361    [StorableHook(HookType.AfterDeserialization)]
    54     private void Initialize() {
     62    private void AfterDeserialization() {
    5563      if (problemData != null)
    5664        RegisterProblemDataEvents();
     
    140148    public event EventHandler ModelChanged;
    141149    protected virtual void OnModelChanged() {
    142       EventHandler handler = ModelChanged;
    143       if (handler != null)
    144         handler(this, EventArgs.Empty);
     150      EventHandler listeners = ModelChanged;
     151      if (listeners != null)
     152        listeners(this, EventArgs.Empty);
    145153    }
    146154
     
    153161    #endregion
    154162
    155     public override IDeepCloneable Clone(Cloner cloner) {
    156       DataAnalysisSolution clone = (DataAnalysisSolution)base.Clone(cloner);
    157       clone.problemData = (DataAnalysisProblemData)cloner.Clone(problemData);
    158       clone.model = (IDataAnalysisModel)cloner.Clone(model);
    159       clone.lowerEstimationLimit = lowerEstimationLimit;
    160       clone.upperEstimationLimit = upperEstimationLimit;
    161       clone.Initialize();
    162 
    163       return clone;
    164     }
    165163  }
    166164}
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/DataFormatException.cs

    r4239 r4678  
    2121
    2222using System;
     23using System.Runtime.Serialization;
    2324
    2425namespace HeuristicLab.Problems.DataAnalysis {
     26  [Serializable]
    2527  public class DataFormatException : Exception {
    2628    private int line;
     
    3739      this.line = line;
    3840    }
     41
     42    public DataFormatException(SerializationInfo info, StreamingContext context) : base(info, context) { }
    3943  }
    4044}
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Dataset.cs

    r4239 r4678  
    3232  [StorableClass]
    3333  public sealed class Dataset : NamedItem, IStringConvertibleMatrix {
    34     // empty constructor for cloning
    35     private Dataset()
    36       : base() {
    37     }
    38 
    3934    [StorableConstructor]
    40     private Dataset(bool deserializing)
    41       : base(deserializing) {
    42     }
    43 
     35    private Dataset(bool deserializing) : base(deserializing) { }
     36    private Dataset(Dataset original, Cloner cloner)
     37      : base(original, cloner) {
     38      variableNames = original.variableNames;
     39      data = original.data;
     40    }
    4441    public Dataset(IEnumerable<string> variableNames, double[,] data)
    4542      : base() {
     
    122119    }
    123120
    124 
    125 
    126121    public string GetVariableName(int variableIndex) {
    127122      return variableNames[variableIndex];
     
    140135
    141136    public override IDeepCloneable Clone(Cloner cloner) {
    142       Dataset clone = (Dataset)base.Clone(cloner);
    143       clone.variableNames = variableNames;
    144       clone.data = data;
    145       return clone;
     137      return new Dataset(this, cloner);
    146138    }
    147139
     
    197189    public event EventHandler ColumnNamesChanged;
    198190    private void OnColumnNamesChanged() {
    199       EventHandler handler = ColumnNamesChanged;
    200       if (handler != null)
    201         handler(this, EventArgs.Empty);
     191      EventHandler listeners = ColumnNamesChanged;
     192      if (listeners != null)
     193        listeners(this, EventArgs.Empty);
    202194    }
    203195    public event EventHandler RowNamesChanged;
    204196    private void OnRowNamesChanged() {
    205       EventHandler handler = RowNamesChanged;
    206       if (handler != null)
    207         handler(this, EventArgs.Empty);
     197      EventHandler listeners = RowNamesChanged;
     198      if (listeners != null)
     199        listeners(this, EventArgs.Empty);
    208200    }
    209201    public event EventHandler SortableViewChanged;
    210202    private void OnSortableViewChanged() {
    211       EventHandler handler = SortableViewChanged;
    212       if (handler != null)
    213         handler(this, EventArgs.Empty);
     203      EventHandler listeners = SortableViewChanged;
     204      if (listeners != null)
     205        listeners(this, EventArgs.Empty);
    214206    }
    215207    public event EventHandler<EventArgs<int, int>> ItemChanged;
    216208    private void OnItemChanged(int rowIndex, int columnIndex) {
    217       if (ItemChanged != null)
    218         ItemChanged(this, new EventArgs<int, int>(rowIndex, columnIndex));
     209      var listeners = ItemChanged;
     210      if (listeners != null)
     211        listeners(this, new EventArgs<int, int>(rowIndex, columnIndex));
    219212      OnToStringChanged();
    220213    }
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleEvaluator.cs

    r4068 r4678  
    2424using HeuristicLab.Operators;
    2525using HeuristicLab.Parameters;
     26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2628
    2729namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    3234    public ILookupParameter<DoubleMatrix> ValuesParameter {
    3335      get { return (ILookupParameter<DoubleMatrix>)Parameters["Values"]; }
     36    }
     37    [StorableConstructor]
     38    protected SimpleEvaluator(bool deserializing) : base(deserializing) { }
     39    protected SimpleEvaluator(SimpleEvaluator original, Cloner cloner)
     40      : base(original, cloner) {
    3441    }
    3542    public SimpleEvaluator()
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMSEEvaluator.cs

    r4239 r4678  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Parameters;
     28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Common;
    2830
    2931namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    3436    }
    3537
     38    [StorableConstructor]
     39    protected SimpleMSEEvaluator(bool deserializing) : base(deserializing) { }
     40    protected SimpleMSEEvaluator(SimpleMSEEvaluator original, Cloner cloner)
     41      : base(original, cloner) {
     42    }
    3643    public SimpleMSEEvaluator() {
    3744      Parameters.Add(new LookupParameter<DoubleValue>("MeanSquaredError", "The mean squared error of estimated values."));
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMeanAbsolutePercentageErrorEvaluator.cs

    r4068 r4678  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Parameters;
     28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Common;
    2830
    2931namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    3335    }
    3436
     37    [StorableConstructor]
     38    protected SimpleMeanAbsolutePercentageErrorEvaluator(bool deserializing) : base(deserializing) { }
     39    protected SimpleMeanAbsolutePercentageErrorEvaluator(SimpleMeanAbsolutePercentageErrorEvaluator original, Cloner cloner)
     40      : base(original, cloner) {
     41    }
    3542    public SimpleMeanAbsolutePercentageErrorEvaluator() {
    3643      Parameters.Add(new LookupParameter<PercentValue>("AverageRelativeError", "The average relative error of estimated values."));
     
    4350                      select values[i, ESTIMATION_INDEX];
    4451      AverageRelativeErrorParameter.ActualValue = new PercentValue(Calculate(original, estimated));
     52    }
     53
     54    public override IDeepCloneable Clone(Cloner clone) {
     55      return new SimpleMeanAbsolutePercentageErrorEvaluator(this, cloner);
    4556    }
    4657
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMeanAbsolutePercentageOfRangeErrorEvaluator.cs

    r4068 r4678  
    2727using HeuristicLab.Data;
    2828using HeuristicLab.Parameters;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2930
    3031namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    3536    }
    3637
     38    [StorableConstructor]
     39    protected SimpleMeanAbsolutePercentageOfRangeErrorEvaluator(bool deserializing) : base(deserializing) { }
     40    protected SimpleMeanAbsolutePercentageOfRangeErrorEvaluator(SimpleMeanAbsolutePercentageOfRangeErrorEvaluator original, Cloner cloner)
     41      : base(original, cloner) {
     42    }
    3743    public SimpleMeanAbsolutePercentageOfRangeErrorEvaluator() {
    3844      Parameters.Add(new LookupParameter<PercentValue>("AveragePercentageOfRangeError", "The average relative (percentage of range) error of estimated values."));
     
    4551                      select values[i, ESTIMATION_INDEX];
    4652      AveragePercentageOfRangeErrorParameter.ActualValue = new PercentValue(Calculate(original, estimated));
     53    }
     54
     55    public override IDeepCloneable Clone(Cloner clone) {
     56      return new SimpleMeanAbsolutePercentageOfRangeErrorEvaluator(this, cloner);
    4757    }
    4858
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleNMSEEvaluator.cs

    r4068 r4678  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Parameters;
     28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Common;
    2830
    2931namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    3436    }
    3537
     38    [StorableConstructor]
     39    protected SimpleNMSEEvaluator(bool deserializing) : base(deserializing) { }
     40    protected SimpleNMSEEvaluator(SimpleNMSEEvaluator original, Cloner cloner)
     41      : base(original, cloner) {
     42    }
    3643    public SimpleNMSEEvaluator() {
    3744      Parameters.Add(new LookupParameter<DoubleValue>("NormalizedMeanSquaredError", "The normalized mean squared error (divided by variance) of estimated values."));
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleRSquaredEvaluator.cs

    r4068 r4678  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Parameters;
     28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Common;
    2830
    2931namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    3234      get { return (ILookupParameter<DoubleValue>)Parameters["RSquared"]; }
    3335    }
    34 
     36    [StorableConstructor]
     37    protected SimpleRSquaredEvaluator(bool deserializing) : base(deserializing) { }
     38    protected SimpleRSquaredEvaluator(SimpleRSquaredEvaluator original, Cloner cloner)
     39      : base(original, cloner) {
     40    }
    3541    public SimpleRSquaredEvaluator() {
    3642      Parameters.Add(new LookupParameter<DoubleValue>("RSquared", "The squared Pearson's Product Moment Correlation (R²) of estimated values and original values."));
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleVarianceAccountedForEvaluator.cs

    r4068 r4678  
    2727using HeuristicLab.Data;
    2828using HeuristicLab.Parameters;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2930
    3031namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    4041    }
    4142
     43    [StorableConstructor]
     44    protected SimpleVarianceAccountedForEvaluator(bool deserializing) : base(deserializing) { }
     45    protected SimpleVarianceAccountedForEvaluator(SimpleVarianceAccountedForEvaluator original, Cloner cloner)
     46      : base(original, cloner) {
     47    }
    4248    public SimpleVarianceAccountedForEvaluator() {
    4349      Parameters.Add(new LookupParameter<DoubleValue>("VarianceAccountedFor", "The variance of the original values accounted for by the estimated values (VAF(y,y') = 1 - var(y-y') / var(y) )."));
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineCrossValidationEvaluator.cs

    r4543 r4678  
    3030using SVM;
    3131using System.Collections.Generic;
     32using HeuristicLab.Common;
    3233
    3334namespace HeuristicLab.Problems.DataAnalysis.SupportVectorMachine {
     
    126127    #endregion
    127128
     129    [StorableConstructor]
     130    protected SupportVectorMachineCrossValidationEvaluator(bool deserializing) : base(deserializing) { }
     131
     132    protected SupportVectorMachineCrossValidationEvaluator(SupportVectorMachineCrossValidationEvaluator original,
     133      Cloner cloner)
     134      : base(original, cloner) { }
    128135    public SupportVectorMachineCrossValidationEvaluator()
    129136      : base() {
     
    143150    }
    144151
     152    public override IDeepCloneable Clone(Cloner clone) {
     153      return new SupportVectorMachineCrossValidationEvaluator(this, cloner);
     154    }
     155
    145156    public override IOperation Apply() {
    146157      double reductionRatio = 1.0; // TODO: make parameter
    147158      if (ActualSamplesParameter.ActualValue != null)
    148159        reductionRatio = ActualSamplesParameter.ActualValue.Value;
    149       IEnumerable<int> rows = 
     160      IEnumerable<int> rows =
    150161        Enumerable.Range(SamplesStart.Value, SamplesEnd.Value - SamplesStart.Value)
    151162        .Where(i => i < DataAnalysisProblemData.TestSamplesStart.Value || DataAnalysisProblemData.TestSamplesEnd.Value <= i);
     
    153164      // create a new DataAnalysisProblemData instance
    154165      DataAnalysisProblemData reducedProblemData = (DataAnalysisProblemData)DataAnalysisProblemData.Clone();
    155       reducedProblemData.Dataset = 
     166      reducedProblemData.Dataset =
    156167        CreateReducedDataset(RandomParameter.ActualValue, reducedProblemData.Dataset, rows, reductionRatio);
    157168      reducedProblemData.TrainingSamplesStart.Value = 0;
     
    170181
    171182    private Dataset CreateReducedDataset(IRandom random, Dataset dataset, IEnumerable<int> rowIndices, double reductionRatio) {
    172      
     183
    173184      // must not make a fink:
    174185      // => select n rows randomly from start..end
     
    191202      // take the first n indexes (selected n rowIndexes from start..end)
    192203      // now order by index
    193       int[] orderedRandomIndexes = 
     204      int[] orderedRandomIndexes =
    194205        rowIndexArr.Take(n)
    195206        .OrderBy(x => x)
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModel.cs

    r4543 r4678  
    3636  [StorableClass]
    3737  [Item("SupportVectorMachineModel", "Represents a support vector machine model.")]
    38   public class SupportVectorMachineModel : NamedItem, IDataAnalysisModel {
    39     public SupportVectorMachineModel()
    40       : base() {
     38  public sealed class SupportVectorMachineModel : NamedItem, IDataAnalysisModel {
     39    [StorableConstructor]
     40    private SupportVectorMachineModel(bool deserializing) : base(deserializing) { }
     41    private SupportVectorMachineModel(SupportVectorMachineModel original, Cloner cloner)
     42      : base(original, cloner) {
     43      // only using a shallow copy here! (gkronber)
     44      this.model = original.model;
     45      this.rangeTransform = original.rangeTransform;
    4146    }
     47    public SupportVectorMachineModel() : base() { }
    4248
    4349    private SVM.Model model;
     
    130136    #endregion
    131137
    132     public override IDeepCloneable Clone(Cloner cloner) {
    133       SupportVectorMachineModel clone = (SupportVectorMachineModel)base.Clone(cloner);
    134       // beware we are only using a shallow copy here! (gkronber)
    135       clone.model = model;
    136       clone.rangeTransform = rangeTransform;
    137       return clone;
     138    public override IDeepCloneable Clone(Cloner clone) {
     139      return new SupportVectorMachineModel(this, cloner);
    138140    }
    139141
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModelCreator.cs

    r4543 r4678  
    2929using System.Collections.Generic;
    3030using System.Linq;
     31using HeuristicLab.Common;
    3132
    3233namespace HeuristicLab.Problems.DataAnalysis.SupportVectorMachine {
     
    3637  [StorableClass]
    3738  [Item("SupportVectorMachineModelCreator", "Represents an operator that creates a support vector machine model.")]
    38   public class SupportVectorMachineModelCreator : SingleSuccessorOperator {
     39  public sealed class SupportVectorMachineModelCreator : SingleSuccessorOperator {
    3940    private const string DataAnalysisProblemDataParameterName = "DataAnalysisProblemData";
    4041    private const string SvmTypeParameterName = "SvmType";
     
    110111    #endregion
    111112
     113    [StorableConstructor]
     114    private SupportVectorMachineModelCreator(bool deserializing) : base(deserializing) { }
     115    private SupportVectorMachineModelCreator(SupportVectorMachineModelCreator original, Cloner cloner) : base(original, cloner) { }
    112116    public SupportVectorMachineModelCreator()
    113117      : base() {
     
    129133      int start = SamplesStart.Value;
    130134      int end = SamplesEnd.Value;
    131       IEnumerable<int> rows = 
    132         Enumerable.Range(start, end-start)
     135      IEnumerable<int> rows =
     136        Enumerable.Range(start, end - start)
    133137        .Where(i => i < DataAnalysisProblemData.TestSamplesStart.Value || DataAnalysisProblemData.TestSamplesEnd.Value <= i);
    134138
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModelEvaluator.cs

    r4543 r4678  
    2828using System.Collections.Generic;
    2929using System.Linq;
     30using HeuristicLab.Common;
    3031
    3132namespace HeuristicLab.Problems.DataAnalysis.SupportVectorMachine {
     
    7071    }
    7172    #endregion
     73
     74    [StorableConstructor]
     75    protected SupportVectorMachineModelEvaluator(bool deserializing) : base(deserializing) { }
     76    protected SupportVectorMachineModelEvaluator(SupportVectorMachineModelEvaluator original, Cloner cloner) : base(original, cloner) { }
    7277    public SupportVectorMachineModelEvaluator()
    7378      : base() {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/ArithmeticExpressionGrammar.cs

    r4249 r4678  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    3031  [Item("ArithmeticExpressionGrammar", "Represents a grammar for functional expressions using only arithmetic operations.")]
    3132  public class ArithmeticExpressionGrammar : DefaultSymbolicExpressionGrammar {
     33
     34    [StorableConstructor]
     35    protected ArithmeticExpressionGrammar(bool deserializing) : base(deserializing) { }
     36    protected ArithmeticExpressionGrammar(ArithmeticExpressionGrammar original, Cloner cloner) : base(original, cloner) { }
    3237    public ArithmeticExpressionGrammar()
    3338      : base() {
    3439      Initialize();
    3540    }
    36 
    37     [StorableConstructor]
    38     protected ArithmeticExpressionGrammar(bool deserializing) : base(deserializing) { }
     41    public override IDeepCloneable Clone(Cloner cloner) {
     42      return new ArithmeticExpressionGrammar(this, cloner);
     43    }
    3944
    4045    private void Initialize() {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/FullFunctionalExpressionGrammar.cs

    r4249 r4678  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    3031  [Item("FullFunctionalExpressionGrammar", "Represents a grammar for functional expressions using all available functions.")]
    3132  public class FullFunctionalExpressionGrammar : DefaultSymbolicExpressionGrammar {
     33    [StorableConstructor]
     34    protected FullFunctionalExpressionGrammar(bool deserializing) : base(deserializing) { }
     35    protected FullFunctionalExpressionGrammar(FullFunctionalExpressionGrammar original, Cloner cloner) : base(original, cloner) { }
    3236    public FullFunctionalExpressionGrammar()
    3337      : base() {
    3438      Initialize();
    3539    }
    36     [StorableConstructor]
    37     protected FullFunctionalExpressionGrammar(bool deserializing) : base(deserializing) { }
     40
     41    public override IDeepCloneable Clone(Cloner cloner) {
     42      return new FullFunctionalExpressionGrammar(this, cloner);
     43    }
    3844
    3945    private void Initialize() {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs

    r4068 r4678  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    3334  [Item("SimpleArithmeticExpressionInterpreter", "Interpreter for arithmetic symbolic expression trees including function calls.")]
    3435  // not thread safe!
    35   public class SimpleArithmeticExpressionInterpreter : NamedItem, ISymbolicExpressionTreeInterpreter {
     36  public sealed class SimpleArithmeticExpressionInterpreter : NamedItem, ISymbolicExpressionTreeInterpreter {
    3637    private class OpCodes {
    3738      public const byte Add = 1;
     
    106107    }
    107108
     109    [StorableConstructor]
     110    private SimpleArithmeticExpressionInterpreter(bool deserializing) : base(deserializing) { }
     111    private SimpleArithmeticExpressionInterpreter(SimpleArithmeticExpressionInterpreter original, Cloner cloner)      : base(original, cloner) {    }
     112
     113    public override IDeepCloneable Clone(Cloner cloner) {
     114      return new SimpleArithmeticExpressionInterpreter(this, cloner);
     115    }
     116
    108117    public SimpleArithmeticExpressionInterpreter()
    109118      : base() {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Constant.cs

    r4068 r4678  
    7777    }
    7878    #endregion
     79    [StorableConstructor]
     80    protected Constant(bool deserializing) : base(deserializing) { }
     81    protected Constant(Constant original, Cloner cloner)
     82      : base(original, cloner) {
     83      minValue = original.minValue;
     84      maxValue = original.maxValue;
     85      manipulatorNu = original.manipulatorNu;
     86      manipulatorSigma = original.manipulatorSigma;
     87    }
    7988    public Constant()
    8089      : base("Constant", "Represents a constant value.") {
     
    8998    }
    9099
    91     public override IDeepCloneable Clone(Cloner cloner) {
    92       Constant clone = (Constant)base.Clone(cloner);
    93       clone.minValue = minValue;
    94       clone.maxValue = maxValue;
    95       clone.manipulatorNu = manipulatorNu;
    96       clone.manipulatorSigma = manipulatorSigma;
    97       return clone;
     100    public override IDeepCloneable Clone(Cloner clone) {
     101      return new Constant(this, cloner);
    98102    }
    99103  }
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/ConstantTreeNode.cs

    r4068 r4678  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    3839    }
    3940
    40     private ConstantTreeNode() : base() { }
     41    [StorableConstructor]
     42    private ConstantTreeNode(bool deserializing) : base(deserializing) { }
    4143
    42     // copy constructor
    43     private ConstantTreeNode(ConstantTreeNode original)
    44       : base(original) {
     44    protected ConstantTreeNode(ConstantTreeNode original, Cloner cloner)
     45      : base(original, cloner) {
    4546      constantValue = original.constantValue;
    4647    }
    4748
     49    private ConstantTreeNode() : base() { }
    4850    public ConstantTreeNode(Constant constantSymbol) : base(constantSymbol) { }
    4951
     
    6567    }
    6668
    67     public override object Clone() {
    68       return new ConstantTreeNode(this);
     69    public override IDeepCloneable Clone(Cloner cloner) {
     70      return new ConstantTreeNode(this, cloner);
    6971    }
    7072
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariable.cs

    r4068 r4678  
    4040      set { maxLag = value; }
    4141    }
     42    [StorableConstructor]
     43    private LaggedVariable(bool deserializing) : base(deserializing) { }
     44    private LaggedVariable(LaggedVariable original, Cloner cloner)
     45      : base(original, cloner) {
     46      minLag = original.minLag;
     47      maxLag = original.maxLag;
     48    }
    4249    public LaggedVariable()
    4350      : base("LaggedVariable", "Represents a variable value with a time offset.") {
     
    4956    }
    5057
    51     public override IDeepCloneable Clone(Cloner cloner) {
    52       LaggedVariable clone = (LaggedVariable)base.Clone(cloner);
    53       clone.minLag = minLag;
    54       clone.maxLag = maxLag;
    55       return clone;
     58    public override IDeepCloneable Clone(Cloner clone) {
     59      return new LaggedVariable(this, cloner);
    5660    }
    5761  }
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs

    r4068 r4678  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Common;
    2526namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
    2627  [StorableClass]
     
    3637    }
    3738
    38     private LaggedVariableTreeNode() { }
    39 
    40     // copy constructor
    41     private LaggedVariableTreeNode(LaggedVariableTreeNode original)
    42       : base(original) {
     39    [StorableConstructor]
     40    private LaggedVariableTreeNode(bool deserializing) : base(deserializing) { }
     41    protected LaggedVariableTreeNode(LaggedVariableTreeNode original, Cloner cloner)
     42      : base(original, cloner) {
    4343      lag = original.lag;
    4444    }
     45    private LaggedVariableTreeNode() { }
    4546
    4647    public LaggedVariableTreeNode(LaggedVariable variableSymbol) : base(variableSymbol) { }
     
    6263    }
    6364
    64 
    65     public override object Clone() {
    66       return new LaggedVariableTreeNode(this);
     65    public override IDeepCloneable Clone(Cloner cloner) {
     66      return new LaggedVariableTreeNode(this, cloner);
    6767    }
    6868
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs

    r4068 r4678  
    9090    }
    9191    #endregion
     92    [StorableConstructor]
     93    protected Variable(bool deserializing) : base(deserializing) { }
     94    protected Variable(Variable original, Cloner cloner)
     95      : base(original, cloner) {
     96      weightNu = original.weightNu;
     97      weightSigma = original.weightSigma;
     98      variableNames = new List<string>(original.variableNames);
     99      weightManipulatorNu = original.weightManipulatorNu;
     100      weightManipulatorSigma = original.weightManipulatorSigma;
     101    }
    92102    public Variable() : this("Variable", "Represents a variable value.") { }
    93103    public Variable(string name, string description)
     
    104114    }
    105115
    106     public override IDeepCloneable Clone(Cloner cloner) {
    107       Variable clone = (Variable)base.Clone(cloner);
    108       clone.weightNu = weightNu;
    109       clone.weightSigma = weightSigma;
    110       clone.variableNames = new List<string>(variableNames);
    111       clone.weightManipulatorNu = weightManipulatorNu;
    112       clone.weightManipulatorSigma = weightManipulatorSigma;
    113       return clone;
     116    public override IDeepClonable Clone(Cloner clone) {
     117      return new Variable(this, cloner);
    114118    }
    115119  }
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableTreeNode.cs

    r4239 r4678  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    23 using HeuristicLab.Common;
    2424using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    4444    }
    4545
    46 
    47     protected VariableTreeNode() { }
    48 
    49     // copy constructor
    50     protected VariableTreeNode(VariableTreeNode original)
    51       : base(original) {
     46    [StorableConstructor]
     47    protected VariableTreeNode(bool deserializing) : base(deserializing) { }
     48    protected VariableTreeNode(VariableTreeNode original, Cloner cloner)
     49      : base(original, cloner) {
    5250      weight = original.weight;
    5351      variableName = original.variableName;
    5452    }
    55 
     53    protected VariableTreeNode() { }
    5654    public VariableTreeNode(Variable variableSymbol) : base(variableSymbol) { }
    5755
     
    7573    }
    7674
    77 
    78     public override object Clone() {
    79       return new VariableTreeNode(this);
     75    public override IDeepCloneable Clone(Cloner cloner) {
     76      return new VariableTreeNode(this, cloner);
    8077    }
    8178
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/VariableFrequencyAnalyser.cs

    r4125 r4678  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    6162    }
    6263    #endregion
     64    [StorableConstructor]
     65    protected VariableFrequencyAnalyser(bool deserializing) : base(deserializing) { }
     66    protected VariableFrequencyAnalyser(VariableFrequencyAnalyser original, Cloner cloner)
     67      : base(original, cloner) {
     68    }
    6369    public VariableFrequencyAnalyser()
    6470      : base() {
     
    8086        VariableFrequencies[lastRowIndex, columnIndex] = pair.Value;
    8187      }
    82       return null;
     88      return base.Apply();
    8389    }
    8490
Note: See TracChangeset for help on using the changeset viewer.