Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4688


Ignore:
Timestamp:
10/29/10 20:26:45 (14 years ago)
Author:
swagner
Message:

Finished cloning refactoring of HeuristicLab.Problems.TestFunctions (#922)

Location:
branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Analyzers/BestSingleObjectiveTestFunctionSolutionAnalyzer.cs

    r4098 r4688  
    2121
    2222using System.Linq;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    7273    [StorableConstructor]
    7374    protected BestSingleObjectiveTestFunctionSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     75    protected BestSingleObjectiveTestFunctionSolutionAnalyzer(BestSingleObjectiveTestFunctionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    7476    public BestSingleObjectiveTestFunctionSolutionAnalyzer()
    7577      : base() {
     
    8991    /// </summary>
    9092    [StorableHook(HookType.AfterDeserialization)]
    91     private void CompatibilityMethod() {
     93    private void AfterDeserialization() {
    9294      // BackwardsCompatibility3.3
    9395      // Bounds are introduced in 3.3.0.3894
    9496      if (!Parameters.ContainsKey("Bounds"))
    9597        Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The bounds of the function."));
     98    }
     99
     100    public override IDeepCloneable Clone(Cloner cloner) {
     101      return new BestSingleObjectiveTestFunctionSolutionAnalyzer(this, cloner);
    96102    }
    97103
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/AckleyEvaluator.cs

    r4068 r4688  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    6566    }
    6667
     68    [StorableConstructor]
     69    protected AckleyEvaluator(bool deserializing) : base(deserializing) { }
     70    protected AckleyEvaluator(AckleyEvaluator original, Cloner cloner) : base(original, cloner) { }
     71    public AckleyEvaluator() : base() { }
     72
     73    public override IDeepCloneable Clone(Cloner cloner) {
     74      return new AckleyEvaluator(this, cloner);
     75    }
     76
    6777    public override RealVector GetBestKnownSolution(int dimension) {
    6878      return new RealVector(dimension);
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/BealeEvaluator.cs

    r4068 r4688  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    6566    }
    6667
     68    [StorableConstructor]
     69    protected BealeEvaluator(bool deserializing) : base(deserializing) { }
     70    protected BealeEvaluator(BealeEvaluator original, Cloner cloner) : base(original, cloner) { }
     71    public BealeEvaluator() : base() { }
     72
     73    public override IDeepCloneable Clone(Cloner cloner) {
     74      return new BealeEvaluator(this, cloner);
     75    }
     76
    6777    public override RealVector GetBestKnownSolution(int dimension) {
    6878      if (dimension != 2) throw new ArgumentException(Name + ": This function is only defined for 2 dimensions.", "dimension");
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/BoothEvaluator.cs

    r4068 r4688  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    6465    }
    6566
     67    [StorableConstructor]
     68    protected BoothEvaluator(bool deserializing) : base(deserializing) { }
     69    protected BoothEvaluator(BoothEvaluator original, Cloner cloner) : base(original, cloner) { }
     70    public BoothEvaluator() : base() { }
     71
     72    public override IDeepCloneable Clone(Cloner cloner) {
     73      return new BoothEvaluator(this, cloner);
     74    }
     75
    6676    public override RealVector GetBestKnownSolution(int dimension) {
    6777      if (dimension != 2) throw new ArgumentException(Name + ": This function is only defined for 2 dimensions.", "dimension");
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/GriewankEvaluator.cs

    r4068 r4688  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    6465    public override int MaximumProblemSize {
    6566      get { return int.MaxValue; }
     67    }
     68
     69    [StorableConstructor]
     70    protected GriewankEvaluator(bool deserializing) : base(deserializing) { }
     71    protected GriewankEvaluator(GriewankEvaluator original, Cloner cloner) : base(original, cloner) { }
     72    public GriewankEvaluator() : base() { }
     73
     74    public override IDeepCloneable Clone(Cloner cloner) {
     75      return new GriewankEvaluator(this, cloner);
    6676    }
    6777
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/LevyEvaluator.cs

    r4068 r4688  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    6263    public override int MaximumProblemSize {
    6364      get { return int.MaxValue; }
     65    }
     66
     67    [StorableConstructor]
     68    protected LevyEvaluator(bool deserializing) : base(deserializing) { }
     69    protected LevyEvaluator(LevyEvaluator original, Cloner cloner) : base(original, cloner) { }
     70    public LevyEvaluator() : base() { }
     71
     72    public override IDeepCloneable Clone(Cloner cloner) {
     73      return new LevyEvaluator(this, cloner);
    6474    }
    6575
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/MatyasEvaluator.cs

    r4068 r4688  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    6465    }
    6566
     67    [StorableConstructor]
     68    protected MatyasEvaluator(bool deserializing) : base(deserializing) { }
     69    protected MatyasEvaluator(MatyasEvaluator original, Cloner cloner) : base(original, cloner) { }
     70    public MatyasEvaluator() : base() { }
     71
     72    public override IDeepCloneable Clone(Cloner cloner) {
     73      return new MatyasEvaluator(this, cloner);
     74    }
     75
    6676    public override RealVector GetBestKnownSolution(int dimension) {
    6777      if (dimension != 2) throw new ArgumentException(Name + ": This function is only defined for 2 dimensions.", "dimension");
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/MultinormalEvaluator.cs

    r4068 r4688  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Diagnostics;
    425using System.Linq;
     26using HeuristicLab.Common;
    527using HeuristicLab.Core;
    628using HeuristicLab.Data;
     
    2345    }
    2446    private static Random Random = new Random();
    25 
    26     [StorableConstructor]
    27     public MultinormalEvaluator(bool deserializing) { }
    2847
    2948    private Dictionary<int, List<RealVector>> stdCenters;
     
    6685    }
    6786
     87    [StorableConstructor]
     88    protected MultinormalEvaluator(bool deserializing) : base(deserializing) { }
     89    protected MultinormalEvaluator(MultinormalEvaluator original, Cloner cloner) : base(original, cloner) { }
    6890    public MultinormalEvaluator() {
    6991      Parameters.Add(new ValueParameter<ItemList<RealVector>>("Centers", "Centers of normal distributions"));
     
    7294      centers = new ItemList<RealVector>();
    7395      s_2s = new RealVector();
     96    }
     97
     98    public override IDeepCloneable Clone(Cloner cloner) {
     99      return new MultinormalEvaluator(this, cloner);
    74100    }
    75101
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/RastriginEvaluator.cs

    r4068 r4688  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    8384    }
    8485
     86    [StorableConstructor]
     87    protected RastriginEvaluator(bool deserializing) : base(deserializing) { }
     88    protected RastriginEvaluator(RastriginEvaluator original, Cloner cloner) : base(original, cloner) { }
    8589    /// <summary>
    8690    /// Initializes a new instance of the RastriginEvaluator with one parameter (<c>A</c>).
     
    8993      : base() {
    9094      Parameters.Add(new ValueParameter<DoubleValue>("A", "The parameter A is a parameter of the objective function y = Sum((x_i)^2 + A * (1 - Cos(2pi*x_i))). Default is A = 10.", new DoubleValue(10)));
     95    }
     96
     97    public override IDeepCloneable Clone(Cloner cloner) {
     98      return new RastriginEvaluator(this, cloner);
    9199    }
    92100
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/RosenbrockEvaluator.cs

    r4068 r4688  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    6869    }
    6970
     71    [StorableConstructor]
     72    protected RosenbrockEvaluator(bool deserializing) : base(deserializing) { }
     73    protected RosenbrockEvaluator(RosenbrockEvaluator original, Cloner cloner) : base(original, cloner) { }
     74    public RosenbrockEvaluator() : base() { }
     75
     76    public override IDeepCloneable Clone(Cloner cloner) {
     77      return new RosenbrockEvaluator(this, cloner);
     78    }
     79
    7080    public override RealVector GetBestKnownSolution(int dimension) {
    7181      if (dimension < 2) throw new ArgumentException(Name + ": This function is not defined for 1 dimension.");
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SchwefelEvaluator.cs

    r4068 r4688  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    6465    }
    6566
     67    [StorableConstructor]
     68    protected SchwefelEvaluator(bool deserializing) : base(deserializing) { }
     69    protected SchwefelEvaluator(SchwefelEvaluator original, Cloner cloner) : base(original, cloner) { }
     70    public SchwefelEvaluator() : base() { }
     71
     72    public override IDeepCloneable Clone(Cloner cloner) {
     73      return new SchwefelEvaluator(this, cloner);
     74    }
     75
    6676    public override RealVector GetBestKnownSolution(int dimension) {
    6777      return null;
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SingleObjectiveTestFunctionProblemEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    6768      get { return (ILookupParameter<RealVector>)Parameters["Point"]; }
    6869    }
     70
     71    [StorableConstructor]
     72    protected SingleObjectiveTestFunctionProblemEvaluator(bool deserializing) : base(deserializing) { }
     73    protected SingleObjectiveTestFunctionProblemEvaluator(SingleObjectiveTestFunctionProblemEvaluator original, Cloner cloner) : base(original, cloner) { }
    6974    /// <summary>
    7075    /// Initializes a new instance of <see cref="SingleObjectiveTestFunctionEvaluator"/> with two parameters
    7176    /// (<c>Quality</c> and <c>Point</c>).
    7277    /// </summary>
    73     public SingleObjectiveTestFunctionProblemEvaluator() {
     78    public SingleObjectiveTestFunctionProblemEvaluator()
     79      : base() {
    7480      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "Result of the evaluation of a solution."));
    7581      Parameters.Add(new LookupParameter<RealVector>("Point", "The point at which the function should be evaluated."));
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SphereEvaluator.cs

    r4068 r4688  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    6667    }
    6768
     69    public override IDeepCloneable Clone(Cloner cloner) {
     70      return new SphereEvaluator(this, cloner);
     71    }
     72
    6873    public override RealVector GetBestKnownSolution(int dimension) {
    6974      return new RealVector(dimension);
     
    97102    }
    98103
     104    [StorableConstructor]
     105    protected SphereEvaluator(bool deserializing) : base(deserializing) { }
     106    protected SphereEvaluator(SphereEvaluator original, Cloner cloner) : base(original, cloner) { }
    99107    /// <summary>
    100108    /// Initializes a new instance of the SphereEvaluator with two parameters (<c>C</c> and <c>Alpha</c>).
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/SumSquaresEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    6364    }
    6465
     66    [StorableConstructor]
     67    protected SumSquaresEvaluator(bool deserializing) : base(deserializing) { }
     68    protected SumSquaresEvaluator(SumSquaresEvaluator original, Cloner cloner) : base(original, cloner) { }
     69    public SumSquaresEvaluator() : base() { }
     70
     71    public override IDeepCloneable Clone(Cloner cloner) {
     72      return new SumSquaresEvaluator(this, cloner);
     73    }
     74
    6575    public override RealVector GetBestKnownSolution(int dimension) {
    6676      return new RealVector(dimension);
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Evaluators/ZakharovEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    6768    }
    6869
     70    [StorableConstructor]
     71    protected ZakharovEvaluator(bool deserializing) : base(deserializing) { }
     72    protected ZakharovEvaluator(ZakharovEvaluator original, Cloner cloner) : base(original, cloner) { }
     73    public ZakharovEvaluator() : base() { }
     74
     75    public override IDeepCloneable Clone(Cloner cloner) {
     76      return new ZakharovEvaluator(this, cloner);
     77    }
     78
    6979    /// <summary>
    7080    /// Evaluates the test function for a specific <paramref name="point"/>.
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/AckleyAdditiveMoveEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.RealVectorEncoding;
     
    3132      get { return typeof(AckleyEvaluator); }
    3233    }
     34
     35    [StorableConstructor]
     36    protected AckleyAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     37    protected AckleyAdditiveMoveEvaluator(AckleyAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
     38    public AckleyAdditiveMoveEvaluator() : base() { }
     39
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new AckleyAdditiveMoveEvaluator(this, cloner);
     42    }
     43
    3344    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3445      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/AdditiveMoveEvaluator.cs

    r4068 r4688  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    5152    }
    5253
     54    [StorableConstructor]
     55    protected AdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     56    protected AdditiveMoveEvaluator(AdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
    5357    protected AdditiveMoveEvaluator()
    5458      : base() {
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/BealeAdditiveMoveEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.RealVectorEncoding;
     
    3132      get { return typeof(BealeEvaluator); }
    3233    }
     34
     35    [StorableConstructor]
     36    protected BealeAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     37    protected BealeAdditiveMoveEvaluator(BealeAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
     38    public BealeAdditiveMoveEvaluator() : base() { }
     39
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new BealeAdditiveMoveEvaluator(this, cloner);
     42    }
     43
    3344    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3445      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/BoothAdditiveMoveEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.RealVectorEncoding;
     
    3132      get { return typeof(BoothEvaluator); }
    3233    }
     34
     35    [StorableConstructor]
     36    protected BoothAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     37    protected BoothAdditiveMoveEvaluator(BoothAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
     38    public BoothAdditiveMoveEvaluator() : base() { }
     39
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new BoothAdditiveMoveEvaluator(this, cloner);
     42    }
     43
    3344    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3445      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/GriewankAdditiveMoveEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.RealVectorEncoding;
     
    3132      get { return typeof(GriewankEvaluator); }
    3233    }
     34
     35    [StorableConstructor]
     36    protected GriewankAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     37    protected GriewankAdditiveMoveEvaluator(GriewankAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
     38    public GriewankAdditiveMoveEvaluator() : base() { }
     39
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new GriewankAdditiveMoveEvaluator(this, cloner);
     42    }
     43
    3344    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3445      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/LevyAdditiveMoveEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.RealVectorEncoding;
     
    3132      get { return typeof(LevyEvaluator); }
    3233    }
     34
     35    [StorableConstructor]
     36    protected LevyAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     37    protected LevyAdditiveMoveEvaluator(LevyAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
     38    public LevyAdditiveMoveEvaluator() : base() { }
     39
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new LevyAdditiveMoveEvaluator(this, cloner);
     42    }
     43
    3344    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3445      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/MatyasAdditiveMoveEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.RealVectorEncoding;
     
    3132      get { return typeof(MatyasEvaluator); }
    3233    }
     34
     35    [StorableConstructor]
     36    protected MatyasAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     37    protected MatyasAdditiveMoveEvaluator(MatyasAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
     38    public MatyasAdditiveMoveEvaluator() : base() { }
     39
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new MatyasAdditiveMoveEvaluator(this, cloner);
     42    }
     43
    3344    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3445      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/MultinormalAdditiveMoveEvaluator.cs

    r4068 r4688  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Encodings.RealVectorEncoding;
     
    3536    }
    3637
    37     MultinormalEvaluator evaluator = new MultinormalEvaluator();
    38 
     38    [StorableConstructor]
     39    protected MultinormalAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     40    protected MultinormalAdditiveMoveEvaluator(MultinormalAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
    3941    public MultinormalAdditiveMoveEvaluator() {
    4042      Parameters.Add(new LookupParameter<ISingleObjectiveTestFunctionProblemEvaluator>("Evaluator", ""));
     43    }
     44
     45    public override IDeepCloneable Clone(Cloner cloner) {
     46      return new MultinormalAdditiveMoveEvaluator(this, cloner);
    4147    }
    4248
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RastriginAdditiveMoveEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    4748    }
    4849
     50    [StorableConstructor]
     51    protected RastriginAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     52    protected RastriginAdditiveMoveEvaluator(RastriginAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
    4953    public RastriginAdditiveMoveEvaluator() {
    5054      Parameters.Add(new ValueParameter<DoubleValue>("A", "The parameter A is a parameter of the objective function y = Sum((x_i)^2 + A * (1 - Cos(2pi*x_i))). Default is A = 10.", new DoubleValue(10)));
     55    }
     56
     57    public override IDeepCloneable Clone(Cloner cloner) {
     58      return new RastriginAdditiveMoveEvaluator(this, cloner);
    5159    }
    5260
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RealVectorAdditiveMoveWrapper.cs

    r3450 r4688  
    3636      this.vector = new RealVector();
    3737    }
    38 
    3938    public RealVectorAdditiveMoveWrapper(AdditiveMove move, RealVector vector) {
    4039      dimension = move.Dimension;
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RosenbrockAdditiveMoveEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.RealVectorEncoding;
     
    3132      get { return typeof(RosenbrockEvaluator); }
    3233    }
     34
     35    [StorableConstructor]
     36    protected RosenbrockAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     37    protected RosenbrockAdditiveMoveEvaluator(RosenbrockAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
     38    public RosenbrockAdditiveMoveEvaluator() : base() { }
     39
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new RosenbrockAdditiveMoveEvaluator(this, cloner);
     42    }
     43
    3344    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3445      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/SchwefelAdditiveMoveEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.RealVectorEncoding;
     
    3132      get { return typeof(SchwefelEvaluator); }
    3233    }
     34
     35    [StorableConstructor]
     36    protected SchwefelAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     37    protected SchwefelAdditiveMoveEvaluator(SchwefelAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
     38    public SchwefelAdditiveMoveEvaluator() : base() { }
     39
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new SchwefelAdditiveMoveEvaluator(this, cloner);
     42    }
     43
    3344    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3445      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/SphereAdditiveMoveEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    6162    }
    6263
     64    [StorableConstructor]
     65    protected SphereAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     66    protected SphereAdditiveMoveEvaluator(SphereAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
    6367    public SphereAdditiveMoveEvaluator() {
    6468      Parameters.Add(new ValueParameter<DoubleValue>("C", "The parameter C modifies the steepness of the objective function y = C * ||X||^Alpha. Default is C = 1.", new DoubleValue(1)));
    6569      Parameters.Add(new ValueParameter<DoubleValue>("Alpha", "The parameter Alpha modifies the steepness of the objective function y = C * ||X||^Alpha. Default is Alpha = 2.", new DoubleValue(2)));
     70    }
     71
     72    public override IDeepCloneable Clone(Cloner cloner) {
     73      return new SphereAdditiveMoveEvaluator(this, cloner);
    6674    }
    6775
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/SumSquaresAdditiveMoveEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.RealVectorEncoding;
     
    3132      get { return typeof(SumSquaresEvaluator); }
    3233    }
     34
     35    [StorableConstructor]
     36    protected SumSquaresAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     37    protected SumSquaresAdditiveMoveEvaluator(SumSquaresAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
     38    public SumSquaresAdditiveMoveEvaluator() : base() { }
     39
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new SumSquaresAdditiveMoveEvaluator(this, cloner);
     42    }
     43
    3344    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3445      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/ZakharovAdditiveMoveEvaluator.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.RealVectorEncoding;
     
    3132      get { return typeof(ZakharovEvaluator); }
    3233    }
     34
     35    [StorableConstructor]
     36    protected ZakharovAdditiveMoveEvaluator(bool deserializing) : base(deserializing) { }
     37    protected ZakharovAdditiveMoveEvaluator(ZakharovAdditiveMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
     38    public ZakharovAdditiveMoveEvaluator() : base() { }
     39
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new ZakharovAdditiveMoveEvaluator(this, cloner);
     42    }
     43
    3344    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3445      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/RealVectorToRealVectorEncoder.cs

    r4068 r4688  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    2526using HeuristicLab.Operators;
    2627using HeuristicLab.Parameters;
     28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2729
    2830namespace HeuristicLab.Problems.TestFunctions {
     
    5557    }
    5658
     59    [StorableConstructor]
     60    protected RealVectorToRealVectorEncoder(bool deserializing) : base(deserializing) { }
     61    protected RealVectorToRealVectorEncoder(RealVectorToRealVectorEncoder original, Cloner cloner) : base(original, cloner) { }
    5762    public RealVectorToRealVectorEncoder()
    5863      : base() {
     
    6267      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope bounds matrix should be cloned."));
    6368      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds in each dimension."));
     69    }
     70
     71    public override IDeepCloneable Clone(Cloner cloner) {
     72      return new RealVectorToRealVectorEncoder(this, cloner);
    6473    }
    6574
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs

    r4419 r4688  
    134134    [StorableConstructor]
    135135    private SingleObjectiveTestFunctionProblem(bool deserializing) : base(deserializing) { }
     136    private SingleObjectiveTestFunctionProblem(SingleObjectiveTestFunctionProblem original, Cloner cloner)
     137      : base(original, cloner) {
     138      operators = original.operators.Where(x => original.IsNotFieldReferenced(x)).Select(x => cloner.Clone(x)).ToList();
     139      strategyVectorCreator = cloner.Clone(original.strategyVectorCreator);
     140      operators.Add(strategyVectorCreator);
     141      strategyVectorCrossover = cloner.Clone(original.strategyVectorCrossover);
     142      operators.Add(strategyVectorCrossover);
     143      strategyVectorManipulator = cloner.Clone(original.strategyVectorManipulator);
     144      operators.Add(strategyVectorManipulator);
     145      AttachEventHandlers();
     146    }
    136147    public SingleObjectiveTestFunctionProblem()
    137148      : base() {
     
    164175
    165176    public override IDeepCloneable Clone(Cloner cloner) {
    166       SingleObjectiveTestFunctionProblem clone = (SingleObjectiveTestFunctionProblem)base.Clone(cloner);
    167       clone.operators = operators.Where(x => IsNotFieldReferenced(x)).Select(x => (IOperator)cloner.Clone(x)).ToList();
    168       clone.strategyVectorCreator = (StdDevStrategyVectorCreator)cloner.Clone(strategyVectorCreator);
    169       clone.operators.Add(clone.strategyVectorCreator);
    170       clone.strategyVectorCrossover = (StdDevStrategyVectorCrossover)cloner.Clone(strategyVectorCrossover);
    171       clone.operators.Add(strategyVectorCrossover);
    172       clone.strategyVectorManipulator = (StdDevStrategyVectorManipulator)cloner.Clone(strategyVectorManipulator);
    173       clone.operators.Add(strategyVectorManipulator);
    174       clone.AttachEventHandlers();
    175       return clone;
     177      return new SingleObjectiveTestFunctionProblem(this, cloner);
    176178    }
    177179
     
    299301    #region Helpers
    300302    [StorableHook(HookType.AfterDeserialization)]
    301     private void AfterDeserializationHook() {
     303    private void AfterDeserialization() {
    302304      // BackwardsCompatibility3.3
    303305      #region Backwards compatible code (remove with 3.4)
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionSolution.cs

    r3894 r4688  
    122122    }
    123123
     124    [StorableConstructor]
     125    protected SingleObjectiveTestFunctionSolution(bool deserializing) : base(deserializing) { }
     126    protected SingleObjectiveTestFunctionSolution(SingleObjectiveTestFunctionSolution original, Cloner cloner)
     127      : base(original, cloner) {
     128      bestKnownRealVector = cloner.Clone(original.bestKnownRealVector);
     129      bestRealVector = cloner.Clone(original.bestRealVector);
     130      bestQuality = cloner.Clone(original.bestQuality);
     131      population = cloner.Clone(original.population);
     132      evaluator = cloner.Clone(original.evaluator);
     133      bounds = cloner.Clone(original.bounds);
     134      Initialize();
     135    }
    124136    public SingleObjectiveTestFunctionSolution() : base() { }
    125137    public SingleObjectiveTestFunctionSolution(RealVector realVector, DoubleValue quality, ISingleObjectiveTestFunctionProblemEvaluator evaluator)
     
    130142      Initialize();
    131143    }
    132     [StorableConstructor]
    133     private SingleObjectiveTestFunctionSolution(bool deserializing) : base(deserializing) { }
    134144
    135145    [StorableHook(HookType.AfterDeserialization)]
     146    private void AfterDeserialization() {
     147      Initialize();
     148    }
     149
    136150    private void Initialize() {
    137151      if (bestKnownRealVector != null) RegisterBestKnownRealVectorEvents();
     
    143157
    144158    public override IDeepCloneable Clone(Cloner cloner) {
    145       SingleObjectiveTestFunctionSolution clone = new SingleObjectiveTestFunctionSolution();
    146       cloner.RegisterClonedObject(this, clone);
    147       clone.bestKnownRealVector = (RealVector)cloner.Clone(bestKnownRealVector);
    148       clone.bestRealVector = (RealVector)cloner.Clone(bestRealVector);
    149       clone.bestQuality = (DoubleValue)cloner.Clone(bestQuality);
    150       clone.population = (ItemArray<RealVector>)cloner.Clone(population);
    151       clone.evaluator = (ISingleObjectiveTestFunctionProblemEvaluator)cloner.Clone(evaluator);
    152       clone.bounds = (DoubleMatrix)cloner.Clone(bounds);
    153       clone.Initialize();
    154       return clone;
     159      return new SingleObjectiveTestFunctionSolution(this, cloner);
    155160    }
    156161
Note: See TracChangeset for help on using the changeset viewer.