Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4663


Ignore:
Timestamp:
10/29/10 16:41:43 (12 years ago)
Author:
abeham
Message:

#922

  • Refactored HeuristicLab.Encodings.BinaryVectorEncoding
Location:
branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/BinaryVector.cs

    r3431 r4663  
    2929  [Item("BinaryVector", "Represents a vector of binary values.")]
    3030  public class BinaryVector : BoolArray {
     31    [StorableConstructor]
     32    protected BinaryVector(bool deserializing) : base(deserializing) { }
     33    protected BinaryVector(BinaryVector original, Cloner cloner) : base(original, cloner) { }
    3134    public BinaryVector() : base() { }
    3235    public BinaryVector(int length) : base(length) { }
     
    4346
    4447    public override IDeepCloneable Clone(Cloner cloner) {
    45       BinaryVector clone = new BinaryVector(array);
    46       cloner.RegisterClonedObject(this, clone);
    47       clone.readOnly = readOnly;
    48       return clone;
     48      return new BinaryVector(this, cloner);
    4949    }
    5050
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/BinaryVectorCreator.cs

    r4068 r4663  
    2626using HeuristicLab.Parameters;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    4748    }
    4849
     50    [StorableConstructor]
     51    protected BinaryVectorCreator(bool deserializing) : base(deserializing) { }
     52    protected BinaryVectorCreator(BinaryVectorCreator original, Cloner cloner) : base(original, cloner) { }
    4953    protected BinaryVectorCreator()
    5054      : base() {
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/BinaryVectorCrossover.cs

    r4068 r4663  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    4647    }
    4748
     49    [StorableConstructor]
     50    protected BinaryVectorCrossover(bool deserializing) : base(deserializing) { }
     51    protected BinaryVectorCrossover(BinaryVectorCrossover original, Cloner cloner) : base(original, cloner) { }
    4852    protected BinaryVectorCrossover()
    4953      : base() {
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/BinaryVectorManipulator.cs

    r4068 r4663  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    4344    }
    4445
     46    [StorableConstructor]
     47    protected BinaryVectorManipulator(bool deserializing) : base(deserializing) { }
     48    protected BinaryVectorManipulator(BinaryVectorManipulator original, Cloner cloner) : base(original, cloner) { }
    4549    protected BinaryVectorManipulator()
    4650      : base() {
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Creators/RandomBinaryVectorCreator.cs

    r4068 r4663  
    2323using HeuristicLab.Data;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Common;
    2526
    2627namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    3031  [Item("RandomBinaryVectorCreator", "An operator which creates a new random binary vector with each element randomly initialized.")]
    3132  [StorableClass]
    32   public class RandomBinaryVectorCreator : BinaryVectorCreator {
     33  public sealed class RandomBinaryVectorCreator : BinaryVectorCreator {
     34    [StorableConstructor]
     35    private RandomBinaryVectorCreator(bool deserializing) : base(deserializing) { }
     36    private RandomBinaryVectorCreator(RandomBinaryVectorCreator original, Cloner cloner) : base(original, cloner) { }
     37    public RandomBinaryVectorCreator() : base() { }
     38
     39    public override IDeepCloneable Clone(Cloner cloner) {
     40      return new RandomBinaryVectorCreator(this, cloner);
     41    }
     42
    3343    /// <summary>
    3444    /// Generates a new random binary vector with the given <paramref name="length"/>.
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/MultiBinaryVectorCrossover.cs

    r3674 r4663  
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3030using HeuristicLab.PluginInfrastructure;
     31using HeuristicLab.Common;
    3132
    3233namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    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
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/NPointCrossover.cs

    r4068 r4663  
    2626using HeuristicLab.Parameters;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    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
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs

    r4068 r4663  
    2424using HeuristicLab.Data;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HeuristicLab.Common;
    2627
    2728namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    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
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/UniformCrossover.cs

    r4068 r4663  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Common;
    2526
    2627namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    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.
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Manipulators/SinglePositionBitflipManipulator.cs

    r4068 r4663  
    2222using HeuristicLab.Core;
    2323using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     24using HeuristicLab.Common;
    2425
    2526namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    3233  [Item("SinglePositionBitflipManipulator", "Flips exactly one bit of a binary vector. It is implemented as described in Michalewicz, Z. 1999. Genetic Algorithms + Data Structures = Evolution Programs. Third, Revised and Extended Edition, Spring-Verlag Berlin Heidelberg.")]
    3334  [StorableClass]
    34   public class SinglePositionBitflipManipulator : BinaryVectorManipulator {
     35  public sealed class SinglePositionBitflipManipulator : BinaryVectorManipulator {
     36
     37    [StorableConstructor]
     38    private SinglePositionBitflipManipulator(bool deserializing) : base(deserializing) { }
     39    private SinglePositionBitflipManipulator(SinglePositionBitflipManipulator original, Cloner cloner) : base(original, cloner) { }
     40    public SinglePositionBitflipManipulator() : base() { }
     41
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new SinglePositionBitflipManipulator(this, cloner);
     44    }
     45
    3546    /// <summary>
    3647    /// Performs the single position bitflip mutation on a binary vector.
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Manipulators/SomePositionsBitflipManipulator.cs

    r4068 r4663  
    2424using HeuristicLab.Parameters;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HeuristicLab.Common;
    2627
    2728namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    3435  [Item("SomePositionsBitflipManipulator", "Flips some bits of a binary vector, each position is flipped with a probability of pm. 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, p. 43.")]
    3536  [StorableClass]
    36   public class SomePositionsBitflipManipulator : BinaryVectorManipulator {
     37  public sealed class SomePositionsBitflipManipulator : BinaryVectorManipulator {
    3738    /// <summary>
    3839    /// Mmutation probability for each position.
     
    4243    }
    4344
     45    [StorableConstructor]
     46    private SomePositionsBitflipManipulator(bool deserializing) : base(deserializing) { }
     47    private SomePositionsBitflipManipulator(SomePositionsBitflipManipulator original, Cloner cloner) : base(original, cloner) { }
    4448    /// <summary>
    4549    /// Initializes a new instance of <see cref="NPointCrossover"/>
    4650    /// </summary>
    47     public SomePositionsBitflipManipulator() {
     51    public SomePositionsBitflipManipulator()
     52      : base() {
    4853      Parameters.Add(new ValueLookupParameter<DoubleValue>("MutationProbability", "The mutation probability for each position", new DoubleValue(0.2)));
     54    }
     55
     56    public override IDeepCloneable Clone(Cloner cloner) {
     57      return new SomePositionsBitflipManipulator(this, cloner);
    4958    }
    5059
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/ExhaustiveOneBitflipMoveGenerator.cs

    r4068 r4663  
    2323using HeuristicLab.Optimization;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Common;
    2526
    2627namespace HeuristicLab.Encodings.BinaryVectorEncoding {
    2728  [Item("ExhaustiveBitflipMoveGenerator", "Generates all possible one bitflip moves from a given binaryVector.")]
    2829  [StorableClass]
    29   public class ExhaustiveOneBitflipMoveGenerator : OneBitflipMoveGenerator, IExhaustiveMoveGenerator {
     30  public sealed class ExhaustiveOneBitflipMoveGenerator : OneBitflipMoveGenerator, IExhaustiveMoveGenerator {
     31    [StorableConstructor]
     32    private ExhaustiveOneBitflipMoveGenerator(bool deserializing) : base(deserializing) { }
     33    private ExhaustiveOneBitflipMoveGenerator(ExhaustiveOneBitflipMoveGenerator original, Cloner cloner) : base(original, cloner) { }
     34    public ExhaustiveOneBitflipMoveGenerator() : base() { }
     35
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new ExhaustiveOneBitflipMoveGenerator(this, cloner);
     38    }
     39
    3040    public static OneBitflipMove[] Apply(BinaryVector binaryVector) {
    3141      int length = binaryVector.Length;
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/OneBitflipMove.cs

    r4068 r4663  
    2222using HeuristicLab.Core;
    2323using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     24using HeuristicLab.Common;
    2425
    2526namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    2728  [StorableClass]
    2829  public class OneBitflipMove : OneIndexMove {
    29     public OneBitflipMove()
    30       : base() {
    31     }
     30    [StorableConstructor]
     31    protected OneBitflipMove(bool deserializing) : base(deserializing) { }
     32    protected OneBitflipMove(OneBitflipMove original, Cloner cloner) : base(original, cloner) { }
     33    public OneBitflipMove() : base() { }
     34    public OneBitflipMove(int index) : this(index, null) { }
     35    public OneBitflipMove(int index, BinaryVector binaryVector) : base(index, binaryVector) { }
    3236
    33     public OneBitflipMove(int index)
    34       : base(index, null) {
    35     }
    36 
    37     public OneBitflipMove(int index, BinaryVector binaryVector)
    38       : base(index, binaryVector) {
     37    public override IDeepCloneable Clone(Cloner cloner) {
     38      return new OneBitflipMove(this, cloner);
    3939    }
    4040  }
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/OneBitflipMoveAttribute.cs

    r3376 r4663  
    2525
    2626namespace HeuristicLab.Encodings.BinaryVectorEncoding {
    27   [Item("OneBitflipMoveAttribute", "Base class for specifying a move attribute.")]
     27  [Item("OneBitflipMoveAttribute", "Describes the attributes (move quality and index) of a single bitflip move.")]
    2828  [StorableClass]
    2929  public class OneBitflipMoveAttribute : Item {
     
    3333    public int Index { get; protected set; }
    3434
    35     public OneBitflipMoveAttribute()
    36       : this(-1, 0) {
     35    [StorableConstructor]
     36    protected OneBitflipMoveAttribute(bool deserializing) : base(deserializing) { }
     37    protected OneBitflipMoveAttribute(OneBitflipMoveAttribute original, Cloner cloner)
     38      : base(original, cloner) {
     39      this.MoveQuality = original.MoveQuality;
     40      this.Index = original.Index;
    3741    }
    38 
     42    public OneBitflipMoveAttribute() : this(-1, 0) { }
    3943    public OneBitflipMoveAttribute(int index, double moveQuality)
    4044      : base() {
     
    4448
    4549    public override IDeepCloneable Clone(Cloner cloner) {
    46       OneBitflipMoveAttribute clone = (OneBitflipMoveAttribute)base.Clone(cloner);
    47       clone.MoveQuality = MoveQuality;
    48       clone.Index = Index;
    49       return clone;
     50      return new OneBitflipMoveAttribute(this, cloner);
    5051    }
    5152  }
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/OneBitflipMoveGenerator.cs

    r4068 r4663  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    4344    }
    4445
     46    [StorableConstructor]
     47    protected OneBitflipMoveGenerator(bool deserializing) : base(deserializing) { }
     48    protected OneBitflipMoveGenerator(OneBitflipMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    4549    public OneBitflipMoveGenerator()
    4650      : base() {
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/OneBitflipMoveMaker.cs

    r4068 r4663  
    2626using HeuristicLab.Parameters;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    4748    }
    4849
     50    [StorableConstructor]
     51    protected OneBitflipMoveMaker(bool deserializing) : base(deserializing) { }
     52    protected OneBitflipMoveMaker(OneBitflipMoveMaker original, Cloner cloner) : base(original, cloner) { }
    4953    public OneBitflipMoveMaker()
    5054      : base() {
     
    5357      Parameters.Add(new LookupParameter<OneBitflipMove>("OneBitflipMove", "The move to evaluate."));
    5458      Parameters.Add(new LookupParameter<BinaryVector>("BinaryVector", "The solution as BinaryVector."));
     59    }
     60
     61    public override IDeepCloneable Clone(Cloner cloner) {
     62      return new OneBitflipMoveMaker(this, cloner);
    5563    }
    5664
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/OneBitflipMoveTabuChecker.cs

    r4068 r4663  
    2626using HeuristicLab.Parameters;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    6162    }
    6263
     64    [StorableConstructor]
     65    protected OneBitflipMoveTabuChecker(bool deserializing) : base(deserializing) { }
     66    protected OneBitflipMoveTabuChecker(OneBitflipMoveTabuChecker original, Cloner cloner) : base(original, cloner) { }
    6367    public OneBitflipMoveTabuChecker()
    6468      : base() {
     
    7074      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, else if it is a minimization problem."));
    7175      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The quality of the current move."));
     76    }
     77
     78    public override IDeepCloneable Clone(Cloner cloner) {
     79      return new OneBitflipMoveTabuChecker(this, cloner);
    7280    }
    7381
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/OneBitflipMoveTabuMaker.cs

    r4068 r4663  
    2424using HeuristicLab.Parameters;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HeuristicLab.Common;
    2627
    2728namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    3637    }
    3738
     39    [StorableConstructor]
     40    protected OneBitflipMoveTabuMaker(bool deserializing) : base(deserializing) { }
     41    protected OneBitflipMoveTabuMaker(OneBitflipMoveTabuMaker original, Cloner cloner) : base(original, cloner) { }
    3842    public OneBitflipMoveTabuMaker()
    3943      : base() {
    4044      Parameters.Add(new LookupParameter<BinaryVector>("BinaryVector", "The solution as BinaryVector."));
    4145      Parameters.Add(new LookupParameter<OneBitflipMove>("OneBitflipMove", "The move that was made."));
     46    }
     47
     48    public override IDeepCloneable Clone(Cloner cloner) {
     49      return new OneBitflipMoveTabuMaker(this, cloner);
    4250    }
    4351
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/StochasticOneBitflipMultiMoveGenerator.cs

    r4068 r4663  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    4243    }
    4344
     45    [StorableConstructor]
     46    protected StochasticOneBitflipMultiMoveGenerator(bool deserializing) : base(deserializing) { }
     47    protected StochasticOneBitflipMultiMoveGenerator(StochasticOneBitflipMultiMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    4448    public StochasticOneBitflipMultiMoveGenerator()
    4549      : base() {
    4650      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
    4751      Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to generate."));
     52    }
     53
     54    public override IDeepCloneable Clone(Cloner cloner) {
     55      return new StochasticOneBitflipMultiMoveGenerator(this, cloner);
    4856    }
    4957
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/StochasticOneBitflipSingleMoveGenerator.cs

    r4068 r4663  
    2424using HeuristicLab.Parameters;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HeuristicLab.Common;
    2627
    2728namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    3334    }
    3435
     36    [StorableConstructor]
     37    protected StochasticOneBitflipSingleMoveGenerator(bool deserializing) : base(deserializing) { }
     38    protected StochasticOneBitflipSingleMoveGenerator(StochasticOneBitflipSingleMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    3539    public StochasticOneBitflipSingleMoveGenerator()
    3640      : base() {
    3741      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     42    }
     43
     44    public override IDeepCloneable Clone(Cloner cloner) {
     45      return new StochasticOneBitflipSingleMoveGenerator(this, cloner);
    3846    }
    3947
  • branches/CloningRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneIndexMove.cs

    r3376 r4663  
    3333    public BinaryVector BinaryVector { get; protected set; }
    3434
    35     public OneIndexMove()
    36       : base() {
    37       Index = -1;
    38       BinaryVector = null;
     35    [StorableConstructor]
     36    protected OneIndexMove(bool deserializing) : base(deserializing) { }
     37    protected OneIndexMove(OneIndexMove original, Cloner cloner)
     38      : base(original, cloner) {
     39      this.Index = original.Index;
     40      if (original.BinaryVector != null)
     41        this.BinaryVector = cloner.Clone(original.BinaryVector);
    3942    }
    40 
     43    public OneIndexMove() : this(-1, null) { }
    4144    public OneIndexMove(int index, BinaryVector binaryVector)
    4245      : base() {
     
    4649
    4750    public override IDeepCloneable Clone(Cloner cloner) {
    48       OneIndexMove clone = (OneIndexMove)base.Clone(cloner);
    49       clone.Index = Index;
    50       if (BinaryVector != null)
    51         clone.BinaryVector = (BinaryVector)BinaryVector.Clone(cloner);
    52       return clone;
     51      return new OneIndexMove(this, cloner);
    5352    }
    5453  }
Note: See TracChangeset for help on using the changeset viewer.