Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/15 14:54:28 (10 years ago)
Author:
ascheibe
Message:

#2306 made comparers and initializers consistent

Location:
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/EqualWeightsInitializer.cs

    r12569 r12582  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626
    27 namespace HeuristicLab.Problems.NK.WeightInitializers {
    28 
     27namespace HeuristicLab.Problems.NK {
    2928  [Item("EqualWeightsInitializer", "Initializes all weights to 1.0.")]
    3029  [StorableClass]
    31   public class EqualWeightsInitializer : NamedItem, IWeightsInitializer {
    32 
    33     public override bool CanChangeName { get { return false; } }
    34     public override bool CanChangeDescription { get { return false; } }
    35 
     30  public sealed class EqualWeightsInitializer : Item, IWeightsInitializer {
    3631    [StorableConstructor]
    37     protected EqualWeightsInitializer(bool deserializing) : base(deserializing) { }
    38     protected EqualWeightsInitializer(EqualWeightsInitializer original, Cloner cloner)
    39       : base(original, cloner) {
    40     }
    41     public EqualWeightsInitializer() {
    42       name = ItemName;
    43       description = ItemDescription;
    44     }
     32    private EqualWeightsInitializer(bool deserializing) : base(deserializing) { }
     33    private EqualWeightsInitializer(EqualWeightsInitializer original, Cloner cloner)
     34      : base(original, cloner) { }
     35    public EqualWeightsInitializer() { }
    4536    public override IDeepCloneable Clone(Cloner cloner) {
    4637      return new EqualWeightsInitializer(this, cloner);
    4738    }
    4839
    49     #region IWeightsInitializer Members
    50 
    5140    public IEnumerable<double> GetWeights(int nComponents) {
    5241      return new[] { 1.0 };
    5342    }
    54 
    55     #endregion
    5643  }
    57 
    5844}
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/ExponentialDistributionWeightsInitializer.cs

    r12569 r12582  
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2929
    30 namespace HeuristicLab.Problems.NK.WeightInitializers {
    31 
     30namespace HeuristicLab.Problems.NK {
    3231  [Item("ExponentialDistributionWeightsInitializer", "Assigns exponentially decreasing weights using the rate parameter lambda.")]
    3332  [StorableClass]
    34   public class ExponentialDistributionWeightsInitializer : ParameterizedNamedItem, IWeightsInitializer {
    35 
    36     public override bool CanChangeName { get { return false; } }
    37     public override bool CanChangeDescription { get { return false; } }
     33  public sealed class ExponentialDistributionWeightsInitializer : ParameterizedNamedItem, IWeightsInitializer {
    3834    public IValueParameter<DoubleValue> LambdaParameter {
    3935      get { return (IValueParameter<DoubleValue>)Parameters["Lambda"]; }
     
    4137
    4238    [StorableConstructor]
    43     protected ExponentialDistributionWeightsInitializer(bool deserializing) : base(deserializing) { }
    44     protected ExponentialDistributionWeightsInitializer(ExponentialDistributionWeightsInitializer original, Cloner cloner)
     39    private ExponentialDistributionWeightsInitializer(bool deserializing) : base(deserializing) { }
     40    private ExponentialDistributionWeightsInitializer(ExponentialDistributionWeightsInitializer original, Cloner cloner)
    4541      : base(original, cloner) {
    4642    }
     
    5248    }
    5349
    54     public static double f(double x, double lambda) {
     50    private static double f(double x, double lambda) {
    5551      if (x < 0.0)
    5652        return 0.0;
     
    5854    }
    5955
    60     #region IWeightsInitializer Members
    6156    public IEnumerable<double> GetWeights(int nComponents) {
    6257      double lambda = LambdaParameter.Value.Value;
     
    6459        yield return f(i, lambda);
    6560    }
    66     #endregion
    6761  }
    68 
    6962}
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/ExponentialWeightsInitializer.cs

    r12569 r12582  
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2727
    28 namespace HeuristicLab.Problems.NK.WeightInitializers {
    29 
     28namespace HeuristicLab.Problems.NK {
    3029  [Item("ExponentialWeightsInitializer", "Assigns exponentially increasing weights.")]
    3130  [StorableClass]
    32   public class ExponentialWeightsInitializer : NamedItem, IWeightsInitializer {
    33 
    34     public override bool CanChangeName { get { return false; } }
    35     public override bool CanChangeDescription { get { return false; } }
    36 
     31  public sealed class ExponentialWeightsInitializer : Item, IWeightsInitializer {
    3732    [StorableConstructor]
    38     protected ExponentialWeightsInitializer(bool deserializing) : base(deserializing) { }
    39     protected ExponentialWeightsInitializer(ExponentialWeightsInitializer original, Cloner cloner)
     33    private ExponentialWeightsInitializer(bool deserializing) : base(deserializing) { }
     34    private ExponentialWeightsInitializer(ExponentialWeightsInitializer original, Cloner cloner)
    4035      : base(original, cloner) {
    4136    }
    42     public ExponentialWeightsInitializer() {
    43       name = ItemName;
    44       description = ItemDescription;
    45     }
     37    public ExponentialWeightsInitializer() { }
    4638    public override IDeepCloneable Clone(Cloner cloner) {
    4739      return new ExponentialWeightsInitializer(this, cloner);
    4840    }
    49 
    50     #region IWeightsInitializer Members
    5141
    5242    public IEnumerable<double> GetWeights(int nComponents) {
     
    5444        yield return Math.Pow(2, i);
    5545    }
    56 
    57     #endregion
    5846  }
    59 
    6047}
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/IWeightsInitializer.cs

    r12569 r12582  
    2424
    2525namespace HeuristicLab.Problems.NK {
    26   public interface IWeightsInitializer : INamedItem {
     26  public interface IWeightsInitializer : IItem {
    2727    IEnumerable<double> GetWeights(int nComponents);
    2828  }
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/LinearWeightsInitializer.cs

    r12569 r12582  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626
    27 namespace HeuristicLab.Problems.NK.WeightInitializers {
    28 
     27namespace HeuristicLab.Problems.NK {
    2928  [Item("LinearWeightsInitializer", "Assigns linear increasing weights.")]
    3029  [StorableClass]
    31   public class LinearWeightsInitializer : NamedItem, IWeightsInitializer {
    32 
    33     public override bool CanChangeName { get { return false; } }
    34     public override bool CanChangeDescription { get { return false; } }
    35 
     30  public sealed class LinearWeightsInitializer : Item, IWeightsInitializer {
    3631    [StorableConstructor]
    37     protected LinearWeightsInitializer(bool deserializing) : base(deserializing) { }
    38     protected LinearWeightsInitializer(LinearWeightsInitializer original, Cloner cloner)
     32    private LinearWeightsInitializer(bool deserializing) : base(deserializing) { }
     33    private LinearWeightsInitializer(LinearWeightsInitializer original, Cloner cloner)
    3934      : base(original, cloner) {
    4035    }
    41     public LinearWeightsInitializer() {
    42       name = ItemName;
    43       description = ItemDescription;
    44     }
     36    public LinearWeightsInitializer() { }
    4537    public override IDeepCloneable Clone(Cloner cloner) {
    4638      return new LinearWeightsInitializer(this, cloner);
    4739    }
    48 
    49     #region IWeightsInitializer Members
    5040
    5141    public IEnumerable<double> GetWeights(int nComponents) {
     
    5343        yield return i;
    5444    }
    55 
    56     #endregion
    5745  }
    58 
    5946}
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/ReverseExponentialWeightsInitializer.cs

    r12569 r12582  
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2727
    28 namespace HeuristicLab.Problems.NK.WeightInitializers {
    29 
     28namespace HeuristicLab.Problems.NK {
    3029  [Item("ReverseExponentialWeightsInitializer", "Assigns exponentially decreasing weights.")]
    3130  [StorableClass]
    32   public class ReverseExponentialWeightsInitializer : NamedItem, IWeightsInitializer {
    33 
    34     public override bool CanChangeName { get { return false; } }
    35     public override bool CanChangeDescription { get { return false; } }
    36 
     31  public sealed class ReverseExponentialWeightsInitializer : Item, IWeightsInitializer {
    3732    [StorableConstructor]
    38     protected ReverseExponentialWeightsInitializer(bool deserializing) : base(deserializing) { }
    39     protected ReverseExponentialWeightsInitializer(ReverseExponentialWeightsInitializer original, Cloner cloner)
     33    private ReverseExponentialWeightsInitializer(bool deserializing) : base(deserializing) { }
     34    private ReverseExponentialWeightsInitializer(ReverseExponentialWeightsInitializer original, Cloner cloner)
    4035      : base(original, cloner) {
    4136    }
    42     public ReverseExponentialWeightsInitializer() {
    43       name = ItemName;
    44       description = ItemDescription;
    45     }
     37    public ReverseExponentialWeightsInitializer() { }
    4638    public override IDeepCloneable Clone(Cloner cloner) {
    4739      return new ReverseExponentialWeightsInitializer(this, cloner);
    4840    }
    49 
    50     #region IWeightsInitializer Members
    5141
    5242    public IEnumerable<double> GetWeights(int nComponents) {
     
    5444        yield return Math.Pow(2, i);
    5545    }
    56 
    57     #endregion
    5846  }
    59 
    6047}
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/ReverseLinearWeightsInitializer.cs

    r12569 r12582  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626
    27 namespace HeuristicLab.Problems.NK.WeightInitializers {
    28 
     27namespace HeuristicLab.Problems.NK {
    2928  [Item("ReverseLinearWeightsInitializer", "Assigns exponentially decreasing weights.")]
    3029  [StorableClass]
    31   public class ReverseLinearWeightsInitializer : NamedItem, IWeightsInitializer {
    32 
    33     public override bool CanChangeName { get { return false; } }
    34     public override bool CanChangeDescription { get { return false; } }
    35 
     30  public sealed class ReverseLinearWeightsInitializer : Item, IWeightsInitializer {
    3631    [StorableConstructor]
    37     protected ReverseLinearWeightsInitializer(bool deserializing) : base(deserializing) { }
    38     protected ReverseLinearWeightsInitializer(ReverseLinearWeightsInitializer original, Cloner cloner)
     32    private ReverseLinearWeightsInitializer(bool deserializing) : base(deserializing) { }
     33    private ReverseLinearWeightsInitializer(ReverseLinearWeightsInitializer original, Cloner cloner)
    3934      : base(original, cloner) {
    4035    }
    41     public ReverseLinearWeightsInitializer() {
    42       name = ItemName;
    43       description = ItemDescription;
    44     }
     36    public ReverseLinearWeightsInitializer() { }
    4537    public override IDeepCloneable Clone(Cloner cloner) {
    4638      return new ReverseLinearWeightsInitializer(this, cloner);
    4739    }
    48 
    49     #region IWeightsInitializer Members
    5040
    5141    public IEnumerable<double> GetWeights(int nComponents) {
     
    5343        yield return i;
    5444    }
    55 
    56     #endregion
    5745  }
    58 
    5946}
Note: See TracChangeset for help on using the changeset viewer.