Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4664


Ignore:
Timestamp:
10/29/10 16:50:38 (14 years ago)
Author:
abeham
Message:

#922

  • Refactored HeuristicLab.Encodings.IntegerVectorEncoding
Location:
branches/CloningRefactoring/HeuristicLab.Encodings.IntegerVectorEncoding/3.3
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Creators/UniformRandomIntegerVectorCreator.cs

    r4068 r4664  
    2323using HeuristicLab.Data;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Common;
    2526
    2627namespace HeuristicLab.Encodings.IntegerVectorEncoding {
     
    3132  [StorableClass]
    3233  public class UniformRandomIntegerVectorCreator : IntegerVectorCreator {
     34    [StorableConstructor]
     35    protected UniformRandomIntegerVectorCreator(bool deserializing) : base(deserializing) { }
     36    protected UniformRandomIntegerVectorCreator(UniformRandomIntegerVectorCreator original, Cloner cloner) : base(original, cloner) { }
     37    public UniformRandomIntegerVectorCreator() : base() { }
     38
     39    public override IDeepCloneable Clone(Cloner cloner) {
     40      return new UniformRandomIntegerVectorCreator(this, cloner);
     41    }
     42
    3343    /// <summary>
    3444    /// Generates a new random integer vector with the given <paramref name="length"/>.
  • branches/CloningRefactoring/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/DiscreteCrossover.cs

    r4068 r4664  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Common;
    2526
    2627namespace HeuristicLab.Encodings.IntegerVectorEncoding {
     
    3435  [StorableClass]
    3536  public class DiscreteCrossover : IntegerVectorCrossover {
     37    [StorableConstructor]
     38    protected DiscreteCrossover(bool deserializing) : base(deserializing) { }
     39    protected DiscreteCrossover(DiscreteCrossover original, Cloner cloner) : base(original, cloner) { }
     40    public DiscreteCrossover() : base() { }
     41
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new DiscreteCrossover(this, cloner);
     44    }
     45
    3646    /// <summary>
    3747    /// Performs a discrete crossover operation of the two given parents.
  • branches/CloningRefactoring/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/MultiIntegerVectorCrossover.cs

    r3674 r4664  
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3030using HeuristicLab.PluginInfrastructure;
     31using HeuristicLab.Common;
    3132
    3233namespace HeuristicLab.Encodings.IntegerVectorEncoding {
     
    5051
    5152    [StorableConstructor]
    52     private MultiIntegerVectorCrossover(bool deserializing) : base(deserializing) { }
     53    protected MultiIntegerVectorCrossover(bool deserializing) : base(deserializing) { }
     54    protected MultiIntegerVectorCrossover(MultiIntegerVectorCrossover original, Cloner cloner) : base(original, cloner) { }
    5355    public MultiIntegerVectorCrossover()
    5456      : base() {
     
    6264          Operators.Add((IIntegerVectorCrossover)Activator.CreateInstance(type), true);
    6365      }
     66    }
     67
     68    public override IDeepCloneable Clone(Cloner cloner) {
     69      return new MultiIntegerVectorCrossover(this, cloner);
    6470    }
    6571
  • branches/CloningRefactoring/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs

    r4068 r4664  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Common;
    2526
    2627namespace HeuristicLab.Encodings.IntegerVectorEncoding {
     
    3435  [StorableClass]
    3536  public class SinglePointCrossover : IntegerVectorCrossover {
     37    [StorableConstructor]
     38    protected SinglePointCrossover(bool deserializing) : base(deserializing) { }
     39    protected SinglePointCrossover(SinglePointCrossover original, Cloner cloner) : base(original, cloner) { }
     40    public SinglePointCrossover() : base() { }
     41
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new SinglePointCrossover(this, cloner);
     44    }
     45
    3646    /// <summary>
    3747    /// Performs a single point crossover at a randomly chosen position of the two
  • branches/CloningRefactoring/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVector.cs

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

    r4068 r4664  
    2626using HeuristicLab.Parameters;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HeuristicLab.Common;
    2829
    2930namespace HeuristicLab.Encodings.IntegerVectorEncoding {
     
    5354    }
    5455
     56    [StorableConstructor]
     57    protected IntegerVectorCreator(bool deserializing) : base(deserializing) { }
     58    protected IntegerVectorCreator(IntegerVectorCreator original, Cloner cloner) : base(original, cloner) { }
    5559    protected IntegerVectorCreator()
    5660      : base() {
  • branches/CloningRefactoring/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorCrossover.cs

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

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

    r4068 r4664  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Encodings.IntegerVectorEncoding {
     
    4950    }
    5051
     52    [StorableConstructor]
     53    protected UniformOnePositionManipulator(bool deserializing) : base(deserializing) { }
     54    protected UniformOnePositionManipulator(UniformOnePositionManipulator original, Cloner cloner) : base(original, cloner) { }
    5155    /// <summary>
    5256    /// Initializes a new instance of <see cref="UniformOnePositionManipulator"/> with two parameters
    5357    /// (<c>Minimum</c> and <c>Maximum</c>).
    5458    /// </summary>
    55     public UniformOnePositionManipulator() {
     59    public UniformOnePositionManipulator()
     60      : base() {
    5661      Parameters.Add(new ValueLookupParameter<IntValue>("Minimum", "Minimum of the sampling range for the vector element (included)"));
    5762      Parameters.Add(new ValueLookupParameter<IntValue>("Maximum", "Maximum of the sampling range for the vector element (excluded)"));
     63    }
     64
     65    public override IDeepCloneable Clone(Cloner cloner) {
     66      return new UniformOnePositionManipulator(this, cloner);
    5867    }
    5968
Note: See TracChangeset for help on using the changeset viewer.