Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (14 years ago)
Author:
swagner
Message:

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.3/CrossValidation.cs

    r4617 r4722  
    7272    }
    7373
     74    private CrossValidation(CrossValidation original, Cloner cloner)
     75      : base(original, cloner) {
     76      executionState = original.executionState;
     77      storeAlgorithmInEachRun = original.storeAlgorithmInEachRun;
     78      runs = cloner.Clone(original.runs);
     79      runsCounter = original.runsCounter;
     80      algorithm = cloner.Clone(original.algorithm);
     81      clonedAlgorithms = cloner.Clone(original.clonedAlgorithms);
     82      folds = cloner.Clone(original.folds);
     83      numberOfWorkers = cloner.Clone(original.numberOfWorkers);
     84      samplesStart = cloner.Clone(original.samplesStart);
     85      samplesEnd = cloner.Clone(original.samplesEnd);
     86      RegisterEvents();
     87    }
    7488    public override IDeepCloneable Clone(Cloner cloner) {
    75       CrossValidation clone = (CrossValidation)base.Clone(cloner);
    76       clone.executionState = executionState;
    77       clone.storeAlgorithmInEachRun = storeAlgorithmInEachRun;
    78       clone.runs = (RunCollection)cloner.Clone(runs);
    79       clone.runsCounter = runsCounter;
    80       clone.algorithm = (IAlgorithm)cloner.Clone(algorithm);
    81       clone.clonedAlgorithms = (ItemCollection<IAlgorithm>)cloner.Clone(clonedAlgorithms);
    82       clone.folds = (IntValue)cloner.Clone(folds);
    83       clone.numberOfWorkers = (IntValue)cloner.Clone(numberOfWorkers);
    84       clone.samplesStart = (IntValue)cloner.Clone(samplesStart);
    85       clone.samplesEnd = (IntValue)cloner.Clone(samplesEnd);
    86       clone.RegisterEvents();
    87       return clone;
    88     }
     89      return new CrossValidation(this, cloner);
     90    }
     91
    8992    #endregion
    9093
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.3/LinearRegression.cs

    r4437 r4722  
    9999    [StorableConstructor]
    100100    private LinearRegression(bool deserializing) : base(deserializing) { }
     101    [StorableHook(HookType.AfterDeserialization)]
     102    private void AfterDeserialization() {
     103      Initialize();
     104    }
    101105
     106    private LinearRegression(LinearRegression original, Cloner cloner)
     107      : base(original, cloner) {
     108      solutionCreator = cloner.Clone(original.solutionCreator);
     109      evaluator = cloner.Clone(original.evaluator);
     110      mseEvaluator = cloner.Clone(original.mseEvaluator);
     111      analyzer = cloner.Clone(original.analyzer);
     112      Initialize();
     113    }
    102114    public override IDeepCloneable Clone(Cloner cloner) {
    103       LinearRegression clone = (LinearRegression)base.Clone(cloner);
    104       clone.solutionCreator = (LinearRegressionSolutionCreator)cloner.Clone(solutionCreator);
    105       clone.evaluator = (SimpleSymbolicRegressionEvaluator)cloner.Clone(evaluator);
    106       clone.mseEvaluator = (SimpleMSEEvaluator)cloner.Clone(mseEvaluator);
    107       clone.analyzer = (BestSymbolicRegressionSolutionAnalyzer)cloner.Clone(analyzer);
    108       clone.Initialize();
    109       return clone;
     115      return new LinearRegression(this, cloner);
    110116    }
    111117
     
    133139
    134140    #region Helpers
    135     [StorableHook(HookType.AfterDeserialization)]
    136141    private void Initialize() {
    137142      solutionCreator.SamplesStartParameter.ActualName = TrainingSamplesStartParameter.Name;
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.3/SupportVectorMachine.cs

    r4437 r4722  
    145145    [StorableConstructor]
    146146    private SupportVectorMachine(bool deserializing) : base(deserializing) { }
    147 
     147    [StorableHook(HookType.AfterDeserialization)]
     148    private void AfterDeserialization() {
     149      Initialize();
     150    }
     151
     152    private SupportVectorMachine(SupportVectorMachine original, Cloner cloner)
     153      : base(original, cloner) {
     154      solutionCreator = cloner.Clone(original.solutionCreator);
     155      evaluator = cloner.Clone(original.evaluator);
     156      mseEvaluator = cloner.Clone(original.mseEvaluator);
     157      analyzer = cloner.Clone(original.analyzer);
     158      Initialize();
     159    }
    148160    public override IDeepCloneable Clone(Cloner cloner) {
    149       SupportVectorMachine clone = (SupportVectorMachine)base.Clone(cloner);
    150       clone.solutionCreator = (SupportVectorMachineModelCreator)cloner.Clone(solutionCreator);
    151       clone.evaluator = (SupportVectorMachineModelEvaluator)cloner.Clone(evaluator);
    152       clone.mseEvaluator = (SimpleMSEEvaluator)cloner.Clone(mseEvaluator);
    153       clone.analyzer = (BestSupportVectorRegressionSolutionAnalyzer)cloner.Clone(analyzer);
    154       clone.Initialize();
    155       return clone;
     161      return new SupportVectorMachine(this, cloner);
    156162    }
    157163
     
    178184
    179185    #region Helpers
    180     [StorableHook(HookType.AfterDeserialization)]
    181186    private void Initialize() {
    182187      solutionCreator.SvmTypeParameter.ActualName = SvmTypeParameter.Name;
Note: See TracChangeset for help on using the changeset viewer.