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

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/ExhaustiveOneBitflipMoveGenerator.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Optimization;
     
    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;
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/OneBitflipMove.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    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  }
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/OneBitflipMoveAttribute.cs

    r3376 r4722  
    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  }
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/OneBitflipMoveGenerator.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Operators;
     
    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() {
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/OneBitflipMoveMaker.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    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
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/OneBitflipMoveTabuChecker.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    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
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/OneBitflipMoveTabuMaker.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Optimization.Operators;
     
    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
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/StochasticOneBitflipMultiMoveGenerator.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    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
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Moves/OneBitflipMove/StochasticOneBitflipSingleMoveGenerator.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Optimization;
     
    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
Note: See TracChangeset for help on using the changeset viewer.