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

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/MultiBinaryVectorCrossover.cs

    r3674 r4722  
    2323using System.Linq;
    2424using HeuristicLab.Collections;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Operators;
     
    5051
    5152    [StorableConstructor]
    52     private MultiBinaryVectorCrossover(bool deserializing) : base(deserializing) { }
     53    protected MultiBinaryVectorCrossover(bool deserializing) : base(deserializing) { }
     54    protected MultiBinaryVectorCrossover(MultiBinaryVectorCrossover original, Cloner cloner) : base(original, cloner) { }
    5355    public MultiBinaryVectorCrossover()
    5456      : base() {
     
    6264          Operators.Add((IBinaryVectorCrossover)Activator.CreateInstance(type), true);
    6365      }
     66    }
     67
     68    public override IDeepCloneable Clone(Cloner cloner) {
     69      return new MultiBinaryVectorCrossover(this, cloner);
    6470    }
    6571
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/NPointCrossover.cs

    r4068 r4722  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3637  [Item("NPointCrossover", "N point crossover for binary vectors. It is implemented as described in Eiben, A.E. and Smith, J.E. 2003. Introduction to Evolutionary Computation. Natural Computing Series, Springer-Verlag Berlin Heidelberg.")]
    3738  [StorableClass]
    38   public class NPointCrossover : BinaryVectorCrossover {
     39  public sealed class NPointCrossover : BinaryVectorCrossover {
    3940    /// <summary>
    4041    /// Number of crossover points.
     
    4445    }
    4546
     47    [StorableConstructor]
     48    private NPointCrossover(bool deserializing) : base(deserializing) { }
     49    private NPointCrossover(NPointCrossover original, Cloner cloner) : base(original, cloner) { }
    4650    /// <summary>
    4751    /// Initializes a new instance of <see cref="NPointCrossover"/>
    4852    /// </summary>
    49     public NPointCrossover() {
     53    public NPointCrossover()
     54      : base() {
    5055      Parameters.Add(new ValueLookupParameter<IntValue>("N", "Number of crossover points", new IntValue(2)));
     56    }
     57
     58    public override IDeepCloneable Clone(Cloner cloner) {
     59      return new NPointCrossover(this, cloner);
    5160    }
    5261
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs

    r4068 r4722  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    3435  [Item("SinglePointCrossover", "Single point crossover for binary vectors. It is implemented based on the NPointCrossover.")]
    3536  [StorableClass]
    36   public class SinglePointCrossover : BinaryVectorCrossover {
     37  public sealed class SinglePointCrossover : BinaryVectorCrossover {
     38
     39    [StorableConstructor]
     40    private SinglePointCrossover(bool deserializing) : base(deserializing) { }
     41    private SinglePointCrossover(SinglePointCrossover original, Cloner cloner) : base(original, cloner) { }
     42    public SinglePointCrossover() : base() { }
     43
     44    public override IDeepCloneable Clone(Cloner cloner) {
     45      return new SinglePointCrossover(this, cloner);
     46    }
     47
    3748    /// <summary>
    3849    /// Performs a single point crossover at a randomly chosen position of two
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/UniformCrossover.cs

    r4068 r4722  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3334  [Item("UniformCrossover", "Uniform crossover for binary vectors. It is implemented as described in Eiben, A.E. and Smith, J.E. 2003. Introduction to Evolutionary Computation. Natural Computing Series, Springer-Verlag Berlin Heidelberg.")]
    3435  [StorableClass]
    35   public class UniformCrossover : BinaryVectorCrossover {
     36  public sealed class UniformCrossover : BinaryVectorCrossover {
     37
     38    [StorableConstructor]
     39    private UniformCrossover(bool deserializing) : base(deserializing) { }
     40    private UniformCrossover(UniformCrossover original, Cloner cloner) : base(original, cloner) { }
     41    public UniformCrossover() : base() { }
     42
     43    public override IDeepCloneable Clone(Cloner cloner) {
     44      return new UniformCrossover(this, cloner);
     45    }
     46
    3647    /// <summary>
    3748    /// Performs a uniform crossover between two binary vectors.
Note: See TracChangeset for help on using the changeset viewer.