- Timestamp:
- 07/03/15 14:54:28 (10 years ago)
- Location:
- branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/EqualWeightsInitializer.cs
r12569 r12582 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 27 namespace HeuristicLab.Problems.NK.WeightInitializers { 28 27 namespace HeuristicLab.Problems.NK { 29 28 [Item("EqualWeightsInitializer", "Initializes all weights to 1.0.")] 30 29 [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 { 36 31 [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() { } 45 36 public override IDeepCloneable Clone(Cloner cloner) { 46 37 return new EqualWeightsInitializer(this, cloner); 47 38 } 48 39 49 #region IWeightsInitializer Members50 51 40 public IEnumerable<double> GetWeights(int nComponents) { 52 41 return new[] { 1.0 }; 53 42 } 54 55 #endregion56 43 } 57 58 44 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/ExponentialDistributionWeightsInitializer.cs
r12569 r12582 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 29 30 namespace HeuristicLab.Problems.NK.WeightInitializers { 31 30 namespace HeuristicLab.Problems.NK { 32 31 [Item("ExponentialDistributionWeightsInitializer", "Assigns exponentially decreasing weights using the rate parameter lambda.")] 33 32 [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 { 38 34 public IValueParameter<DoubleValue> LambdaParameter { 39 35 get { return (IValueParameter<DoubleValue>)Parameters["Lambda"]; } … … 41 37 42 38 [StorableConstructor] 43 pr otectedExponentialDistributionWeightsInitializer(bool deserializing) : base(deserializing) { }44 pr otectedExponentialDistributionWeightsInitializer(ExponentialDistributionWeightsInitializer original, Cloner cloner)39 private ExponentialDistributionWeightsInitializer(bool deserializing) : base(deserializing) { } 40 private ExponentialDistributionWeightsInitializer(ExponentialDistributionWeightsInitializer original, Cloner cloner) 45 41 : base(original, cloner) { 46 42 } … … 52 48 } 53 49 54 p ublicstatic double f(double x, double lambda) {50 private static double f(double x, double lambda) { 55 51 if (x < 0.0) 56 52 return 0.0; … … 58 54 } 59 55 60 #region IWeightsInitializer Members61 56 public IEnumerable<double> GetWeights(int nComponents) { 62 57 double lambda = LambdaParameter.Value.Value; … … 64 59 yield return f(i, lambda); 65 60 } 66 #endregion67 61 } 68 69 62 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/ExponentialWeightsInitializer.cs
r12569 r12582 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 28 namespace HeuristicLab.Problems.NK.WeightInitializers { 29 28 namespace HeuristicLab.Problems.NK { 30 29 [Item("ExponentialWeightsInitializer", "Assigns exponentially increasing weights.")] 31 30 [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 { 37 32 [StorableConstructor] 38 pr otectedExponentialWeightsInitializer(bool deserializing) : base(deserializing) { }39 pr otectedExponentialWeightsInitializer(ExponentialWeightsInitializer original, Cloner cloner)33 private ExponentialWeightsInitializer(bool deserializing) : base(deserializing) { } 34 private ExponentialWeightsInitializer(ExponentialWeightsInitializer original, Cloner cloner) 40 35 : base(original, cloner) { 41 36 } 42 public ExponentialWeightsInitializer() { 43 name = ItemName; 44 description = ItemDescription; 45 } 37 public ExponentialWeightsInitializer() { } 46 38 public override IDeepCloneable Clone(Cloner cloner) { 47 39 return new ExponentialWeightsInitializer(this, cloner); 48 40 } 49 50 #region IWeightsInitializer Members51 41 52 42 public IEnumerable<double> GetWeights(int nComponents) { … … 54 44 yield return Math.Pow(2, i); 55 45 } 56 57 #endregion58 46 } 59 60 47 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/IWeightsInitializer.cs
r12569 r12582 24 24 25 25 namespace HeuristicLab.Problems.NK { 26 public interface IWeightsInitializer : I NamedItem {26 public interface IWeightsInitializer : IItem { 27 27 IEnumerable<double> GetWeights(int nComponents); 28 28 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/LinearWeightsInitializer.cs
r12569 r12582 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 27 namespace HeuristicLab.Problems.NK.WeightInitializers { 28 27 namespace HeuristicLab.Problems.NK { 29 28 [Item("LinearWeightsInitializer", "Assigns linear increasing weights.")] 30 29 [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 { 36 31 [StorableConstructor] 37 pr otectedLinearWeightsInitializer(bool deserializing) : base(deserializing) { }38 pr otectedLinearWeightsInitializer(LinearWeightsInitializer original, Cloner cloner)32 private LinearWeightsInitializer(bool deserializing) : base(deserializing) { } 33 private LinearWeightsInitializer(LinearWeightsInitializer original, Cloner cloner) 39 34 : base(original, cloner) { 40 35 } 41 public LinearWeightsInitializer() { 42 name = ItemName; 43 description = ItemDescription; 44 } 36 public LinearWeightsInitializer() { } 45 37 public override IDeepCloneable Clone(Cloner cloner) { 46 38 return new LinearWeightsInitializer(this, cloner); 47 39 } 48 49 #region IWeightsInitializer Members50 40 51 41 public IEnumerable<double> GetWeights(int nComponents) { … … 53 43 yield return i; 54 44 } 55 56 #endregion57 45 } 58 59 46 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/ReverseExponentialWeightsInitializer.cs
r12569 r12582 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 28 namespace HeuristicLab.Problems.NK.WeightInitializers { 29 28 namespace HeuristicLab.Problems.NK { 30 29 [Item("ReverseExponentialWeightsInitializer", "Assigns exponentially decreasing weights.")] 31 30 [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 { 37 32 [StorableConstructor] 38 pr otectedReverseExponentialWeightsInitializer(bool deserializing) : base(deserializing) { }39 pr otectedReverseExponentialWeightsInitializer(ReverseExponentialWeightsInitializer original, Cloner cloner)33 private ReverseExponentialWeightsInitializer(bool deserializing) : base(deserializing) { } 34 private ReverseExponentialWeightsInitializer(ReverseExponentialWeightsInitializer original, Cloner cloner) 40 35 : base(original, cloner) { 41 36 } 42 public ReverseExponentialWeightsInitializer() { 43 name = ItemName; 44 description = ItemDescription; 45 } 37 public ReverseExponentialWeightsInitializer() { } 46 38 public override IDeepCloneable Clone(Cloner cloner) { 47 39 return new ReverseExponentialWeightsInitializer(this, cloner); 48 40 } 49 50 #region IWeightsInitializer Members51 41 52 42 public IEnumerable<double> GetWeights(int nComponents) { … … 54 44 yield return Math.Pow(2, i); 55 45 } 56 57 #endregion58 46 } 59 60 47 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/WeightInitializers/ReverseLinearWeightsInitializer.cs
r12569 r12582 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 27 namespace HeuristicLab.Problems.NK.WeightInitializers { 28 27 namespace HeuristicLab.Problems.NK { 29 28 [Item("ReverseLinearWeightsInitializer", "Assigns exponentially decreasing weights.")] 30 29 [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 { 36 31 [StorableConstructor] 37 pr otectedReverseLinearWeightsInitializer(bool deserializing) : base(deserializing) { }38 pr otectedReverseLinearWeightsInitializer(ReverseLinearWeightsInitializer original, Cloner cloner)32 private ReverseLinearWeightsInitializer(bool deserializing) : base(deserializing) { } 33 private ReverseLinearWeightsInitializer(ReverseLinearWeightsInitializer original, Cloner cloner) 39 34 : base(original, cloner) { 40 35 } 41 public ReverseLinearWeightsInitializer() { 42 name = ItemName; 43 description = ItemDescription; 44 } 36 public ReverseLinearWeightsInitializer() { } 45 37 public override IDeepCloneable Clone(Cloner cloner) { 46 38 return new ReverseLinearWeightsInitializer(this, cloner); 47 39 } 48 49 #region IWeightsInitializer Members50 40 51 41 public IEnumerable<double> GetWeights(int nComponents) { … … 53 43 yield return i; 54 44 } 55 56 #endregion57 45 } 58 59 46 }
Note: See TracChangeset
for help on using the changeset viewer.