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:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/AckleyAdditiveMoveEvaluator.cs

    r4068 r4722  
    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);
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/AdditiveMoveEvaluator.cs

    r4068 r4722  
    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() {
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/BealeAdditiveMoveEvaluator.cs

    r4068 r4722  
    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);
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/BoothAdditiveMoveEvaluator.cs

    r4068 r4722  
    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);
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/GriewankAdditiveMoveEvaluator.cs

    r4068 r4722  
    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);
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/LevyAdditiveMoveEvaluator.cs

    r4068 r4722  
    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);
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/MatyasAdditiveMoveEvaluator.cs

    r4068 r4722  
    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);
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/MultinormalAdditiveMoveEvaluator.cs

    r4068 r4722  
    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
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RastriginAdditiveMoveEvaluator.cs

    r4068 r4722  
    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
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RealVectorAdditiveMoveWrapper.cs

    r3450 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Encodings.RealVectorEncoding;
    2324
     
    2627  /// This wrapper disguises as real vector for use in the evaluation functions.
    2728  /// </summary>
    28   internal class RealVectorAdditiveMoveWrapper : RealVector {
     29  internal sealed class RealVectorAdditiveMoveWrapper : RealVector {
    2930    private int dimension;
    3031    private double moveDistance;
    3132    private RealVector vector;
    3233
     34    private RealVectorAdditiveMoveWrapper(bool deserializing) : base(deserializing) { }
     35    private RealVectorAdditiveMoveWrapper(RealVectorAdditiveMoveWrapper original, Cloner cloner)
     36      : base(original, cloner) {
     37      this.dimension = original.dimension;
     38      this.moveDistance = original.moveDistance;
     39      this.vector = cloner.Clone(vector);
     40    }
    3341    public RealVectorAdditiveMoveWrapper() {
    3442      dimension = -1;
     
    3644      this.vector = new RealVector();
    3745    }
    38 
    3946    public RealVectorAdditiveMoveWrapper(AdditiveMove move, RealVector vector) {
    4047      dimension = move.Dimension;
    4148      moveDistance = move.MoveDistance;
    4249      this.vector = vector;
     50    }
     51
     52    public override IDeepCloneable Clone(Cloner cloner) {
     53      return new RealVectorAdditiveMoveWrapper(this, cloner);
    4354    }
    4455
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RosenbrockAdditiveMoveEvaluator.cs

    r4068 r4722  
    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);
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/SchwefelAdditiveMoveEvaluator.cs

    r4068 r4722  
    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);
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/SphereAdditiveMoveEvaluator.cs

    r4068 r4722  
    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
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/SumSquaresAdditiveMoveEvaluator.cs

    r4068 r4722  
    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);
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/ZakharovAdditiveMoveEvaluator.cs

    r4068 r4722  
    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);
Note: See TracChangeset for help on using the changeset viewer.