Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/29/10 18:28:48 (14 years ago)
Author:
abeham
Message:

#922

  • Refactored HeuristicLab.Encodings.RealVectorEncoding
Location:
branches/CloningRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/AverageCrossover.cs

    r4068 r4672  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Common;
    2526
    2627namespace HeuristicLab.Encodings.RealVectorEncoding {
     
    3435  [StorableClass]
    3536  public class AverageCrossover : RealVectorCrossover {
     37    [StorableConstructor]
     38    protected AverageCrossover(bool deserializing) : base(deserializing) { }
     39    protected AverageCrossover(AverageCrossover original, Cloner cloner) : base(original, cloner) { }
     40    public AverageCrossover() : base() { }
     41
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new AverageCrossover(this, cloner);
     44    }
     45   
    3646    /// <summary>
    3747    /// Performs the average crossover (intermediate recombination) on a list of parents.
  • branches/CloningRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/BlendAlphaBetaCrossover.cs

    r4068 r4672  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Encodings.RealVectorEncoding {
     
    6566    }
    6667
     68    [StorableConstructor]
     69    protected BlendAlphaBetaCrossover(bool deserializing) : base(deserializing) { }
     70    protected BlendAlphaBetaCrossover(BlendAlphaBetaCrossover original, Cloner cloner) : base(original, cloner) { }
    6771    /// <summary>
    6872    /// Initializes a new instance of <see cref="BlendAlphaBetaCrossover"/> with four additional parameters
     
    7579      Parameters.Add(new ValueLookupParameter<DoubleValue>("Alpha", "The Alpha parameter controls the extension of the range beyond the better parent. The value must be >= 0 and does not depend on Beta.", new DoubleValue(0.75)));
    7680      Parameters.Add(new ValueLookupParameter<DoubleValue>("Beta", "The Beta parameter controls the extension of the range beyond the worse parent. The value must be >= 0 and does not depend on Alpha.", new DoubleValue(0.25)));
     81    }
     82
     83    public override IDeepCloneable Clone(Cloner cloner) {
     84      return new BlendAlphaBetaCrossover(this, cloner);
    7785    }
    7886
  • branches/CloningRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/BlendAlphaCrossover.cs

    r4068 r4672  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Encodings.RealVectorEncoding {
     
    4849      get { return (ValueLookupParameter<DoubleValue>)Parameters["Alpha"]; }
    4950    }
     51
     52    [StorableConstructor]
     53    protected BlendAlphaCrossover(bool deserializing) : base(deserializing) { }
     54    protected BlendAlphaCrossover(BlendAlphaCrossover original, Cloner cloner) : base(original, cloner) { }
    5055    /// <summary>
    5156    /// Initializes a new instance of <see cref="BlendAlphaCrossover"/> with one parameter (<c>Alpha</c>).
     
    5459      : base() {
    5560      Parameters.Add(new ValueLookupParameter<DoubleValue>("Alpha", "The Alpha parameter controls the extension of the range beyond the two parents. It must be >= 0. A value of 0.5 means that half the range is added to both sides of the intervals.", new DoubleValue(0.5)));
     61    }
     62
     63    public override IDeepCloneable Clone(Cloner cloner) {
     64      return new BlendAlphaCrossover(this, cloner);
    5665    }
    5766
  • branches/CloningRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/DiscreteCrossover.cs

    r4068 r4672  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Common;
    2526
    2627namespace HeuristicLab.Encodings.RealVectorEncoding {
     
    3637  [StorableClass]
    3738  public class DiscreteCrossover : RealVectorCrossover {
     39    [StorableConstructor]
     40    protected DiscreteCrossover(bool deserializing) : base(deserializing) { }
     41    protected DiscreteCrossover(DiscreteCrossover original, Cloner cloner) : base(original, cloner) { }
     42    public DiscreteCrossover() : base() { }
     43
     44    public override IDeepCloneable Clone(Cloner cloner) {
     45      return new DiscreteCrossover(this, cloner);
     46    }
     47   
    3848    /// <summary>
    3949    /// Performs a discrete crossover operation on multiple parents.
  • branches/CloningRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/HeuristicCrossover.cs

    r4068 r4672  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Encodings.RealVectorEncoding {
     
    5051    }
    5152
     53    [StorableConstructor]
     54    protected HeuristicCrossover(bool deserializing) : base(deserializing) { }
     55    protected HeuristicCrossover(HeuristicCrossover original, Cloner cloner) : base(original, cloner) { }
    5256    /// <summary>
    5357    /// Initializes a new instance of <see cref="HeuristicCrossover"/> with two variable infos
     
    5862      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "Whether the problem is a maximization problem or not."));
    5963      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality values of the parents."));
     64    }
     65
     66    public override IDeepCloneable Clone(Cloner cloner) {
     67      return new HeuristicCrossover(this, cloner);
    6068    }
    6169
  • branches/CloningRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/LocalCrossover.cs

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

    r3674 r4672  
    3030using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3131using HeuristicLab.PluginInfrastructure;
     32using HeuristicLab.Common;
    3233
    3334namespace HeuristicLab.Encodings.RealVectorEncoding {
     
    5354
    5455    [StorableConstructor]
    55     private MultiRealVectorCrossover(bool deserializing) : base(deserializing) { }
     56    protected MultiRealVectorCrossover(bool deserializing) : base(deserializing) { }
     57    protected MultiRealVectorCrossover(MultiRealVectorCrossover original, Cloner cloner)
     58      : base(original, cloner) {
     59    }
    5660    public MultiRealVectorCrossover()
    5761      : base() {
     
    6670          Operators.Add((IRealVectorCrossover)Activator.CreateInstance(type), true);
    6771      }
     72    }
     73
     74    public override IDeepCloneable Clone(Cloner cloner) {
     75      return new MultiRealVectorCrossover(this, cloner);
    6876    }
    6977
  • branches/CloningRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/RandomConvexCrossover.cs

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

    r4068 r4672  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Encodings.RealVectorEncoding {
     
    4445    }
    4546
     47    [StorableConstructor]
     48    protected SimulatedBinaryCrossover(bool deserializing) : base(deserializing) { }
     49    protected SimulatedBinaryCrossover(SimulatedBinaryCrossover original, Cloner cloner) : base(original, cloner) { }
    4650    /// <summary>
    4751    /// Initializes a new instance of <see cref="SimulatedBinaryCrossover"/> with one
     
    5155      : base() {
    5256      Parameters.Add(new ValueLookupParameter<DoubleValue>("Contiguity", "Specifies whether the crossover should produce very different (small value) or very similar (large value) children. Valid values must be greater or equal to 0.", new DoubleValue(2)));
     57    }
     58
     59    public override IDeepCloneable Clone(Cloner cloner) {
     60      return new SimulatedBinaryCrossover(this, cloner);
    5361    }
    5462
  • branches/CloningRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs

    r4068 r4672  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Common;
    2526
    2627namespace HeuristicLab.Encodings.RealVectorEncoding {
     
    3637  [StorableClass]
    3738  public class SinglePointCrossover : RealVectorCrossover {
     39    [StorableConstructor]
     40    protected SinglePointCrossover(bool deserializing) : base(deserializing) { }
     41    protected 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   
    3848    /// <summary>
    3949    /// Performs the single point crossover for real vectors. The implementation is similar to the single point crossover for binary vectors.
  • branches/CloningRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/UniformAllPositionsArithmeticCrossover.cs

    r4068 r4672  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Encodings.RealVectorEncoding {
     
    4445    }
    4546
     47    [StorableConstructor]
     48    protected UniformAllPositionsArithmeticCrossover(bool deserializing) : base(deserializing) { }
     49    protected UniformAllPositionsArithmeticCrossover(UniformAllPositionsArithmeticCrossover original, Cloner cloner) : base(original, cloner) { }
    4650    /// <summary>
    4751    /// Initializes a new instance with one parameter (<c>Alpha</c>).
     
    5054      : base() {
    5155      Parameters.Add(new ValueLookupParameter<DoubleValue>("Alpha", "The alpha value in the range [0;1]", new DoubleValue(0.33)));
     56    }
     57
     58    public override IDeepCloneable Clone(Cloner cloner) {
     59      return new UniformAllPositionsArithmeticCrossover(this, cloner);
    5260    }
    5361
  • branches/CloningRefactoring/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/UniformSomePositionsArithmeticCrossover.cs

    r4068 r4672  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Encodings.RealVectorEncoding {
     
    5051    }
    5152
     53    [StorableConstructor]
     54    protected UniformSomePositionsArithmeticCrossover(bool deserializing) : base(deserializing) { }
     55    protected UniformSomePositionsArithmeticCrossover(UniformSomePositionsArithmeticCrossover original, Cloner cloner) : base(original, cloner) { }
    5256    /// <summary>
    5357    /// Initializes a new instance with two parameters (<c>Alpha</c> and <c>Probability</c>).
     
    5761      Parameters.Add(new ValueLookupParameter<DoubleValue>("Alpha", "The alpha value in the range [0;1] that defines whether the point should be close to parent1 (=1) or parent2 (=0)", new DoubleValue(0.5)));
    5862      Parameters.Add(new ValueLookupParameter<DoubleValue>("Probability", "The probability for crossing a position in the range [0;1]", new DoubleValue(0.5)));
     63    }
     64
     65    public override IDeepCloneable Clone(Cloner cloner) {
     66      return new UniformSomePositionsArithmeticCrossover(this, cloner);
    5967    }
    6068
Note: See TracChangeset for help on using the changeset viewer.