- Timestamp:
- 07/03/15 14:54:28 (9 years ago)
- Location:
- branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK
- Files:
-
- 1 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/BinaryVectorComparers/AverageBitBinaryVectorComparer.cs
r12566 r12582 27 27 28 28 namespace HeuristicLab.Problems.NK { 29 30 29 [Item("Average Bit Binary Vector Comparer", "Compares two binary vectors by their average positive bit location")] 31 30 [StorableClass] 32 public sealed class AverageBitBinaryVectorComparer : BinaryVectorComparer { 33 31 public sealed class AverageBitBinaryVectorComparer : Item, IBinaryVectorComparer { 34 32 [StorableConstructor] 35 33 private AverageBitBinaryVectorComparer(bool deserializing) : base(deserializing) { } 36 34 private AverageBitBinaryVectorComparer(AverageBitBinaryVectorComparer original, Cloner cloner) 37 : base(original, cloner) { 38 } 35 : base(original, cloner) { } 39 36 public AverageBitBinaryVectorComparer() { } 40 37 public override IDeepCloneable Clone(Cloner cloner) { … … 42 39 } 43 40 44 p ublicstatic double AverageBit(BinaryVector x) {41 private static double AverageBit(BinaryVector x) { 45 42 return x.Select((b, i) => new { b, i }).Where(v => v.b).Average(v => v.i); 46 43 } 47 44 48 public overrideint Compare(BinaryVector x, BinaryVector y) {45 public int Compare(BinaryVector x, BinaryVector y) { 49 46 return (AverageBit(x) - AverageBit(y)).CompareTo(0); 50 47 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/BinaryVectorComparers/IBinaryVectorComparer.cs
r12569 r12582 25 25 26 26 namespace HeuristicLab.Problems.NK { 27 public interface IBinaryVectorComparer : I NamedItem, IComparer<BinaryVector> { }27 public interface IBinaryVectorComparer : IItem, IComparer<BinaryVector> { } 28 28 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/BinaryVectorComparers/LexicographicBinaryVectorComparer.cs
r12566 r12582 27 27 28 28 namespace HeuristicLab.Problems.NK { 29 30 29 [Item("Lexicographic Binary Vector Comparer", "Compares two binary vectors lexicographically")] 31 30 [StorableClass] 32 public sealed class LexicographicBinaryVectorComparer : BinaryVectorComparer { 33 31 public sealed class LexicographicBinaryVectorComparer : Item, IBinaryVectorComparer { 34 32 [StorableConstructor] 35 33 private LexicographicBinaryVectorComparer(bool deserializing) : base(deserializing) { } 36 34 private LexicographicBinaryVectorComparer(LexicographicBinaryVectorComparer original, Cloner cloner) 37 : base(original, cloner) { 38 } 35 : base(original, cloner) { } 39 36 public LexicographicBinaryVectorComparer() { } 40 37 public override IDeepCloneable Clone(Cloner cloner) { … … 42 39 } 43 40 44 public overrideint Compare(BinaryVector x, BinaryVector y) {41 public int Compare(BinaryVector x, BinaryVector y) { 45 42 for (int i = 0; i < Math.Min(x.Length, y.Length); i++) { 46 43 if (!x[i] && y[i]) -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/BinaryVectorComparers/MedianBitBinaryVectorComparer.cs
r12566 r12582 27 27 28 28 namespace HeuristicLab.Problems.NK { 29 30 29 [Item("Median Bit Binary Vector Comparer", "Compares two binary vectors by the median positive bit location")] 31 30 [StorableClass] 32 public sealed class MedianBitBinaryVectorComparer : BinaryVectorComparer { 33 31 public sealed class MedianBitBinaryVectorComparer : Item, IBinaryVectorComparer { 34 32 [StorableConstructor] 35 33 private MedianBitBinaryVectorComparer(bool deserializing) : base(deserializing) { } 36 34 private MedianBitBinaryVectorComparer(MedianBitBinaryVectorComparer original, Cloner cloner) 37 : base(original, cloner) { 38 } 35 : base(original, cloner) { } 39 36 public MedianBitBinaryVectorComparer() { } 40 37 public override IDeepCloneable Clone(Cloner cloner) { … … 42 39 } 43 40 44 p ublicstatic int MedianBit(BinaryVector x) {41 private static int MedianBit(BinaryVector x) { 45 42 var activeIndices = x.Select((b, i) => new { b, i }).Where(v => v.b).ToList(); 46 43 if (activeIndices.Count > 0) … … 49 46 return 0; 50 47 } 51 public override int Compare(BinaryVector x, BinaryVector y) { 48 49 public int Compare(BinaryVector x, BinaryVector y) { 52 50 return MedianBit(x) - MedianBit(y); 53 51 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/HeuristicLab.Problems.NK.csproj
r12569 r12582 157 157 </ItemGroup> 158 158 <ItemGroup> 159 <Compile Include="BinaryVectorComparers\BinaryVectorComparer.cs" />160 159 <Compile Include="BinaryVectorComparers\IBinaryVectorComparer.cs" /> 161 160 <Compile Include="BinaryVectorComparers\LexicographicBinaryVectorComparer.cs" /> -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers/IInteractionInitializer.cs
r12566 r12582 24 24 25 25 namespace HeuristicLab.Problems.NK { 26 public interface IInteractionInitializer : I NamedItem {26 public interface IInteractionInitializer : IItem { 27 27 BoolMatrix InitializeInterations(int length, int nComponents, int nInteractions, IRandom random); 28 28 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers/IncreasingBlockSizeInteractionsInitializer.cs
r12566 r12582 29 29 30 30 namespace HeuristicLab.Problems.NK { 31 32 31 [Item("IncreasingBlockSizeInteractionsInitializer", "Randomly assignes interactions across all bits but makes sure that different numbers of ineractions are applied to different bits.")] 33 32 [StorableClass] 34 public class IncreasingBlockSizeInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer { 35 33 public sealed class IncreasingBlockSizeInteractionsInitializer : Item, IInteractionInitializer { 36 34 [StorableConstructor] 37 protected IncreasingBlockSizeInteractionsInitializer(bool serializing) : base(serializing) { } 38 protected IncreasingBlockSizeInteractionsInitializer(IncreasingBlockSizeInteractionsInitializer original, Cloner cloner) : base(original, cloner) { } 39 public IncreasingBlockSizeInteractionsInitializer() { 40 } 41 42 35 private IncreasingBlockSizeInteractionsInitializer(bool serializing) : base(serializing) { } 36 private IncreasingBlockSizeInteractionsInitializer(IncreasingBlockSizeInteractionsInitializer original, Cloner cloner) : base(original, cloner) { } 37 public IncreasingBlockSizeInteractionsInitializer() { } 43 38 public override IDeepCloneable Clone(Cloner cloner) { 44 39 return new IncreasingBlockSizeInteractionsInitializer(this, cloner); 45 40 } 46 41 47 #region IInteractionInitializer Members48 42 public BoolMatrix InitializeInterations(int length, int nComponents, int nInteractions, IRandom random) { 49 43 Dictionary<int, int> bitInteractionCounts = new Dictionary<int, int>(); … … 77 71 return m; 78 72 } 79 #endregion80 73 } 81 74 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers/LimitedRandomInteractionsInitializer.cs
r12569 r12582 29 29 30 30 namespace HeuristicLab.Problems.NK { 31 32 31 [Item("LimitedRandomInteractionsInitializer", "Randomly assignes interactions across bits in the vicinity of each other respecting the maximum distances if possible.")] 33 32 [StorableClass] 34 public class LimitedRandomInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer { 35 33 public sealed class LimitedRandomInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer { 36 34 private class Bounds { 37 35 public readonly int Min; … … 53 51 } 54 52 53 [StorableConstructor] 54 private LimitedRandomInteractionsInitializer(bool serializing) : base(serializing) { } 55 private LimitedRandomInteractionsInitializer(LimitedRandomInteractionsInitializer original, Cloner cloner) : base(original, cloner) { } 56 public LimitedRandomInteractionsInitializer() { 57 Parameters.Add(new ValueParameter<IntValue>("MaximumDistance", "Maximum distance of interactions in bits or 0 for unlimited")); 58 Parameters.Add(new ValueParameter<DoubleValue>("MaximumDistanceRatio", "Maximum distance of interactions as ratio of the total length or 0 for unlimited")); 59 } 60 61 public override IDeepCloneable Clone(Cloner cloner) { 62 return new LimitedRandomInteractionsInitializer(this, cloner); 63 } 64 55 65 private int MaximumDistance(int length, int nInteractions) { 56 66 int maxBitDist = MaximumDistanceParameter.Value.Value; … … 64 74 } 65 75 66 [StorableConstructor]67 protected LimitedRandomInteractionsInitializer(bool serializing) : base(serializing) { }68 protected LimitedRandomInteractionsInitializer(LimitedRandomInteractionsInitializer original, Cloner cloner) : base(original, cloner) { }69 public LimitedRandomInteractionsInitializer() {70 Parameters.Add(new ValueParameter<IntValue>("MaximumDistance", "Maximum distance of interactions in bits or 0 for unlimited"));71 Parameters.Add(new ValueParameter<DoubleValue>("MaximumDistanceRatio", "Maximum distance of interactions as ratio of the total length or 0 for unlimited"));72 }73 74 public override IDeepCloneable Clone(Cloner cloner) {75 return new LimitedRandomInteractionsInitializer(this, cloner);76 }77 78 #region IInteractionInitializer Members79 76 public BoolMatrix InitializeInterations(int length, int nComponents, int nInteractions, IRandom random) { 80 77 BoolMatrix m = new BoolMatrix(length, nComponents); … … 97 94 return m; 98 95 } 99 #endregion100 96 } 101 97 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers/RandomInteractionsInitializer.cs
r12566 r12582 27 27 28 28 namespace HeuristicLab.Problems.NK { 29 30 29 [Item("RandomInteractionsInitializer", "Randomly assignes interactions across all bits")] 31 30 [StorableClass] 32 public class RandomInteractionsInitializer : NamedItem, IInteractionInitializer { 33 34 public override bool CanChangeName { get { return false; } } 35 public override bool CanChangeDescription { get { return false; } } 36 37 31 public sealed class RandomInteractionsInitializer : Item, IInteractionInitializer { 38 32 [StorableConstructor] 39 protected RandomInteractionsInitializer(bool serializing) : base(serializing) { } 40 protected RandomInteractionsInitializer(RandomInteractionsInitializer original, Cloner cloner) : base(original, cloner) { } 41 public RandomInteractionsInitializer() { 42 name = ItemName; 43 description = ItemDescription; 44 } 33 private RandomInteractionsInitializer(bool serializing) : base(serializing) { } 34 private RandomInteractionsInitializer(RandomInteractionsInitializer original, Cloner cloner) : base(original, cloner) { } 35 public RandomInteractionsInitializer() { } 45 36 public override IDeepCloneable Clone(Cloner cloner) { 46 37 return new RandomInteractionsInitializer(this, cloner); 47 38 } 48 39 49 #region IInteractionInitializer Members50 40 public BoolMatrix InitializeInterations(int length, int nComponents, int nInteractions, IRandom random) { 51 41 BoolMatrix m = new BoolMatrix(length, nComponents); … … 65 55 return m; 66 56 } 67 #endregion68 57 } 69 58 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers/SortedRandomInteractionsInitializer.cs
r12569 r12582 30 30 31 31 namespace HeuristicLab.Problems.NK { 32 33 32 [Item("SortedRandomInteractionsInitializer", "Randomly assigns interactions across all bits and sorts components according to bit affinity.")] 34 33 [StorableClass] 35 public class SortedRandomInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer {34 public sealed class SortedRandomInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer { 36 35 public IConstrainedValueParameter<IBinaryVectorComparer> ComparerParameter { 37 36 get { return (IConstrainedValueParameter<IBinaryVectorComparer>)Parameters["Comparer"]; } … … 42 41 43 42 [StorableConstructor] 44 pr otectedSortedRandomInteractionsInitializer(bool serializing) : base(serializing) { }45 pr otectedSortedRandomInteractionsInitializer(SortedRandomInteractionsInitializer original, Cloner cloner) : base(original, cloner) { }43 private SortedRandomInteractionsInitializer(bool serializing) : base(serializing) { } 44 private SortedRandomInteractionsInitializer(SortedRandomInteractionsInitializer original, Cloner cloner) : base(original, cloner) { } 46 45 public SortedRandomInteractionsInitializer() { 47 46 Parameters.Add(new ConstrainedValueParameter<IBinaryVectorComparer>("Comparer", "Comparison for sorting of component functions.")); … … 59 58 } 60 59 61 #region IInteractionInitializer Members62 60 public BoolMatrix InitializeInterations(int length, int nComponents, int nInteractions, IRandom random) { 63 61 BinaryVector[] components = Enumerable.Range(0, nComponents).Select(i => new BinaryVector(length)).ToArray(); … … 83 81 return m; 84 82 } 85 #endregion86 83 } 87 84 } -
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/NKLandscape.cs
r12576 r12582 31 31 using HeuristicLab.PluginInfrastructure; 32 32 using HeuristicLab.Problems.Binary; 33 using HeuristicLab.Problems.NK.WeightInitializers;34 33 using HeuristicLab.Random; 35 34 … … 246 245 247 246 #region Evaluation function 248 p ublicstatic long Hash(long x, HashAlgorithm hashAlg) {247 private static long Hash(long x, HashAlgorithm hashAlg) { 249 248 return BitConverter.ToInt64(hashAlg.ComputeHash(BitConverter.GetBytes(x), 0, 8), 0); 250 249 } 251 250 252 251 public static double F_i(long x, long i, long g_i, long seed, int q, double p) { 253 var hash = new Func<long, long>(y => Hash(y, HashAlgorithm));252 var hash = new Func<long, long>(y => Hash(y, HashAlgorithm)); 254 253 var fi = Math.Abs((double)hash((x & g_i) ^ hash(g_i ^ hash(i ^ seed)))) / long.MaxValue; 255 if (q > 0) { fi = Math.Round(fi *q)/q; }254 if (q > 0) { fi = Math.Round(fi * q) / q; } 256 255 if (p > 0) { 257 256 hash = y => Hash(y, HashAlgorithmP); … … 262 261 } 263 262 264 p ublicstatic double F(long x, long[] g, double[] w, long seed, ref double[] f_i, int q, double p) {263 private static double F(long x, long[] g, double[] w, long seed, ref double[] f_i, int q, double p) { 265 264 double value = 0; 266 265 for (int i = 0; i < g.Length; i++) { … … 311 310 312 311 public override double Evaluate(BinaryVector vector, IRandom random) { 313 double[] f_i; //not used atm312 double[] f_i; //useful for debugging 314 313 double quality = Evaluate(vector, GeneInteractions, Weights, InteractionSeed.Value, out f_i, Q, P); 315 314 return quality; -
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.