Ignore:
Timestamp:
07/19/12 11:04:48 (7 years ago)
Author:
jkarder
Message:

#1331: made similarity calculators storable and cloneable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3/SimilarityCalculators/SingleObjectiveTestFunctionSimilarityCalculator.cs

    r8086 r8303  
    2626using HeuristicLab.Encodings.RealVectorEncoding;
    2727using HeuristicLab.Optimization.Operators;
     28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2829
    2930namespace HeuristicLab.Problems.TestFunctions {
     
    3233  /// </summary>
    3334  [Item("SingleObjectiveTestFunctionSimilarityCalculator", "An operator that performs similarity calculation between two test functions solutions.")]
     35  [StorableClass]
    3436  public sealed class SingleObjectiveTestFunctionSimilarityCalculator : SimilarityCalculator {
    3537    #region Properties
     38    [Storable]
    3639    public DoubleMatrix Bounds { get; set; }
    3740    #endregion
    3841
     42    [StorableConstructor]
    3943    private SingleObjectiveTestFunctionSimilarityCalculator(bool deserializing) : base(deserializing) { }
    40     private SingleObjectiveTestFunctionSimilarityCalculator(SingleObjectiveTestFunctionSimilarityCalculator original, Cloner cloner) : base(original, cloner) { }
     44    private SingleObjectiveTestFunctionSimilarityCalculator(SingleObjectiveTestFunctionSimilarityCalculator original, Cloner cloner)
     45      : base(original, cloner) {
     46      this.Bounds = cloner.Clone(original.Bounds);
     47    }
    4148    public SingleObjectiveTestFunctionSimilarityCalculator() : base() { }
     49
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new SingleObjectiveTestFunctionSimilarityCalculator(this, cloner);
     52    }
    4253
    4354    public static double CalculateSimilarity(RealVector left, RealVector right, DoubleMatrix bounds) {
Note: See TracChangeset for help on using the changeset viewer.