Changeset 12582 for branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers
- Timestamp:
- 07/03/15 14:54:28 (9 years ago)
- Location:
- branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.